diff --git a/sdk/resourcemanager/devcenter/armdevcenter/CHANGELOG.md b/sdk/resourcemanager/devcenter/armdevcenter/CHANGELOG.md index f5bbc01d853d..9928d9532404 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/CHANGELOG.md +++ b/sdk/resourcemanager/devcenter/armdevcenter/CHANGELOG.md @@ -1,5 +1,134 @@ # Release History +## 2.1.0-beta.1 (2024-09-30) +### Features Added + +- New value `CatalogItemTypeImageDefinition` added to enum type `CatalogItemType` +- New value `DomainJoinTypeNone` added to enum type `DomainJoinType` +- New enum type `CustomizationTaskInputType` with values `CustomizationTaskInputTypeBoolean`, `CustomizationTaskInputTypeNumber`, `CustomizationTaskInputTypeString` +- New enum type `DevCenterResourceType` with values `DevCenterResourceTypeAttachedNetworks`, `DevCenterResourceTypeImages`, `DevCenterResourceTypeSKUs` +- New enum type `DevboxDisksEncryptionEnableStatus` with values `DevboxDisksEncryptionEnableStatusDisabled`, `DevboxDisksEncryptionEnableStatusEnabled` +- New enum type `ImageDefinitionBuildStatus` with values `ImageDefinitionBuildStatusCancelled`, `ImageDefinitionBuildStatusFailed`, `ImageDefinitionBuildStatusRunning`, `ImageDefinitionBuildStatusSucceeded`, `ImageDefinitionBuildStatusTimedOut`, `ImageDefinitionBuildStatusValidationFailed` +- New enum type `InstallAzureMonitorAgentEnableStatus` with values `InstallAzureMonitorAgentEnableStatusDisabled`, `InstallAzureMonitorAgentEnableStatusEnabled` +- New enum type `MicrosoftHostedNetworkEnableStatus` with values `MicrosoftHostedNetworkEnableStatusDisabled`, `MicrosoftHostedNetworkEnableStatusEnabled` +- New enum type `PlanMemberSyncState` with values `PlanMemberSyncStateCanceled`, `PlanMemberSyncStateFailed`, `PlanMemberSyncStateInProgress`, `PlanMemberSyncStateNotStarted`, `PlanMemberSyncStateSucceeded` +- New enum type `PlanMemberType` with values `PlanMemberTypeGroup`, `PlanMemberTypeUser` +- New enum type `PoolDevBoxDefinitionType` with values `PoolDevBoxDefinitionTypeReference`, `PoolDevBoxDefinitionTypeValue` +- New enum type `StopOnNoConnectEnableStatus` with values `StopOnNoConnectEnableStatusDisabled`, `StopOnNoConnectEnableStatusEnabled` +- New function `*ClientFactory.NewCurationProfilesClient() *CurationProfilesClient` +- New function `*ClientFactory.NewCustomizationTasksClient() *CustomizationTasksClient` +- New function `*ClientFactory.NewEncryptionSetsClient() *EncryptionSetsClient` +- New function `*ClientFactory.NewPlanMembersClient() *PlanMembersClient` +- New function `*ClientFactory.NewPlansClient() *PlansClient` +- New function `*ClientFactory.NewProjectCatalogImageDefinitionBuildClient() *ProjectCatalogImageDefinitionBuildClient` +- New function `*ClientFactory.NewProjectCatalogImageDefinitionBuildsClient() *ProjectCatalogImageDefinitionBuildsClient` +- New function `*ClientFactory.NewProjectCatalogImageDefinitionsClient() *ProjectCatalogImageDefinitionsClient` +- New function `*ClientFactory.NewProjectPoliciesClient() *ProjectPoliciesClient` +- New function `NewCurationProfilesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CurationProfilesClient, error)` +- New function `*CurationProfilesClient.BeginCreateOrUpdate(context.Context, string, string, string, CurationProfile, *CurationProfilesClientBeginCreateOrUpdateOptions) (*runtime.Poller[CurationProfilesClientCreateOrUpdateResponse], error)` +- New function `*CurationProfilesClient.BeginDelete(context.Context, string, string, string, *CurationProfilesClientBeginDeleteOptions) (*runtime.Poller[CurationProfilesClientDeleteResponse], error)` +- New function `*CurationProfilesClient.Get(context.Context, string, string, string, *CurationProfilesClientGetOptions) (CurationProfilesClientGetResponse, error)` +- New function `*CurationProfilesClient.NewListByDevCenterPager(string, string, *CurationProfilesClientListByDevCenterOptions) *runtime.Pager[CurationProfilesClientListByDevCenterResponse]` +- New function `*CurationProfilesClient.BeginUpdate(context.Context, string, string, string, CurationProfileUpdate, *CurationProfilesClientBeginUpdateOptions) (*runtime.Poller[CurationProfilesClientUpdateResponse], error)` +- New function `NewCustomizationTasksClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CustomizationTasksClient, error)` +- New function `*CustomizationTasksClient.Get(context.Context, string, string, string, string, *CustomizationTasksClientGetOptions) (CustomizationTasksClientGetResponse, error)` +- New function `*CustomizationTasksClient.GetErrorDetails(context.Context, string, string, string, string, *CustomizationTasksClientGetErrorDetailsOptions) (CustomizationTasksClientGetErrorDetailsResponse, error)` +- New function `*CustomizationTasksClient.NewListByCatalogPager(string, string, string, *CustomizationTasksClientListByCatalogOptions) *runtime.Pager[CustomizationTasksClientListByCatalogResponse]` +- New function `NewEncryptionSetsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*EncryptionSetsClient, error)` +- New function `*EncryptionSetsClient.BeginCreateOrUpdate(context.Context, string, string, string, EncryptionSet, *EncryptionSetsClientBeginCreateOrUpdateOptions) (*runtime.Poller[EncryptionSetsClientCreateOrUpdateResponse], error)` +- New function `*EncryptionSetsClient.BeginDelete(context.Context, string, string, string, *EncryptionSetsClientBeginDeleteOptions) (*runtime.Poller[EncryptionSetsClientDeleteResponse], error)` +- New function `*EncryptionSetsClient.Get(context.Context, string, string, string, *EncryptionSetsClientGetOptions) (EncryptionSetsClientGetResponse, error)` +- New function `*EncryptionSetsClient.NewListPager(string, string, *EncryptionSetsClientListOptions) *runtime.Pager[EncryptionSetsClientListResponse]` +- New function `*EncryptionSetsClient.BeginUpdate(context.Context, string, string, string, EncryptionSetUpdate, *EncryptionSetsClientBeginUpdateOptions) (*runtime.Poller[EncryptionSetsClientUpdateResponse], error)` +- New function `*ImageVersionsClient.GetByProject(context.Context, string, string, string, string, *ImageVersionsClientGetByProjectOptions) (ImageVersionsClientGetByProjectResponse, error)` +- New function `*ImageVersionsClient.NewListByProjectPager(string, string, string, *ImageVersionsClientListByProjectOptions) *runtime.Pager[ImageVersionsClientListByProjectResponse]` +- New function `*ImagesClient.GetByProject(context.Context, string, string, string, *ImagesClientGetByProjectOptions) (ImagesClientGetByProjectResponse, error)` +- New function `*ImagesClient.NewListByProjectPager(string, string, *ImagesClientListByProjectOptions) *runtime.Pager[ImagesClientListByProjectResponse]` +- New function `NewPlanMembersClient(string, azcore.TokenCredential, *arm.ClientOptions) (*PlanMembersClient, error)` +- New function `*PlanMembersClient.BeginCreateOrUpdate(context.Context, string, string, string, PlanMember, *PlanMembersClientBeginCreateOrUpdateOptions) (*runtime.Poller[PlanMembersClientCreateOrUpdateResponse], error)` +- New function `*PlanMembersClient.BeginDelete(context.Context, string, string, string, *PlanMembersClientBeginDeleteOptions) (*runtime.Poller[PlanMembersClientDeleteResponse], error)` +- New function `*PlanMembersClient.Get(context.Context, string, string, string, *PlanMembersClientGetOptions) (PlanMembersClientGetResponse, error)` +- New function `*PlanMembersClient.NewListPager(string, string, *PlanMembersClientListOptions) *runtime.Pager[PlanMembersClientListResponse]` +- New function `*PlanMembersClient.BeginUpdate(context.Context, string, string, string, PlanMemberUpdate, *PlanMembersClientBeginUpdateOptions) (*runtime.Poller[PlanMembersClientUpdateResponse], error)` +- New function `NewPlansClient(string, azcore.TokenCredential, *arm.ClientOptions) (*PlansClient, error)` +- New function `*PlansClient.BeginCreateOrUpdate(context.Context, string, string, Plan, *PlansClientBeginCreateOrUpdateOptions) (*runtime.Poller[PlansClientCreateOrUpdateResponse], error)` +- New function `*PlansClient.BeginDelete(context.Context, string, string, *PlansClientBeginDeleteOptions) (*runtime.Poller[PlansClientDeleteResponse], error)` +- New function `*PlansClient.Get(context.Context, string, string, *PlansClientGetOptions) (PlansClientGetResponse, error)` +- New function `*PlansClient.NewListByResourceGroupPager(string, *PlansClientListByResourceGroupOptions) *runtime.Pager[PlansClientListByResourceGroupResponse]` +- New function `*PlansClient.NewListBySubscriptionPager(*PlansClientListBySubscriptionOptions) *runtime.Pager[PlansClientListBySubscriptionResponse]` +- New function `*PlansClient.BeginUpdate(context.Context, string, string, PlanUpdate, *PlansClientBeginUpdateOptions) (*runtime.Poller[PlansClientUpdateResponse], error)` +- New function `NewProjectCatalogImageDefinitionBuildClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ProjectCatalogImageDefinitionBuildClient, error)` +- New function `*ProjectCatalogImageDefinitionBuildClient.BeginCancel(context.Context, string, string, string, string, string, *ProjectCatalogImageDefinitionBuildClientBeginCancelOptions) (*runtime.Poller[ProjectCatalogImageDefinitionBuildClientCancelResponse], error)` +- New function `*ProjectCatalogImageDefinitionBuildClient.Get(context.Context, string, string, string, string, string, *ProjectCatalogImageDefinitionBuildClientGetOptions) (ProjectCatalogImageDefinitionBuildClientGetResponse, error)` +- New function `*ProjectCatalogImageDefinitionBuildClient.GetBuildDetails(context.Context, string, string, string, string, string, *ProjectCatalogImageDefinitionBuildClientGetBuildDetailsOptions) (ProjectCatalogImageDefinitionBuildClientGetBuildDetailsResponse, error)` +- New function `NewProjectCatalogImageDefinitionBuildsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ProjectCatalogImageDefinitionBuildsClient, error)` +- New function `*ProjectCatalogImageDefinitionBuildsClient.NewListByImageDefinitionPager(string, string, string, string, *ProjectCatalogImageDefinitionBuildsClientListByImageDefinitionOptions) *runtime.Pager[ProjectCatalogImageDefinitionBuildsClientListByImageDefinitionResponse]` +- New function `NewProjectCatalogImageDefinitionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ProjectCatalogImageDefinitionsClient, error)` +- New function `*ProjectCatalogImageDefinitionsClient.GetByProjectCatalog(context.Context, string, string, string, string, *ProjectCatalogImageDefinitionsClientGetByProjectCatalogOptions) (ProjectCatalogImageDefinitionsClientGetByProjectCatalogResponse, error)` +- New function `*ProjectCatalogImageDefinitionsClient.NewListByProjectCatalogPager(string, string, string, *ProjectCatalogImageDefinitionsClientListByProjectCatalogOptions) *runtime.Pager[ProjectCatalogImageDefinitionsClientListByProjectCatalogResponse]` +- New function `*ProjectCatalogImageDefinitionsClient.BeginBuildImage(context.Context, string, string, string, string, *ProjectCatalogImageDefinitionsClientBeginBuildImageOptions) (*runtime.Poller[ProjectCatalogImageDefinitionsClientBuildImageResponse], error)` +- New function `NewProjectPoliciesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ProjectPoliciesClient, error)` +- New function `*ProjectPoliciesClient.BeginCreateOrUpdate(context.Context, string, string, string, ProjectPolicy, *ProjectPoliciesClientBeginCreateOrUpdateOptions) (*runtime.Poller[ProjectPoliciesClientCreateOrUpdateResponse], error)` +- New function `*ProjectPoliciesClient.BeginDelete(context.Context, string, string, string, *ProjectPoliciesClientBeginDeleteOptions) (*runtime.Poller[ProjectPoliciesClientDeleteResponse], error)` +- New function `*ProjectPoliciesClient.Get(context.Context, string, string, string, *ProjectPoliciesClientGetOptions) (ProjectPoliciesClientGetResponse, error)` +- New function `*ProjectPoliciesClient.NewListByDevCenterPager(string, string, *ProjectPoliciesClientListByDevCenterOptions) *runtime.Pager[ProjectPoliciesClientListByDevCenterResponse]` +- New function `*ProjectPoliciesClient.BeginUpdate(context.Context, string, string, string, ProjectPolicyUpdate, *ProjectPoliciesClientBeginUpdateOptions) (*runtime.Poller[ProjectPoliciesClientUpdateResponse], error)` +- New function `*ProjectsClient.GetInheritedSettings(context.Context, string, string, *ProjectsClientGetInheritedSettingsOptions) (ProjectsClientGetInheritedSettingsResponse, error)` +- New function `*SKUsClient.NewListByProjectPager(string, string, *SKUsClientListByProjectOptions) *runtime.Pager[SKUsClientListByProjectResponse]` +- New struct `CurationProfile` +- New struct `CurationProfileListResult` +- New struct `CurationProfileProperties` +- New struct `CurationProfileUpdate` +- New struct `CurationProfileUpdateProperties` +- New struct `CustomizationTask` +- New struct `CustomizationTaskInput` +- New struct `CustomizationTaskListResult` +- New struct `CustomizationTaskProperties` +- New struct `DevBoxProvisioningSettings` +- New struct `EncryptionSet` +- New struct `EncryptionSetListResult` +- New struct `EncryptionSetProperties` +- New struct `EncryptionSetUpdate` +- New struct `EncryptionSetUpdateProperties` +- New struct `ImageCreationErrorDetails` +- New struct `ImageDefinition` +- New struct `ImageDefinitionBuild` +- New struct `ImageDefinitionBuildDetails` +- New struct `ImageDefinitionBuildListResult` +- New struct `ImageDefinitionBuildProperties` +- New struct `ImageDefinitionBuildTask` +- New struct `ImageDefinitionBuildTaskGroup` +- New struct `ImageDefinitionBuildTaskParametersItem` +- New struct `ImageDefinitionListResult` +- New struct `ImageDefinitionProperties` +- New struct `InheritedSettingsForProject` +- New struct `LatestImageBuild` +- New struct `NetworkSettings` +- New struct `Plan` +- New struct `PlanListResult` +- New struct `PlanMember` +- New struct `PlanMemberProperties` +- New struct `PlanMemberSyncStatus` +- New struct `PlanMemberUpdate` +- New struct `PlanMemberUpdateProperties` +- New struct `PlanMembersListResult` +- New struct `PlanProperties` +- New struct `PlanUpdate` +- New struct `PoolDevBoxDefinition` +- New struct `ProjectNetworkSettings` +- New struct `ProjectPolicy` +- New struct `ProjectPolicyListResult` +- New struct `ProjectPolicyProperties` +- New struct `ProjectPolicyUpdate` +- New struct `ProjectPolicyUpdateProperties` +- New struct `ResourcePolicy` +- New struct `StopOnNoConnectConfiguration` +- New field `DevBoxDefinition`, `DevBoxDefinitionType`, `StopOnNoConnect` in struct `PoolProperties` +- New field `DevBoxDefinition`, `DevBoxDefinitionType`, `StopOnNoConnect` in struct `PoolUpdateProperties` +- New field `DevBoxProvisioningSettings`, `NetworkSettings`, `PlanID`, `RestrictedResourceTypes` in struct `Properties` +- New field `DevBoxProvisioningSettings`, `NetworkSettings`, `PlanID`, `RestrictedResourceTypes` in struct `UpdateProperties` + + ## 2.0.0 (2024-04-26) ### Breaking Changes diff --git a/sdk/resourcemanager/devcenter/armdevcenter/attachednetworks_client.go b/sdk/resourcemanager/devcenter/armdevcenter/attachednetworks_client.go index 44d18dbb6a99..8b20e4685e44 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/attachednetworks_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/attachednetworks_client.go @@ -47,7 +47,7 @@ func NewAttachedNetworksClient(subscriptionID string, credential azcore.TokenCre // BeginCreateOrUpdate - Creates or updates an attached NetworkConnection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - attachedNetworkConnectionName - The name of the attached NetworkConnection. @@ -75,7 +75,7 @@ func (client *AttachedNetworksClient) BeginCreateOrUpdate(ctx context.Context, r // CreateOrUpdate - Creates or updates an attached NetworkConnection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *AttachedNetworksClient) createOrUpdate(ctx context.Context, resourceGroupName string, devCenterName string, attachedNetworkConnectionName string, body AttachedNetworkConnection, options *AttachedNetworksClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "AttachedNetworksClient.BeginCreateOrUpdate" @@ -121,7 +121,7 @@ func (client *AttachedNetworksClient) createOrUpdateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -133,7 +133,7 @@ func (client *AttachedNetworksClient) createOrUpdateCreateRequest(ctx context.Co // BeginDelete - Un-attach a NetworkConnection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - attachedNetworkConnectionName - The name of the attached NetworkConnection. @@ -160,7 +160,7 @@ func (client *AttachedNetworksClient) BeginDelete(ctx context.Context, resourceG // Delete - Un-attach a NetworkConnection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *AttachedNetworksClient) deleteOperation(ctx context.Context, resourceGroupName string, devCenterName string, attachedNetworkConnectionName string, options *AttachedNetworksClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "AttachedNetworksClient.BeginDelete" @@ -206,7 +206,7 @@ func (client *AttachedNetworksClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -215,7 +215,7 @@ func (client *AttachedNetworksClient) deleteCreateRequest(ctx context.Context, r // GetByDevCenter - Gets an attached NetworkConnection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - attachedNetworkConnectionName - The name of the attached NetworkConnection. @@ -267,7 +267,7 @@ func (client *AttachedNetworksClient) getByDevCenterCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -285,7 +285,7 @@ func (client *AttachedNetworksClient) getByDevCenterHandleResponse(resp *http.Re // GetByProject - Gets an attached NetworkConnection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - attachedNetworkConnectionName - The name of the attached NetworkConnection. @@ -337,7 +337,7 @@ func (client *AttachedNetworksClient) getByProjectCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -354,7 +354,7 @@ func (client *AttachedNetworksClient) getByProjectHandleResponse(resp *http.Resp // NewListByDevCenterPager - Lists the attached NetworkConnections for a DevCenter. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - options - AttachedNetworksClientListByDevCenterOptions contains the optional parameters for the AttachedNetworksClient.NewListByDevCenterPager @@ -405,7 +405,7 @@ func (client *AttachedNetworksClient) listByDevCenterCreateRequest(ctx context.C if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -422,7 +422,7 @@ func (client *AttachedNetworksClient) listByDevCenterHandleResponse(resp *http.R // NewListByProjectPager - Lists the attached NetworkConnections for a Project. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - options - AttachedNetworksClientListByProjectOptions contains the optional parameters for the AttachedNetworksClient.NewListByProjectPager @@ -473,7 +473,7 @@ func (client *AttachedNetworksClient) listByProjectCreateRequest(ctx context.Con if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/devcenter/armdevcenter/attachednetworks_client_example_test.go b/sdk/resourcemanager/devcenter/armdevcenter/attachednetworks_client_example_test.go deleted file mode 100644 index 0526d4d23d3d..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/attachednetworks_client_example_test.go +++ /dev/null @@ -1,295 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdevcenter_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/AttachedNetworks_ListByProject.json -func ExampleAttachedNetworksClient_NewListByProjectPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAttachedNetworksClient().NewListByProjectPager("rg1", "DevProject", &armdevcenter.AttachedNetworksClientListByProjectOptions{Top: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AttachedNetworkListResult = armdevcenter.AttachedNetworkListResult{ - // Value: []*armdevcenter.AttachedNetworkConnection{ - // { - // Name: to.Ptr("netmap1"), - // Type: to.Ptr("Microsoft.DevCenter/projects/attachedNetworks"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/DevProject/attachednetworks/netmap1"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // CreatedBy: to.Ptr("User1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // LastModifiedBy: to.Ptr("User1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeApplication), - // }, - // Properties: &armdevcenter.AttachedNetworkConnectionProperties{ - // HealthCheckStatus: to.Ptr(armdevcenter.HealthCheckStatus("Healthy")), - // NetworkConnectionID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/NetworkConnections/network-uswest3"), - // NetworkConnectionLocation: to.Ptr("centralus"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("netmap2"), - // Type: to.Ptr("Microsoft.DevCenter/projects/attachedNetworks"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/DevProject/attachednetworks/netmap2"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // CreatedBy: to.Ptr("User1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // LastModifiedBy: to.Ptr("User1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.AttachedNetworkConnectionProperties{ - // HealthCheckStatus: to.Ptr(armdevcenter.HealthCheckStatus("Healthy")), - // NetworkConnectionID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/NetworkConnections/network-uswest3"), - // NetworkConnectionLocation: to.Ptr("centralus"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/AttachedNetworks_GetByProject.json -func ExampleAttachedNetworksClient_GetByProject() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAttachedNetworksClient().GetByProject(ctx, "rg1", "DevProject", "network-uswest3", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AttachedNetworkConnection = armdevcenter.AttachedNetworkConnection{ - // Name: to.Ptr("network-uswest3"), - // Type: to.Ptr("Microsoft.DevCenter/projects/attachednetworks"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/DevProject/attachednetworks/network-uswest3"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // CreatedBy: to.Ptr("User1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // LastModifiedBy: to.Ptr("User1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.AttachedNetworkConnectionProperties{ - // HealthCheckStatus: to.Ptr(armdevcenter.HealthCheckStatus("Healthy")), - // NetworkConnectionID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/NetworkConnections/network-uswest3"), - // NetworkConnectionLocation: to.Ptr("centralus"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/AttachedNetworks_ListByDevCenter.json -func ExampleAttachedNetworksClient_NewListByDevCenterPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAttachedNetworksClient().NewListByDevCenterPager("rg1", "Contoso", &armdevcenter.AttachedNetworksClientListByDevCenterOptions{Top: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AttachedNetworkListResult = armdevcenter.AttachedNetworkListResult{ - // Value: []*armdevcenter.AttachedNetworkConnection{ - // { - // Name: to.Ptr("netmap1"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters/attachedNetworks"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso/attachednetworks/netmap1"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // CreatedBy: to.Ptr("User1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // LastModifiedBy: to.Ptr("User1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeApplication), - // }, - // Properties: &armdevcenter.AttachedNetworkConnectionProperties{ - // HealthCheckStatus: to.Ptr(armdevcenter.HealthCheckStatus("Healthy")), - // NetworkConnectionID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/NetworkConnections/network-uswest3"), - // NetworkConnectionLocation: to.Ptr("centralus"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("netmap2"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters/attachedNetworks"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso/attachednetworks/netmap2"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // CreatedBy: to.Ptr("User1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // LastModifiedBy: to.Ptr("User1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.AttachedNetworkConnectionProperties{ - // HealthCheckStatus: to.Ptr(armdevcenter.HealthCheckStatus("Healthy")), - // NetworkConnectionID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/networkconnections/network-uswest3"), - // NetworkConnectionLocation: to.Ptr("centralus"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/AttachedNetworks_GetByDevCenter.json -func ExampleAttachedNetworksClient_GetByDevCenter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAttachedNetworksClient().GetByDevCenter(ctx, "rg1", "Contoso", "network-uswest3", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AttachedNetworkConnection = armdevcenter.AttachedNetworkConnection{ - // Name: to.Ptr("network-uswest3"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters/attachednetworks"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso/attachednetworks/network-uswest3"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // CreatedBy: to.Ptr("User1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // LastModifiedBy: to.Ptr("User1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.AttachedNetworkConnectionProperties{ - // HealthCheckStatus: to.Ptr(armdevcenter.HealthCheckStatus("Healthy")), - // NetworkConnectionID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/NetworkConnections/network-uswest3"), - // NetworkConnectionLocation: to.Ptr("centralus"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/AttachedNetworks_Create.json -func ExampleAttachedNetworksClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAttachedNetworksClient().BeginCreateOrUpdate(ctx, "rg1", "Contoso", "network-uswest3", armdevcenter.AttachedNetworkConnection{ - Properties: &armdevcenter.AttachedNetworkConnectionProperties{ - NetworkConnectionID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/NetworkConnections/network-uswest3"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AttachedNetworkConnection = armdevcenter.AttachedNetworkConnection{ - // Name: to.Ptr("network-uswest3"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters/attachednetworks"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso/attachednetworks/network-uswest3"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // CreatedBy: to.Ptr("User1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // LastModifiedBy: to.Ptr("User1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.AttachedNetworkConnectionProperties{ - // NetworkConnectionID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/NetworkConnections/network-uswest3"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/AttachedNetworks_Delete.json -func ExampleAttachedNetworksClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAttachedNetworksClient().BeginDelete(ctx, "rg1", "Contoso", "network-uswest3", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/autorest.md b/sdk/resourcemanager/devcenter/armdevcenter/autorest.md index 46ec4a131fd6..94636a7f1eba 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/autorest.md +++ b/sdk/resourcemanager/devcenter/armdevcenter/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/devcenter/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/devcenter/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 2.0.0 -tag: package-2024-02 +module-version: 2.1.0-beta.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/devcenter/armdevcenter/catalogs_client.go b/sdk/resourcemanager/devcenter/armdevcenter/catalogs_client.go index 910c7ceab319..a359e34f9c44 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/catalogs_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/catalogs_client.go @@ -47,7 +47,7 @@ func NewCatalogsClient(subscriptionID string, credential azcore.TokenCredential, // BeginConnect - Connects a catalog to enable syncing. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - catalogName - The name of the Catalog. @@ -73,7 +73,7 @@ func (client *CatalogsClient) BeginConnect(ctx context.Context, resourceGroupNam // Connect - Connects a catalog to enable syncing. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *CatalogsClient) connect(ctx context.Context, resourceGroupName string, devCenterName string, catalogName string, options *CatalogsClientBeginConnectOptions) (*http.Response, error) { var err error const operationName = "CatalogsClient.BeginConnect" @@ -119,7 +119,7 @@ func (client *CatalogsClient) connectCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -128,7 +128,7 @@ func (client *CatalogsClient) connectCreateRequest(ctx context.Context, resource // BeginCreateOrUpdate - Creates or updates a catalog. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - catalogName - The name of the Catalog. @@ -156,7 +156,7 @@ func (client *CatalogsClient) BeginCreateOrUpdate(ctx context.Context, resourceG // CreateOrUpdate - Creates or updates a catalog. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *CatalogsClient) createOrUpdate(ctx context.Context, resourceGroupName string, devCenterName string, catalogName string, body Catalog, options *CatalogsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "CatalogsClient.BeginCreateOrUpdate" @@ -202,7 +202,7 @@ func (client *CatalogsClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -214,7 +214,7 @@ func (client *CatalogsClient) createOrUpdateCreateRequest(ctx context.Context, r // BeginDelete - Deletes a catalog resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - catalogName - The name of the Catalog. @@ -240,7 +240,7 @@ func (client *CatalogsClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Deletes a catalog resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *CatalogsClient) deleteOperation(ctx context.Context, resourceGroupName string, devCenterName string, catalogName string, options *CatalogsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "CatalogsClient.BeginDelete" @@ -286,7 +286,7 @@ func (client *CatalogsClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -295,7 +295,7 @@ func (client *CatalogsClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Gets a catalog // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - catalogName - The name of the Catalog. @@ -346,7 +346,7 @@ func (client *CatalogsClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -364,7 +364,7 @@ func (client *CatalogsClient) getHandleResponse(resp *http.Response) (CatalogsCl // GetSyncErrorDetails - Gets catalog synchronization error details // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - catalogName - The name of the Catalog. @@ -416,7 +416,7 @@ func (client *CatalogsClient) getSyncErrorDetailsCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -433,7 +433,7 @@ func (client *CatalogsClient) getSyncErrorDetailsHandleResponse(resp *http.Respo // NewListByDevCenterPager - Lists catalogs for a devcenter. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - options - CatalogsClientListByDevCenterOptions contains the optional parameters for the CatalogsClient.NewListByDevCenterPager @@ -484,7 +484,7 @@ func (client *CatalogsClient) listByDevCenterCreateRequest(ctx context.Context, if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -502,7 +502,7 @@ func (client *CatalogsClient) listByDevCenterHandleResponse(resp *http.Response) // BeginSync - Syncs templates for a template source. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - catalogName - The name of the Catalog. @@ -528,7 +528,7 @@ func (client *CatalogsClient) BeginSync(ctx context.Context, resourceGroupName s // Sync - Syncs templates for a template source. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *CatalogsClient) syncOperation(ctx context.Context, resourceGroupName string, devCenterName string, catalogName string, options *CatalogsClientBeginSyncOptions) (*http.Response, error) { var err error const operationName = "CatalogsClient.BeginSync" @@ -574,7 +574,7 @@ func (client *CatalogsClient) syncCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -583,7 +583,7 @@ func (client *CatalogsClient) syncCreateRequest(ctx context.Context, resourceGro // BeginUpdate - Partially updates a catalog. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - catalogName - The name of the Catalog. @@ -610,7 +610,7 @@ func (client *CatalogsClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Partially updates a catalog. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *CatalogsClient) update(ctx context.Context, resourceGroupName string, devCenterName string, catalogName string, body CatalogUpdate, options *CatalogsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "CatalogsClient.BeginUpdate" @@ -656,7 +656,7 @@ func (client *CatalogsClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { diff --git a/sdk/resourcemanager/devcenter/armdevcenter/catalogs_client_example_test.go b/sdk/resourcemanager/devcenter/armdevcenter/catalogs_client_example_test.go deleted file mode 100644 index 32cd482fb6f3..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/catalogs_client_example_test.go +++ /dev/null @@ -1,439 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdevcenter_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Catalogs_List.json -func ExampleCatalogsClient_NewListByDevCenterPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCatalogsClient().NewListByDevCenterPager("rg1", "Contoso", &armdevcenter.CatalogsClientListByDevCenterOptions{Top: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CatalogListResult = armdevcenter.CatalogListResult{ - // Value: []*armdevcenter.Catalog{ - // { - // Name: to.Ptr("CentralCatalog"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters/catalogs"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso/catalogs/CentralCatalog"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // CreatedBy: to.Ptr("User1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // LastModifiedBy: to.Ptr("User1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.CatalogProperties{ - // GitHub: &armdevcenter.GitCatalog{ - // Path: to.Ptr("/templates"), - // Branch: to.Ptr("main"), - // SecretIdentifier: to.Ptr("https://contosokv.vault.azure.net/secrets/CentralRepoPat"), - // URI: to.Ptr("https://github.com/Contoso/centralrepo-fake.git"), - // }, - // ConnectionState: to.Ptr(armdevcenter.CatalogConnectionStateConnected), - // LastConnectionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:28:00.314Z"); return t}()), - // LastSyncStats: &armdevcenter.SyncStats{ - // Added: to.Ptr[int32](1), - // Removed: to.Ptr[int32](1), - // SynchronizationErrors: to.Ptr[int32](1), - // Unchanged: to.Ptr[int32](1), - // Updated: to.Ptr[int32](1), - // ValidationErrors: to.Ptr[int32](1), - // }, - // LastSyncTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:28:00.314Z"); return t}()), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // SyncState: to.Ptr(armdevcenter.CatalogSyncStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Catalogs_Get.json -func ExampleCatalogsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCatalogsClient().Get(ctx, "rg1", "Contoso", "CentralCatalog", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Catalog = armdevcenter.Catalog{ - // Name: to.Ptr("CentralCatalog"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters/catalogs"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso/catalogs/CentralCatalog"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // CreatedBy: to.Ptr("User1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // LastModifiedBy: to.Ptr("User1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.CatalogProperties{ - // GitHub: &armdevcenter.GitCatalog{ - // Path: to.Ptr("/templates"), - // Branch: to.Ptr("main"), - // SecretIdentifier: to.Ptr("https://contosokv.vault.azure.net/secrets/CentralRepoPat"), - // URI: to.Ptr("https://github.com/Contoso/centralrepo-fake.git"), - // }, - // SyncType: to.Ptr(armdevcenter.CatalogSyncTypeScheduled), - // ConnectionState: to.Ptr(armdevcenter.CatalogConnectionStateConnected), - // LastConnectionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:28:00.314Z"); return t}()), - // LastSyncStats: &armdevcenter.SyncStats{ - // Added: to.Ptr[int32](1), - // Removed: to.Ptr[int32](1), - // SynchronizationErrors: to.Ptr[int32](1), - // Unchanged: to.Ptr[int32](1), - // Updated: to.Ptr[int32](1), - // ValidationErrors: to.Ptr[int32](1), - // }, - // LastSyncTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:28:00.314Z"); return t}()), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // SyncState: to.Ptr(armdevcenter.CatalogSyncStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Catalogs_CreateAdo.json -func ExampleCatalogsClient_BeginCreateOrUpdate_catalogsCreateOrUpdateAdo() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCatalogsClient().BeginCreateOrUpdate(ctx, "rg1", "Contoso", "CentralCatalog", armdevcenter.Catalog{ - Properties: &armdevcenter.CatalogProperties{ - AdoGit: &armdevcenter.GitCatalog{ - Path: to.Ptr("/templates"), - Branch: to.Ptr("main"), - SecretIdentifier: to.Ptr("https://contosokv.vault.azure.net/secrets/CentralRepoPat"), - URI: to.Ptr("https://contoso@dev.azure.com/contoso/contosoOrg/_git/centralrepo-fakecontoso"), - }, - SyncType: to.Ptr(armdevcenter.CatalogSyncTypeScheduled), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Catalog = armdevcenter.Catalog{ - // Name: to.Ptr("CentralCatalog"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters/catalogs"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso/catalogs/CentralCatalog"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // CreatedBy: to.Ptr("User1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // LastModifiedBy: to.Ptr("User1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.CatalogProperties{ - // AdoGit: &armdevcenter.GitCatalog{ - // Path: to.Ptr("/templates"), - // Branch: to.Ptr("main"), - // SecretIdentifier: to.Ptr("https://contosokv.vault.azure.net/secrets/CentralRepoPat"), - // URI: to.Ptr("https://contoso@dev.azure.com/contoso/contosoOrg/_git/centralrepo-fakecontoso"), - // }, - // SyncType: to.Ptr(armdevcenter.CatalogSyncTypeScheduled), - // ConnectionState: to.Ptr(armdevcenter.CatalogConnectionStateConnected), - // LastSyncStats: &armdevcenter.SyncStats{ - // Added: to.Ptr[int32](0), - // Removed: to.Ptr[int32](0), - // SynchronizationErrors: to.Ptr[int32](0), - // Unchanged: to.Ptr[int32](0), - // Updated: to.Ptr[int32](0), - // ValidationErrors: to.Ptr[int32](0), - // }, - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // SyncState: to.Ptr(armdevcenter.CatalogSyncStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Catalogs_CreateGitHub.json -func ExampleCatalogsClient_BeginCreateOrUpdate_catalogsCreateOrUpdateGitHub() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCatalogsClient().BeginCreateOrUpdate(ctx, "rg1", "Contoso", "CentralCatalog", armdevcenter.Catalog{ - Properties: &armdevcenter.CatalogProperties{ - GitHub: &armdevcenter.GitCatalog{ - Path: to.Ptr("/templates"), - Branch: to.Ptr("main"), - SecretIdentifier: to.Ptr("https://contosokv.vault.azure.net/secrets/CentralRepoPat"), - URI: to.Ptr("https://github.com/Contoso/centralrepo-fake.git"), - }, - SyncType: to.Ptr(armdevcenter.CatalogSyncTypeManual), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Catalog = armdevcenter.Catalog{ - // Name: to.Ptr("CentralCatalog"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters/catalogs"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso/catalogs/CentralCatalog"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // CreatedBy: to.Ptr("User1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // LastModifiedBy: to.Ptr("User1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.CatalogProperties{ - // GitHub: &armdevcenter.GitCatalog{ - // Path: to.Ptr("/templates"), - // Branch: to.Ptr("main"), - // SecretIdentifier: to.Ptr("https://contosokv.vault.azure.net/secrets/CentralRepoPat"), - // URI: to.Ptr("https://github.com/Contoso/centralrepo-fake.git"), - // }, - // SyncType: to.Ptr(armdevcenter.CatalogSyncTypeManual), - // ConnectionState: to.Ptr(armdevcenter.CatalogConnectionStateConnected), - // LastSyncStats: &armdevcenter.SyncStats{ - // Added: to.Ptr[int32](0), - // Removed: to.Ptr[int32](0), - // SynchronizationErrors: to.Ptr[int32](0), - // Unchanged: to.Ptr[int32](0), - // Updated: to.Ptr[int32](0), - // ValidationErrors: to.Ptr[int32](0), - // }, - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // SyncState: to.Ptr(armdevcenter.CatalogSyncStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Catalogs_Patch.json -func ExampleCatalogsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCatalogsClient().BeginUpdate(ctx, "rg1", "Contoso", "CentralCatalog", armdevcenter.CatalogUpdate{ - Properties: &armdevcenter.CatalogUpdateProperties{ - GitHub: &armdevcenter.GitCatalog{ - Path: to.Ptr("/environments"), - }, - SyncType: to.Ptr(armdevcenter.CatalogSyncTypeScheduled), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Catalog = armdevcenter.Catalog{ - // Name: to.Ptr("CentralCatalog"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters/catalogs"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso/catalogs/CentralCatalog"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // CreatedBy: to.Ptr("User1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // LastModifiedBy: to.Ptr("User1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.CatalogProperties{ - // GitHub: &armdevcenter.GitCatalog{ - // Path: to.Ptr("/environments"), - // Branch: to.Ptr("main"), - // SecretIdentifier: to.Ptr("https://contosokv.vault.azure.net/secrets/CentralRepoPat"), - // URI: to.Ptr("https://github.com/Contoso/centralrepo-fake.git"), - // }, - // SyncType: to.Ptr(armdevcenter.CatalogSyncTypeScheduled), - // ConnectionState: to.Ptr(armdevcenter.CatalogConnectionStateConnected), - // LastConnectionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:28:00.314Z"); return t}()), - // LastSyncStats: &armdevcenter.SyncStats{ - // Added: to.Ptr[int32](1), - // Removed: to.Ptr[int32](1), - // SynchronizationErrors: to.Ptr[int32](1), - // Unchanged: to.Ptr[int32](1), - // Updated: to.Ptr[int32](1), - // ValidationErrors: to.Ptr[int32](1), - // }, - // LastSyncTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:28:00.314Z"); return t}()), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // SyncState: to.Ptr(armdevcenter.CatalogSyncStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Catalogs_Delete.json -func ExampleCatalogsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCatalogsClient().BeginDelete(ctx, "rg1", "Contoso", "CentralCatalog", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Catalogs_GetSyncErrorDetails.json -func ExampleCatalogsClient_GetSyncErrorDetails() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCatalogsClient().GetSyncErrorDetails(ctx, "rg1", "Contoso", "CentralCatalog", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SyncErrorDetails = armdevcenter.SyncErrorDetails{ - // Conflicts: []*armdevcenter.CatalogConflictError{ - // { - // Name: to.Ptr("DuplicateEnvironmentName"), - // Path: to.Ptr("/Environments/Duplicate/manifest.yaml"), - // }}, - // Errors: []*armdevcenter.CatalogSyncError{ - // { - // Path: to.Ptr("/Environments/Invalid/manifest.yaml"), - // ErrorDetails: []*armdevcenter.CatalogErrorDetails{ - // { - // Code: to.Ptr("ParseError"), - // Message: to.Ptr("Schema Error Within Catalog Item: Missing Name"), - // }}, - // }}, - // OperationError: &armdevcenter.CatalogErrorDetails{ - // Code: to.Ptr("Conflict"), - // Message: to.Ptr("The source control credentials could not be validated successfully."), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Catalogs_Sync.json -func ExampleCatalogsClient_BeginSync() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCatalogsClient().BeginSync(ctx, "rg1", "Contoso", "CentralCatalog", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Catalogs_Connect.json -func ExampleCatalogsClient_BeginConnect() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCatalogsClient().BeginConnect(ctx, "rg1", "Contoso", "CentralCatalog", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/checknameavailability_client.go b/sdk/resourcemanager/devcenter/armdevcenter/checknameavailability_client.go index c9b03782eba0..50ffeed8cf92 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/checknameavailability_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/checknameavailability_client.go @@ -46,7 +46,7 @@ func NewCheckNameAvailabilityClient(subscriptionID string, credential azcore.Tok // Execute - Check the availability of name for resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - nameAvailabilityRequest - The required parameters for checking if resource name is available. // - options - CheckNameAvailabilityClientExecuteOptions contains the optional parameters for the CheckNameAvailabilityClient.Execute // method. @@ -84,7 +84,7 @@ func (client *CheckNameAvailabilityClient) executeCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, nameAvailabilityRequest); err != nil { diff --git a/sdk/resourcemanager/devcenter/armdevcenter/checknameavailability_client_example_test.go b/sdk/resourcemanager/devcenter/armdevcenter/checknameavailability_client_example_test.go deleted file mode 100644 index 019ebdcbcac7..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/checknameavailability_client_example_test.go +++ /dev/null @@ -1,45 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdevcenter_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/CheckNameAvailability.json -func ExampleCheckNameAvailabilityClient_Execute() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCheckNameAvailabilityClient().Execute(ctx, armdevcenter.CheckNameAvailabilityRequest{ - Name: to.Ptr("name1"), - Type: to.Ptr("Microsoft.DevCenter/devcenters"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CheckNameAvailabilityResponse = armdevcenter.CheckNameAvailabilityResponse{ - // NameAvailable: to.Ptr(true), - // } -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/checkscopednameavailability_client.go b/sdk/resourcemanager/devcenter/armdevcenter/checkscopednameavailability_client.go index 61143cf9d3cf..ee69e7a93a2f 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/checkscopednameavailability_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/checkscopednameavailability_client.go @@ -46,7 +46,7 @@ func NewCheckScopedNameAvailabilityClient(subscriptionID string, credential azco // Execute - Check the availability of name for resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - nameAvailabilityRequest - The required parameters for checking if resource name is available. // - options - CheckScopedNameAvailabilityClientExecuteOptions contains the optional parameters for the CheckScopedNameAvailabilityClient.Execute // method. @@ -84,7 +84,7 @@ func (client *CheckScopedNameAvailabilityClient) executeCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, nameAvailabilityRequest); err != nil { diff --git a/sdk/resourcemanager/devcenter/armdevcenter/checkscopednameavailability_client_example_test.go b/sdk/resourcemanager/devcenter/armdevcenter/checkscopednameavailability_client_example_test.go deleted file mode 100644 index d39d7f2572a4..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/checkscopednameavailability_client_example_test.go +++ /dev/null @@ -1,73 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdevcenter_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/CheckScopedNameAvailability_DevCenterCatalog.json -func ExampleCheckScopedNameAvailabilityClient_Execute_devcenterCatalogNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCheckScopedNameAvailabilityClient().Execute(ctx, armdevcenter.CheckScopedNameAvailabilityRequest{ - Name: to.Ptr("name1"), - Type: to.Ptr("Microsoft.DevCenter/devcenters/catalogs"), - Scope: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CheckNameAvailabilityResponse = armdevcenter.CheckNameAvailabilityResponse{ - // NameAvailable: to.Ptr(true), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/CheckScopedNameAvailability_ProjectCatalog.json -func ExampleCheckScopedNameAvailabilityClient_Execute_projectCatalogNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCheckScopedNameAvailabilityClient().Execute(ctx, armdevcenter.CheckScopedNameAvailabilityRequest{ - Name: to.Ptr("name1"), - Type: to.Ptr("Microsoft.DevCenter/projects/catalogs"), - Scope: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/DevProject"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CheckNameAvailabilityResponse = armdevcenter.CheckNameAvailabilityResponse{ - // NameAvailable: to.Ptr(true), - // } -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/client_factory.go b/sdk/resourcemanager/devcenter/armdevcenter/client_factory.go index 5e37ed4ef905..62a643e6e56f 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/client_factory.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/client_factory.go @@ -68,6 +68,22 @@ func (c *ClientFactory) NewCheckScopedNameAvailabilityClient() *CheckScopedNameA } } +// NewCurationProfilesClient creates a new instance of CurationProfilesClient. +func (c *ClientFactory) NewCurationProfilesClient() *CurationProfilesClient { + return &CurationProfilesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewCustomizationTasksClient creates a new instance of CustomizationTasksClient. +func (c *ClientFactory) NewCustomizationTasksClient() *CustomizationTasksClient { + return &CustomizationTasksClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewDevBoxDefinitionsClient creates a new instance of DevBoxDefinitionsClient. func (c *ClientFactory) NewDevBoxDefinitionsClient() *DevBoxDefinitionsClient { return &DevBoxDefinitionsClient{ @@ -84,6 +100,14 @@ func (c *ClientFactory) NewDevCentersClient() *DevCentersClient { } } +// NewEncryptionSetsClient creates a new instance of EncryptionSetsClient. +func (c *ClientFactory) NewEncryptionSetsClient() *EncryptionSetsClient { + return &EncryptionSetsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewEnvironmentDefinitionsClient creates a new instance of EnvironmentDefinitionsClient. func (c *ClientFactory) NewEnvironmentDefinitionsClient() *EnvironmentDefinitionsClient { return &EnvironmentDefinitionsClient{ @@ -147,6 +171,22 @@ func (c *ClientFactory) NewOperationsClient() *OperationsClient { } } +// NewPlanMembersClient creates a new instance of PlanMembersClient. +func (c *ClientFactory) NewPlanMembersClient() *PlanMembersClient { + return &PlanMembersClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewPlansClient creates a new instance of PlansClient. +func (c *ClientFactory) NewPlansClient() *PlansClient { + return &PlansClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewPoolsClient creates a new instance of PoolsClient. func (c *ClientFactory) NewPoolsClient() *PoolsClient { return &PoolsClient{ @@ -171,6 +211,30 @@ func (c *ClientFactory) NewProjectCatalogEnvironmentDefinitionsClient() *Project } } +// NewProjectCatalogImageDefinitionBuildClient creates a new instance of ProjectCatalogImageDefinitionBuildClient. +func (c *ClientFactory) NewProjectCatalogImageDefinitionBuildClient() *ProjectCatalogImageDefinitionBuildClient { + return &ProjectCatalogImageDefinitionBuildClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewProjectCatalogImageDefinitionBuildsClient creates a new instance of ProjectCatalogImageDefinitionBuildsClient. +func (c *ClientFactory) NewProjectCatalogImageDefinitionBuildsClient() *ProjectCatalogImageDefinitionBuildsClient { + return &ProjectCatalogImageDefinitionBuildsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewProjectCatalogImageDefinitionsClient creates a new instance of ProjectCatalogImageDefinitionsClient. +func (c *ClientFactory) NewProjectCatalogImageDefinitionsClient() *ProjectCatalogImageDefinitionsClient { + return &ProjectCatalogImageDefinitionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewProjectCatalogsClient creates a new instance of ProjectCatalogsClient. func (c *ClientFactory) NewProjectCatalogsClient() *ProjectCatalogsClient { return &ProjectCatalogsClient{ @@ -187,6 +251,14 @@ func (c *ClientFactory) NewProjectEnvironmentTypesClient() *ProjectEnvironmentTy } } +// NewProjectPoliciesClient creates a new instance of ProjectPoliciesClient. +func (c *ClientFactory) NewProjectPoliciesClient() *ProjectPoliciesClient { + return &ProjectPoliciesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewProjectsClient creates a new instance of ProjectsClient. func (c *ClientFactory) NewProjectsClient() *ProjectsClient { return &ProjectsClient{ diff --git a/sdk/resourcemanager/devcenter/armdevcenter/constants.go b/sdk/resourcemanager/devcenter/armdevcenter/constants.go index d83305514a12..c218cfc20034 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/constants.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/constants.go @@ -10,7 +10,7 @@ package armdevcenter const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter" - moduleVersion = "v2.0.0" + moduleVersion = "v2.1.0-beta.1" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -65,12 +65,14 @@ type CatalogItemType string const ( CatalogItemTypeEnvironmentDefinition CatalogItemType = "EnvironmentDefinition" + CatalogItemTypeImageDefinition CatalogItemType = "ImageDefinition" ) // PossibleCatalogItemTypeValues returns the possible values for the CatalogItemType const type. func PossibleCatalogItemTypeValues() []CatalogItemType { return []CatalogItemType{ CatalogItemTypeEnvironmentDefinition, + CatalogItemTypeImageDefinition, } } @@ -166,12 +168,66 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } +// CustomizationTaskInputType - Type of the input. +type CustomizationTaskInputType string + +const ( + CustomizationTaskInputTypeBoolean CustomizationTaskInputType = "boolean" + CustomizationTaskInputTypeNumber CustomizationTaskInputType = "number" + CustomizationTaskInputTypeString CustomizationTaskInputType = "string" +) + +// PossibleCustomizationTaskInputTypeValues returns the possible values for the CustomizationTaskInputType const type. +func PossibleCustomizationTaskInputTypeValues() []CustomizationTaskInputType { + return []CustomizationTaskInputType{ + CustomizationTaskInputTypeBoolean, + CustomizationTaskInputTypeNumber, + CustomizationTaskInputTypeString, + } +} + +// DevCenterResourceType - Indicates dev center resource types. +type DevCenterResourceType string + +const ( + DevCenterResourceTypeAttachedNetworks DevCenterResourceType = "AttachedNetworks" + DevCenterResourceTypeImages DevCenterResourceType = "Images" + DevCenterResourceTypeSKUs DevCenterResourceType = "Skus" +) + +// PossibleDevCenterResourceTypeValues returns the possible values for the DevCenterResourceType const type. +func PossibleDevCenterResourceTypeValues() []DevCenterResourceType { + return []DevCenterResourceType{ + DevCenterResourceTypeAttachedNetworks, + DevCenterResourceTypeImages, + DevCenterResourceTypeSKUs, + } +} + +// DevboxDisksEncryptionEnableStatus - Devbox disk encryption enable or disable status. Indicates if Devbox disks encryption +// is enabled or not. +type DevboxDisksEncryptionEnableStatus string + +const ( + DevboxDisksEncryptionEnableStatusDisabled DevboxDisksEncryptionEnableStatus = "Disabled" + DevboxDisksEncryptionEnableStatusEnabled DevboxDisksEncryptionEnableStatus = "Enabled" +) + +// PossibleDevboxDisksEncryptionEnableStatusValues returns the possible values for the DevboxDisksEncryptionEnableStatus const type. +func PossibleDevboxDisksEncryptionEnableStatusValues() []DevboxDisksEncryptionEnableStatus { + return []DevboxDisksEncryptionEnableStatus{ + DevboxDisksEncryptionEnableStatusDisabled, + DevboxDisksEncryptionEnableStatusEnabled, + } +} + // DomainJoinType - Active Directory join type type DomainJoinType string const ( DomainJoinTypeAzureADJoin DomainJoinType = "AzureADJoin" DomainJoinTypeHybridAzureADJoin DomainJoinType = "HybridAzureADJoin" + DomainJoinTypeNone DomainJoinType = "None" ) // PossibleDomainJoinTypeValues returns the possible values for the DomainJoinType const type. @@ -179,6 +235,7 @@ func PossibleDomainJoinTypeValues() []DomainJoinType { return []DomainJoinType{ DomainJoinTypeAzureADJoin, DomainJoinTypeHybridAzureADJoin, + DomainJoinTypeNone, } } @@ -278,6 +335,36 @@ func PossibleIdentityTypeValues() []IdentityType { } } +// ImageDefinitionBuildStatus - The state of an Image Definition Build. +type ImageDefinitionBuildStatus string + +const ( + // ImageDefinitionBuildStatusCancelled - The image build has been cancelled. + ImageDefinitionBuildStatusCancelled ImageDefinitionBuildStatus = "Cancelled" + // ImageDefinitionBuildStatusFailed - The image build has failed. + ImageDefinitionBuildStatusFailed ImageDefinitionBuildStatus = "Failed" + // ImageDefinitionBuildStatusRunning - The image build is running. + ImageDefinitionBuildStatusRunning ImageDefinitionBuildStatus = "Running" + // ImageDefinitionBuildStatusSucceeded - The image build has succeeded. + ImageDefinitionBuildStatusSucceeded ImageDefinitionBuildStatus = "Succeeded" + // ImageDefinitionBuildStatusTimedOut - The image build has timed out. + ImageDefinitionBuildStatusTimedOut ImageDefinitionBuildStatus = "TimedOut" + // ImageDefinitionBuildStatusValidationFailed - The built image has failed validation. + ImageDefinitionBuildStatusValidationFailed ImageDefinitionBuildStatus = "ValidationFailed" +) + +// PossibleImageDefinitionBuildStatusValues returns the possible values for the ImageDefinitionBuildStatus const type. +func PossibleImageDefinitionBuildStatusValues() []ImageDefinitionBuildStatus { + return []ImageDefinitionBuildStatus{ + ImageDefinitionBuildStatusCancelled, + ImageDefinitionBuildStatusFailed, + ImageDefinitionBuildStatusRunning, + ImageDefinitionBuildStatusSucceeded, + ImageDefinitionBuildStatusTimedOut, + ImageDefinitionBuildStatusValidationFailed, + } +} + // ImageValidationStatus - Image validation status type ImageValidationStatus string @@ -300,6 +387,23 @@ func PossibleImageValidationStatusValues() []ImageValidationStatus { } } +// InstallAzureMonitorAgentEnableStatus - Setting to be used when determining whether to install the Azure Monitor Agent service +// on Dev Boxes that belong to this dev center. +type InstallAzureMonitorAgentEnableStatus string + +const ( + InstallAzureMonitorAgentEnableStatusDisabled InstallAzureMonitorAgentEnableStatus = "Disabled" + InstallAzureMonitorAgentEnableStatusEnabled InstallAzureMonitorAgentEnableStatus = "Enabled" +) + +// PossibleInstallAzureMonitorAgentEnableStatusValues returns the possible values for the InstallAzureMonitorAgentEnableStatus const type. +func PossibleInstallAzureMonitorAgentEnableStatusValues() []InstallAzureMonitorAgentEnableStatus { + return []InstallAzureMonitorAgentEnableStatus{ + InstallAzureMonitorAgentEnableStatusDisabled, + InstallAzureMonitorAgentEnableStatusEnabled, + } +} + // LicenseType - License Types type LicenseType string @@ -351,6 +455,23 @@ func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { } } +// MicrosoftHostedNetworkEnableStatus - Indicates whether pools in this Dev Center can use Microsoft Hosted Networks. Defaults +// to Enabled if not set. +type MicrosoftHostedNetworkEnableStatus string + +const ( + MicrosoftHostedNetworkEnableStatusDisabled MicrosoftHostedNetworkEnableStatus = "Disabled" + MicrosoftHostedNetworkEnableStatusEnabled MicrosoftHostedNetworkEnableStatus = "Enabled" +) + +// PossibleMicrosoftHostedNetworkEnableStatusValues returns the possible values for the MicrosoftHostedNetworkEnableStatus const type. +func PossibleMicrosoftHostedNetworkEnableStatusValues() []MicrosoftHostedNetworkEnableStatus { + return []MicrosoftHostedNetworkEnableStatus{ + MicrosoftHostedNetworkEnableStatusDisabled, + MicrosoftHostedNetworkEnableStatusEnabled, + } +} + // Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default // value is "user,system" type Origin string @@ -400,6 +521,60 @@ func PossibleParameterTypeValues() []ParameterType { } } +// PlanMemberSyncState - The synchronization state of the plan member. +type PlanMemberSyncState string + +const ( + PlanMemberSyncStateCanceled PlanMemberSyncState = "Canceled" + PlanMemberSyncStateFailed PlanMemberSyncState = "Failed" + PlanMemberSyncStateInProgress PlanMemberSyncState = "InProgress" + PlanMemberSyncStateNotStarted PlanMemberSyncState = "NotStarted" + PlanMemberSyncStateSucceeded PlanMemberSyncState = "Succeeded" +) + +// PossiblePlanMemberSyncStateValues returns the possible values for the PlanMemberSyncState const type. +func PossiblePlanMemberSyncStateValues() []PlanMemberSyncState { + return []PlanMemberSyncState{ + PlanMemberSyncStateCanceled, + PlanMemberSyncStateFailed, + PlanMemberSyncStateInProgress, + PlanMemberSyncStateNotStarted, + PlanMemberSyncStateSucceeded, + } +} + +// PlanMemberType - The type of the member (user, group) +type PlanMemberType string + +const ( + PlanMemberTypeGroup PlanMemberType = "Group" + PlanMemberTypeUser PlanMemberType = "User" +) + +// PossiblePlanMemberTypeValues returns the possible values for the PlanMemberType const type. +func PossiblePlanMemberTypeValues() []PlanMemberType { + return []PlanMemberType{ + PlanMemberTypeGroup, + PlanMemberTypeUser, + } +} + +// PoolDevBoxDefinitionType - Indicates if the pool is created from an existing Dev Box Definition or if one is provided directly. +type PoolDevBoxDefinitionType string + +const ( + PoolDevBoxDefinitionTypeReference PoolDevBoxDefinitionType = "Reference" + PoolDevBoxDefinitionTypeValue PoolDevBoxDefinitionType = "Value" +) + +// PossiblePoolDevBoxDefinitionTypeValues returns the possible values for the PoolDevBoxDefinitionType const type. +func PossiblePoolDevBoxDefinitionTypeValues() []PoolDevBoxDefinitionType { + return []PoolDevBoxDefinitionType{ + PoolDevBoxDefinitionTypeReference, + PoolDevBoxDefinitionTypeValue, + } +} + // ProvisioningState - Provisioning state of the resource. type ProvisioningState string @@ -544,6 +719,22 @@ func PossibleStopOnDisconnectEnableStatusValues() []StopOnDisconnectEnableStatus } } +// StopOnNoConnectEnableStatus - Stop on no connect enable or disable status. +type StopOnNoConnectEnableStatus string + +const ( + StopOnNoConnectEnableStatusDisabled StopOnNoConnectEnableStatus = "Disabled" + StopOnNoConnectEnableStatusEnabled StopOnNoConnectEnableStatus = "Enabled" +) + +// PossibleStopOnNoConnectEnableStatusValues returns the possible values for the StopOnNoConnectEnableStatus const type. +func PossibleStopOnNoConnectEnableStatusValues() []StopOnNoConnectEnableStatus { + return []StopOnNoConnectEnableStatus{ + StopOnNoConnectEnableStatusDisabled, + StopOnNoConnectEnableStatusEnabled, + } +} + // UsageUnit - The unit details. type UsageUnit string diff --git a/sdk/resourcemanager/devcenter/armdevcenter/curationprofiles_client.go b/sdk/resourcemanager/devcenter/armdevcenter/curationprofiles_client.go new file mode 100644 index 000000000000..266c47232ece --- /dev/null +++ b/sdk/resourcemanager/devcenter/armdevcenter/curationprofiles_client.go @@ -0,0 +1,436 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdevcenter + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// CurationProfilesClient contains the methods for the CurationProfiles group. +// Don't use this type directly, use NewCurationProfilesClient() instead. +type CurationProfilesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewCurationProfilesClient creates a new instance of CurationProfilesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewCurationProfilesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CurationProfilesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CurationProfilesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates an curation profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - devCenterName - The name of the devcenter. +// - curationProfileName - The name of the curation profile. +// - body - Represents an curation profile. +// - options - CurationProfilesClientBeginCreateOrUpdateOptions contains the optional parameters for the CurationProfilesClient.BeginCreateOrUpdate +// method. +func (client *CurationProfilesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, devCenterName string, curationProfileName string, body CurationProfile, options *CurationProfilesClientBeginCreateOrUpdateOptions) (*runtime.Poller[CurationProfilesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, devCenterName, curationProfileName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CurationProfilesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CurationProfilesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates or updates an curation profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +func (client *CurationProfilesClient) createOrUpdate(ctx context.Context, resourceGroupName string, devCenterName string, curationProfileName string, body CurationProfile, options *CurationProfilesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "CurationProfilesClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, devCenterName, curationProfileName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *CurationProfilesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, devCenterName string, curationProfileName string, body CurationProfile, options *CurationProfilesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}/curationProfiles/{curationProfileName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if devCenterName == "" { + return nil, errors.New("parameter devCenterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{devCenterName}", url.PathEscape(devCenterName)) + if curationProfileName == "" { + return nil, errors.New("parameter curationProfileName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{curationProfileName}", url.PathEscape(curationProfileName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes an curation profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - devCenterName - The name of the devcenter. +// - curationProfileName - The name of the curation profile. +// - options - CurationProfilesClientBeginDeleteOptions contains the optional parameters for the CurationProfilesClient.BeginDelete +// method. +func (client *CurationProfilesClient) BeginDelete(ctx context.Context, resourceGroupName string, devCenterName string, curationProfileName string, options *CurationProfilesClientBeginDeleteOptions) (*runtime.Poller[CurationProfilesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, devCenterName, curationProfileName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CurationProfilesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CurationProfilesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes an curation profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +func (client *CurationProfilesClient) deleteOperation(ctx context.Context, resourceGroupName string, devCenterName string, curationProfileName string, options *CurationProfilesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "CurationProfilesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, devCenterName, curationProfileName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *CurationProfilesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, devCenterName string, curationProfileName string, options *CurationProfilesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}/curationProfiles/{curationProfileName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if devCenterName == "" { + return nil, errors.New("parameter devCenterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{devCenterName}", url.PathEscape(devCenterName)) + if curationProfileName == "" { + return nil, errors.New("parameter curationProfileName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{curationProfileName}", url.PathEscape(curationProfileName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a specific curation profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - devCenterName - The name of the devcenter. +// - curationProfileName - The name of the curation profile. +// - options - CurationProfilesClientGetOptions contains the optional parameters for the CurationProfilesClient.Get method. +func (client *CurationProfilesClient) Get(ctx context.Context, resourceGroupName string, devCenterName string, curationProfileName string, options *CurationProfilesClientGetOptions) (CurationProfilesClientGetResponse, error) { + var err error + const operationName = "CurationProfilesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, devCenterName, curationProfileName, options) + if err != nil { + return CurationProfilesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CurationProfilesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CurationProfilesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *CurationProfilesClient) getCreateRequest(ctx context.Context, resourceGroupName string, devCenterName string, curationProfileName string, options *CurationProfilesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}/curationProfiles/{curationProfileName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if devCenterName == "" { + return nil, errors.New("parameter devCenterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{devCenterName}", url.PathEscape(devCenterName)) + if curationProfileName == "" { + return nil, errors.New("parameter curationProfileName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{curationProfileName}", url.PathEscape(curationProfileName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CurationProfilesClient) getHandleResponse(resp *http.Response) (CurationProfilesClientGetResponse, error) { + result := CurationProfilesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CurationProfile); err != nil { + return CurationProfilesClientGetResponse{}, err + } + return result, nil +} + +// NewListByDevCenterPager - Lists all curation profiles in the dev center +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - devCenterName - The name of the devcenter. +// - options - CurationProfilesClientListByDevCenterOptions contains the optional parameters for the CurationProfilesClient.NewListByDevCenterPager +// method. +func (client *CurationProfilesClient) NewListByDevCenterPager(resourceGroupName string, devCenterName string, options *CurationProfilesClientListByDevCenterOptions) *runtime.Pager[CurationProfilesClientListByDevCenterResponse] { + return runtime.NewPager(runtime.PagingHandler[CurationProfilesClientListByDevCenterResponse]{ + More: func(page CurationProfilesClientListByDevCenterResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CurationProfilesClientListByDevCenterResponse) (CurationProfilesClientListByDevCenterResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CurationProfilesClient.NewListByDevCenterPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByDevCenterCreateRequest(ctx, resourceGroupName, devCenterName, options) + }, nil) + if err != nil { + return CurationProfilesClientListByDevCenterResponse{}, err + } + return client.listByDevCenterHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByDevCenterCreateRequest creates the ListByDevCenter request. +func (client *CurationProfilesClient) listByDevCenterCreateRequest(ctx context.Context, resourceGroupName string, devCenterName string, options *CurationProfilesClientListByDevCenterOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}/curationProfiles" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if devCenterName == "" { + return nil, errors.New("parameter devCenterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{devCenterName}", url.PathEscape(devCenterName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByDevCenterHandleResponse handles the ListByDevCenter response. +func (client *CurationProfilesClient) listByDevCenterHandleResponse(resp *http.Response) (CurationProfilesClientListByDevCenterResponse, error) { + result := CurationProfilesClientListByDevCenterResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CurationProfileListResult); err != nil { + return CurationProfilesClientListByDevCenterResponse{}, err + } + return result, nil +} + +// BeginUpdate - Partially updates an curation profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - devCenterName - The name of the devcenter. +// - curationProfileName - The name of the curation profile. +// - body - Updatable curation profile properties. +// - options - CurationProfilesClientBeginUpdateOptions contains the optional parameters for the CurationProfilesClient.BeginUpdate +// method. +func (client *CurationProfilesClient) BeginUpdate(ctx context.Context, resourceGroupName string, devCenterName string, curationProfileName string, body CurationProfileUpdate, options *CurationProfilesClientBeginUpdateOptions) (*runtime.Poller[CurationProfilesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, devCenterName, curationProfileName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CurationProfilesClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CurationProfilesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Partially updates an curation profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +func (client *CurationProfilesClient) update(ctx context.Context, resourceGroupName string, devCenterName string, curationProfileName string, body CurationProfileUpdate, options *CurationProfilesClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "CurationProfilesClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, devCenterName, curationProfileName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *CurationProfilesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, devCenterName string, curationProfileName string, body CurationProfileUpdate, options *CurationProfilesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}/curationProfiles/{curationProfileName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if devCenterName == "" { + return nil, errors.New("parameter devCenterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{devCenterName}", url.PathEscape(devCenterName)) + if curationProfileName == "" { + return nil, errors.New("parameter curationProfileName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{curationProfileName}", url.PathEscape(curationProfileName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/customizationtasks_client.go b/sdk/resourcemanager/devcenter/armdevcenter/customizationtasks_client.go new file mode 100644 index 000000000000..612ce2eb786a --- /dev/null +++ b/sdk/resourcemanager/devcenter/armdevcenter/customizationtasks_client.go @@ -0,0 +1,267 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdevcenter + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// CustomizationTasksClient contains the methods for the CustomizationTasks group. +// Don't use this type directly, use NewCustomizationTasksClient() instead. +type CustomizationTasksClient struct { + internal *arm.Client + subscriptionID string +} + +// NewCustomizationTasksClient creates a new instance of CustomizationTasksClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewCustomizationTasksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CustomizationTasksClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CustomizationTasksClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets a Task from the catalog +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - devCenterName - The name of the devcenter. +// - catalogName - The name of the Catalog. +// - taskName - The name of the Task. +// - options - CustomizationTasksClientGetOptions contains the optional parameters for the CustomizationTasksClient.Get method. +func (client *CustomizationTasksClient) Get(ctx context.Context, resourceGroupName string, devCenterName string, catalogName string, taskName string, options *CustomizationTasksClientGetOptions) (CustomizationTasksClientGetResponse, error) { + var err error + const operationName = "CustomizationTasksClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, devCenterName, catalogName, taskName, options) + if err != nil { + return CustomizationTasksClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CustomizationTasksClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CustomizationTasksClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *CustomizationTasksClient) getCreateRequest(ctx context.Context, resourceGroupName string, devCenterName string, catalogName string, taskName string, options *CustomizationTasksClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}/catalogs/{catalogName}/tasks/{taskName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if devCenterName == "" { + return nil, errors.New("parameter devCenterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{devCenterName}", url.PathEscape(devCenterName)) + if catalogName == "" { + return nil, errors.New("parameter catalogName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{catalogName}", url.PathEscape(catalogName)) + if taskName == "" { + return nil, errors.New("parameter taskName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{taskName}", url.PathEscape(taskName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CustomizationTasksClient) getHandleResponse(resp *http.Response) (CustomizationTasksClientGetResponse, error) { + result := CustomizationTasksClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CustomizationTask); err != nil { + return CustomizationTasksClientGetResponse{}, err + } + return result, nil +} + +// GetErrorDetails - Gets Customization Task error details +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - devCenterName - The name of the devcenter. +// - catalogName - The name of the Catalog. +// - taskName - The name of the Task. +// - options - CustomizationTasksClientGetErrorDetailsOptions contains the optional parameters for the CustomizationTasksClient.GetErrorDetails +// method. +func (client *CustomizationTasksClient) GetErrorDetails(ctx context.Context, resourceGroupName string, devCenterName string, catalogName string, taskName string, options *CustomizationTasksClientGetErrorDetailsOptions) (CustomizationTasksClientGetErrorDetailsResponse, error) { + var err error + const operationName = "CustomizationTasksClient.GetErrorDetails" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getErrorDetailsCreateRequest(ctx, resourceGroupName, devCenterName, catalogName, taskName, options) + if err != nil { + return CustomizationTasksClientGetErrorDetailsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CustomizationTasksClientGetErrorDetailsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CustomizationTasksClientGetErrorDetailsResponse{}, err + } + resp, err := client.getErrorDetailsHandleResponse(httpResp) + return resp, err +} + +// getErrorDetailsCreateRequest creates the GetErrorDetails request. +func (client *CustomizationTasksClient) getErrorDetailsCreateRequest(ctx context.Context, resourceGroupName string, devCenterName string, catalogName string, taskName string, options *CustomizationTasksClientGetErrorDetailsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}/catalogs/{catalogName}/tasks/{taskName}/getErrorDetails" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if devCenterName == "" { + return nil, errors.New("parameter devCenterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{devCenterName}", url.PathEscape(devCenterName)) + if catalogName == "" { + return nil, errors.New("parameter catalogName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{catalogName}", url.PathEscape(catalogName)) + if taskName == "" { + return nil, errors.New("parameter taskName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{taskName}", url.PathEscape(taskName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getErrorDetailsHandleResponse handles the GetErrorDetails response. +func (client *CustomizationTasksClient) getErrorDetailsHandleResponse(resp *http.Response) (CustomizationTasksClientGetErrorDetailsResponse, error) { + result := CustomizationTasksClientGetErrorDetailsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CatalogResourceValidationErrorDetails); err != nil { + return CustomizationTasksClientGetErrorDetailsResponse{}, err + } + return result, nil +} + +// NewListByCatalogPager - List Tasks in the catalog. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - devCenterName - The name of the devcenter. +// - catalogName - The name of the Catalog. +// - options - CustomizationTasksClientListByCatalogOptions contains the optional parameters for the CustomizationTasksClient.NewListByCatalogPager +// method. +func (client *CustomizationTasksClient) NewListByCatalogPager(resourceGroupName string, devCenterName string, catalogName string, options *CustomizationTasksClientListByCatalogOptions) *runtime.Pager[CustomizationTasksClientListByCatalogResponse] { + return runtime.NewPager(runtime.PagingHandler[CustomizationTasksClientListByCatalogResponse]{ + More: func(page CustomizationTasksClientListByCatalogResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CustomizationTasksClientListByCatalogResponse) (CustomizationTasksClientListByCatalogResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CustomizationTasksClient.NewListByCatalogPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByCatalogCreateRequest(ctx, resourceGroupName, devCenterName, catalogName, options) + }, nil) + if err != nil { + return CustomizationTasksClientListByCatalogResponse{}, err + } + return client.listByCatalogHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByCatalogCreateRequest creates the ListByCatalog request. +func (client *CustomizationTasksClient) listByCatalogCreateRequest(ctx context.Context, resourceGroupName string, devCenterName string, catalogName string, options *CustomizationTasksClientListByCatalogOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}/catalogs/{catalogName}/tasks" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if devCenterName == "" { + return nil, errors.New("parameter devCenterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{devCenterName}", url.PathEscape(devCenterName)) + if catalogName == "" { + return nil, errors.New("parameter catalogName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{catalogName}", url.PathEscape(catalogName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByCatalogHandleResponse handles the ListByCatalog response. +func (client *CustomizationTasksClient) listByCatalogHandleResponse(resp *http.Response) (CustomizationTasksClientListByCatalogResponse, error) { + result := CustomizationTasksClientListByCatalogResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CustomizationTaskListResult); err != nil { + return CustomizationTasksClientListByCatalogResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/devboxdefinitions_client.go b/sdk/resourcemanager/devcenter/armdevcenter/devboxdefinitions_client.go index ca4941337c14..e07d736b6941 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/devboxdefinitions_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/devboxdefinitions_client.go @@ -47,7 +47,7 @@ func NewDevBoxDefinitionsClient(subscriptionID string, credential azcore.TokenCr // BeginCreateOrUpdate - Creates or updates a Dev Box definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - devBoxDefinitionName - The name of the Dev Box definition. @@ -75,7 +75,7 @@ func (client *DevBoxDefinitionsClient) BeginCreateOrUpdate(ctx context.Context, // CreateOrUpdate - Creates or updates a Dev Box definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *DevBoxDefinitionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, devCenterName string, devBoxDefinitionName string, body DevBoxDefinition, options *DevBoxDefinitionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "DevBoxDefinitionsClient.BeginCreateOrUpdate" @@ -121,7 +121,7 @@ func (client *DevBoxDefinitionsClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -133,7 +133,7 @@ func (client *DevBoxDefinitionsClient) createOrUpdateCreateRequest(ctx context.C // BeginDelete - Deletes a Dev Box definition // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - devBoxDefinitionName - The name of the Dev Box definition. @@ -160,7 +160,7 @@ func (client *DevBoxDefinitionsClient) BeginDelete(ctx context.Context, resource // Delete - Deletes a Dev Box definition // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *DevBoxDefinitionsClient) deleteOperation(ctx context.Context, resourceGroupName string, devCenterName string, devBoxDefinitionName string, options *DevBoxDefinitionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "DevBoxDefinitionsClient.BeginDelete" @@ -206,7 +206,7 @@ func (client *DevBoxDefinitionsClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -215,7 +215,7 @@ func (client *DevBoxDefinitionsClient) deleteCreateRequest(ctx context.Context, // Get - Gets a Dev Box definition // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - devBoxDefinitionName - The name of the Dev Box definition. @@ -266,7 +266,7 @@ func (client *DevBoxDefinitionsClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -284,7 +284,7 @@ func (client *DevBoxDefinitionsClient) getHandleResponse(resp *http.Response) (D // GetByProject - Gets a Dev Box definition configured for a project // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - devBoxDefinitionName - The name of the Dev Box definition. @@ -336,7 +336,7 @@ func (client *DevBoxDefinitionsClient) getByProjectCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -353,7 +353,7 @@ func (client *DevBoxDefinitionsClient) getByProjectHandleResponse(resp *http.Res // NewListByDevCenterPager - List Dev Box definitions for a devcenter. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - options - DevBoxDefinitionsClientListByDevCenterOptions contains the optional parameters for the DevBoxDefinitionsClient.NewListByDevCenterPager @@ -404,7 +404,7 @@ func (client *DevBoxDefinitionsClient) listByDevCenterCreateRequest(ctx context. if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -421,7 +421,7 @@ func (client *DevBoxDefinitionsClient) listByDevCenterHandleResponse(resp *http. // NewListByProjectPager - List Dev Box definitions configured for a project. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - options - DevBoxDefinitionsClientListByProjectOptions contains the optional parameters for the DevBoxDefinitionsClient.NewListByProjectPager @@ -472,7 +472,7 @@ func (client *DevBoxDefinitionsClient) listByProjectCreateRequest(ctx context.Co if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -490,7 +490,7 @@ func (client *DevBoxDefinitionsClient) listByProjectHandleResponse(resp *http.Re // BeginUpdate - Partially updates a Dev Box definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - devBoxDefinitionName - The name of the Dev Box definition. @@ -518,7 +518,7 @@ func (client *DevBoxDefinitionsClient) BeginUpdate(ctx context.Context, resource // Update - Partially updates a Dev Box definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *DevBoxDefinitionsClient) update(ctx context.Context, resourceGroupName string, devCenterName string, devBoxDefinitionName string, body DevBoxDefinitionUpdate, options *DevBoxDefinitionsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "DevBoxDefinitionsClient.BeginUpdate" @@ -564,7 +564,7 @@ func (client *DevBoxDefinitionsClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { diff --git a/sdk/resourcemanager/devcenter/armdevcenter/devboxdefinitions_client_example_test.go b/sdk/resourcemanager/devcenter/armdevcenter/devboxdefinitions_client_example_test.go deleted file mode 100644 index 5cd2f08fb4cc..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/devboxdefinitions_client_example_test.go +++ /dev/null @@ -1,345 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdevcenter_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/DevBoxDefinitions_ListByDevCenter.json -func ExampleDevBoxDefinitionsClient_NewListByDevCenterPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDevBoxDefinitionsClient().NewListByDevCenterPager("rg1", "Contoso", &armdevcenter.DevBoxDefinitionsClientListByDevCenterOptions{Top: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DevBoxDefinitionListResult = armdevcenter.DevBoxDefinitionListResult{ - // Value: []*armdevcenter.DevBoxDefinition{ - // { - // Name: to.Ptr("WebDevBox"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters/devboxdefinitions"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso/devboxdefinitions/WebDevBox"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Location: to.Ptr("centralus"), - // Properties: &armdevcenter.DevBoxDefinitionProperties{ - // HibernateSupport: to.Ptr(armdevcenter.HibernateSupportEnabled), - // ImageReference: &armdevcenter.ImageReference{ - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/Example/providers/Microsoft.DevCenter/devcenters/Contoso/galleries/contosogallery/images/exampleImage/version/1.0.0"), - // }, - // SKU: &armdevcenter.SKU{ - // Name: to.Ptr("Preview"), - // }, - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/DevBoxDefinitions_Get.json -func ExampleDevBoxDefinitionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDevBoxDefinitionsClient().Get(ctx, "rg1", "Contoso", "WebDevBox", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DevBoxDefinition = armdevcenter.DevBoxDefinition{ - // Name: to.Ptr("WebDevBox"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters/devboxdefinitions"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso/devboxdefinitions/WebDevBox"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Location: to.Ptr("centralus"), - // Properties: &armdevcenter.DevBoxDefinitionProperties{ - // HibernateSupport: to.Ptr(armdevcenter.HibernateSupportEnabled), - // ImageReference: &armdevcenter.ImageReference{ - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/Example/providers/Microsoft.DevCenter/devcenters/Contoso/galleries/contosogallery/images/exampleImage/version/1.0.0"), - // }, - // SKU: &armdevcenter.SKU{ - // Name: to.Ptr("Preview"), - // }, - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/DevBoxDefinitions_Create.json -func ExampleDevBoxDefinitionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDevBoxDefinitionsClient().BeginCreateOrUpdate(ctx, "rg1", "Contoso", "WebDevBox", armdevcenter.DevBoxDefinition{ - Location: to.Ptr("centralus"), - Properties: &armdevcenter.DevBoxDefinitionProperties{ - HibernateSupport: to.Ptr(armdevcenter.HibernateSupportEnabled), - ImageReference: &armdevcenter.ImageReference{ - ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/Example/providers/Microsoft.DevCenter/devcenters/Contoso/galleries/contosogallery/images/exampleImage/version/1.0.0"), - }, - SKU: &armdevcenter.SKU{ - Name: to.Ptr("Preview"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DevBoxDefinition = armdevcenter.DevBoxDefinition{ - // Name: to.Ptr("WebDevBox"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters/devboxdefinitions"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso/devboxdefinitions/devBoxDefinitionName"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Location: to.Ptr("centralus"), - // Properties: &armdevcenter.DevBoxDefinitionProperties{ - // HibernateSupport: to.Ptr(armdevcenter.HibernateSupportEnabled), - // ImageReference: &armdevcenter.ImageReference{ - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/Example/providers/Microsoft.DevCenter/devcenters/Contoso/galleries/contosogallery/images/exampleImage/version/1.0.0"), - // }, - // SKU: &armdevcenter.SKU{ - // Name: to.Ptr("Preview"), - // }, - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/DevBoxDefinitions_Patch.json -func ExampleDevBoxDefinitionsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDevBoxDefinitionsClient().BeginUpdate(ctx, "rg1", "Contoso", "WebDevBox", armdevcenter.DevBoxDefinitionUpdate{ - Properties: &armdevcenter.DevBoxDefinitionUpdateProperties{ - ImageReference: &armdevcenter.ImageReference{ - ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/Example/providers/Microsoft.DevCenter/devcenters/Contoso/galleries/contosogallery/images/exampleImage/version/2.0.0"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DevBoxDefinition = armdevcenter.DevBoxDefinition{ - // Name: to.Ptr("WebDevBox"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters/devboxdefinitions"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso/devboxdefinitions/WebDevBox"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Location: to.Ptr("centralus"), - // Properties: &armdevcenter.DevBoxDefinitionProperties{ - // HibernateSupport: to.Ptr(armdevcenter.HibernateSupportEnabled), - // ImageReference: &armdevcenter.ImageReference{ - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/Example/providers/Microsoft.DevCenter/devcenters/Contoso/galleries/contosogallery/images/exampleImage/version/2.0.0"), - // }, - // SKU: &armdevcenter.SKU{ - // Name: to.Ptr("Preview"), - // }, - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/DevBoxDefinitions_Delete.json -func ExampleDevBoxDefinitionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDevBoxDefinitionsClient().BeginDelete(ctx, "rg1", "Contoso", "WebDevBox", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/DevBoxDefinitions_ListByProject.json -func ExampleDevBoxDefinitionsClient_NewListByProjectPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDevBoxDefinitionsClient().NewListByProjectPager("rg1", "ContosoProject", &armdevcenter.DevBoxDefinitionsClientListByProjectOptions{Top: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DevBoxDefinitionListResult = armdevcenter.DevBoxDefinitionListResult{ - // Value: []*armdevcenter.DevBoxDefinition{ - // { - // Name: to.Ptr("WebDevBox"), - // Type: to.Ptr("Microsoft.DevCenter/projects/devboxdefinitions"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/ContosoProject/devboxdefinitions/WebDevBox"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Location: to.Ptr("centralus"), - // Properties: &armdevcenter.DevBoxDefinitionProperties{ - // HibernateSupport: to.Ptr(armdevcenter.HibernateSupportEnabled), - // ImageReference: &armdevcenter.ImageReference{ - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/Example/providers/Microsoft.DevCenter/devcenters/Contoso/galleries/contosogallery/images/exampleImage/version/1.0.0"), - // }, - // SKU: &armdevcenter.SKU{ - // Name: to.Ptr("Preview"), - // }, - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/DevBoxDefinitions_GetByProject.json -func ExampleDevBoxDefinitionsClient_GetByProject() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDevBoxDefinitionsClient().GetByProject(ctx, "rg1", "ContosoProject", "WebDevBox", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DevBoxDefinition = armdevcenter.DevBoxDefinition{ - // Name: to.Ptr("WebDevBox"), - // Type: to.Ptr("Microsoft.DevCenter/projects/devboxdefinitions"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/ContosoProject/devboxdefinitions/WebDevBox"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Location: to.Ptr("centralus"), - // Properties: &armdevcenter.DevBoxDefinitionProperties{ - // HibernateSupport: to.Ptr(armdevcenter.HibernateSupportEnabled), - // ImageReference: &armdevcenter.ImageReference{ - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/Example/providers/Microsoft.DevCenter/devcenters/Contoso/galleries/contosogallery/images/exampleImage/version/1.0.0"), - // }, - // SKU: &armdevcenter.SKU{ - // Name: to.Ptr("Preview"), - // }, - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // } -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/devcenters_client.go b/sdk/resourcemanager/devcenter/armdevcenter/devcenters_client.go index 750154738ec4..bc6cce6d3349 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/devcenters_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/devcenters_client.go @@ -47,7 +47,7 @@ func NewDevCentersClient(subscriptionID string, credential azcore.TokenCredentia // BeginCreateOrUpdate - Creates or updates a devcenter resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - body - Represents a devcenter. @@ -74,7 +74,7 @@ func (client *DevCentersClient) BeginCreateOrUpdate(ctx context.Context, resourc // CreateOrUpdate - Creates or updates a devcenter resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *DevCentersClient) createOrUpdate(ctx context.Context, resourceGroupName string, devCenterName string, body DevCenter, options *DevCentersClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "DevCentersClient.BeginCreateOrUpdate" @@ -116,7 +116,7 @@ func (client *DevCentersClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -128,7 +128,7 @@ func (client *DevCentersClient) createOrUpdateCreateRequest(ctx context.Context, // BeginDelete - Deletes a devcenter // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - options - DevCentersClientBeginDeleteOptions contains the optional parameters for the DevCentersClient.BeginDelete method. @@ -153,7 +153,7 @@ func (client *DevCentersClient) BeginDelete(ctx context.Context, resourceGroupNa // Delete - Deletes a devcenter // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *DevCentersClient) deleteOperation(ctx context.Context, resourceGroupName string, devCenterName string, options *DevCentersClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "DevCentersClient.BeginDelete" @@ -195,7 +195,7 @@ func (client *DevCentersClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -204,7 +204,7 @@ func (client *DevCentersClient) deleteCreateRequest(ctx context.Context, resourc // Get - Gets a devcenter. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - options - DevCentersClientGetOptions contains the optional parameters for the DevCentersClient.Get method. @@ -250,7 +250,7 @@ func (client *DevCentersClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -267,7 +267,7 @@ func (client *DevCentersClient) getHandleResponse(resp *http.Response) (DevCente // NewListByResourceGroupPager - Lists all devcenters in a resource group. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - DevCentersClientListByResourceGroupOptions contains the optional parameters for the DevCentersClient.NewListByResourceGroupPager // method. @@ -313,7 +313,7 @@ func (client *DevCentersClient) listByResourceGroupCreateRequest(ctx context.Con if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -330,7 +330,7 @@ func (client *DevCentersClient) listByResourceGroupHandleResponse(resp *http.Res // NewListBySubscriptionPager - Lists all devcenters in a subscription. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - options - DevCentersClientListBySubscriptionOptions contains the optional parameters for the DevCentersClient.NewListBySubscriptionPager // method. func (client *DevCentersClient) NewListBySubscriptionPager(options *DevCentersClientListBySubscriptionOptions) *runtime.Pager[DevCentersClientListBySubscriptionResponse] { @@ -371,7 +371,7 @@ func (client *DevCentersClient) listBySubscriptionCreateRequest(ctx context.Cont if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -389,7 +389,7 @@ func (client *DevCentersClient) listBySubscriptionHandleResponse(resp *http.Resp // BeginUpdate - Partially updates a devcenter. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - body - Updatable devcenter properties. @@ -415,7 +415,7 @@ func (client *DevCentersClient) BeginUpdate(ctx context.Context, resourceGroupNa // Update - Partially updates a devcenter. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *DevCentersClient) update(ctx context.Context, resourceGroupName string, devCenterName string, body Update, options *DevCentersClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "DevCentersClient.BeginUpdate" @@ -457,7 +457,7 @@ func (client *DevCentersClient) updateCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { diff --git a/sdk/resourcemanager/devcenter/armdevcenter/devcenters_client_example_test.go b/sdk/resourcemanager/devcenter/armdevcenter/devcenters_client_example_test.go deleted file mode 100644 index 92945c15f40e..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/devcenters_client_example_test.go +++ /dev/null @@ -1,450 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdevcenter_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/DevCenters_ListBySubscription.json -func ExampleDevCentersClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDevCentersClient().NewListBySubscriptionPager(&armdevcenter.DevCentersClientListBySubscriptionOptions{Top: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListResult = armdevcenter.ListResult{ - // Value: []*armdevcenter.DevCenter{ - // { - // Name: to.Ptr("Contoso"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/contoso"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-11T22:00:08.896Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-11T22:00:08.896Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "CostCode": to.Ptr("12345"), - // }, - // Properties: &armdevcenter.Properties{ - // DisplayName: to.Ptr("ContosoDevCenter"), - // DevCenterURI: to.Ptr("https://4c7c8922-78e9-4928-aa6f-75ba59355371-contoso.centralus.devcenter.azure.com"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/DevCenters_ListByResourceGroup.json -func ExampleDevCentersClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDevCentersClient().NewListByResourceGroupPager("rg1", &armdevcenter.DevCentersClientListByResourceGroupOptions{Top: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListResult = armdevcenter.ListResult{ - // Value: []*armdevcenter.DevCenter{ - // { - // Name: to.Ptr("Contoso"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/contoso"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-11T22:00:08.896Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-11T22:00:08.896Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "CostCode": to.Ptr("12345"), - // }, - // Properties: &armdevcenter.Properties{ - // DisplayName: to.Ptr("ContosoDevCenter"), - // DevCenterURI: to.Ptr("https://4c7c8922-78e9-4928-aa6f-75ba59355371-contoso.centralus.devcenter.azure.com"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/DevCenters_Get.json -func ExampleDevCentersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDevCentersClient().Get(ctx, "rg1", "Contoso", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DevCenter = armdevcenter.DevCenter{ - // Name: to.Ptr("Contoso"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-11T22:00:08.896Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-11T22:00:10.896Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "CostCode": to.Ptr("12345"), - // "hidden-title": to.Ptr("ContosoDevCenter"), - // }, - // Properties: &armdevcenter.Properties{ - // DisplayName: to.Ptr("ContosoDevCenter"), - // ProjectCatalogSettings: &armdevcenter.ProjectCatalogSettingsInfo{ - // CatalogItemSyncEnableStatus: to.Ptr(armdevcenter.CatalogItemSyncEnableStatusEnabled), - // }, - // DevCenterURI: to.Ptr("https://4c7c8922-78e9-4928-aa6f-75ba59355371-contoso.centralus.devcenter.azure.com"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/DevCenters_Create.json -func ExampleDevCentersClient_BeginCreateOrUpdate_devCentersCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDevCentersClient().BeginCreateOrUpdate(ctx, "rg1", "Contoso", armdevcenter.DevCenter{ - Location: to.Ptr("centralus"), - Tags: map[string]*string{ - "CostCode": to.Ptr("12345"), - }, - Properties: &armdevcenter.Properties{ - DisplayName: to.Ptr("ContosoDevCenter"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DevCenter = armdevcenter.DevCenter{ - // Name: to.Ptr("Contoso"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-11T22:00:08.896Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-11T22:00:10.896Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "CostCode": to.Ptr("12345"), - // "hidden-title": to.Ptr("ContosoDevCenter"), - // }, - // Properties: &armdevcenter.Properties{ - // DisplayName: to.Ptr("ContosoDevCenter"), - // ProjectCatalogSettings: &armdevcenter.ProjectCatalogSettingsInfo{ - // CatalogItemSyncEnableStatus: to.Ptr(armdevcenter.CatalogItemSyncEnableStatusEnabled), - // }, - // DevCenterURI: to.Ptr("https://4c7c8922-78e9-4928-aa6f-75ba59355371-contoso.centralus.devcenter.azure.com"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/DevCenters_CreateWithEncryption.json -func ExampleDevCentersClient_BeginCreateOrUpdate_devCentersCreateWithEncryption() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDevCentersClient().BeginCreateOrUpdate(ctx, "rg1", "Contoso", armdevcenter.DevCenter{ - Location: to.Ptr("centralus"), - Tags: map[string]*string{ - "CostCode": to.Ptr("12345"), - }, - Identity: &armdevcenter.ManagedServiceIdentity{ - Type: to.Ptr(armdevcenter.ManagedServiceIdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armdevcenter.UserAssignedIdentity{ - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/identityGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testidentity1": {}, - }, - }, - Properties: &armdevcenter.Properties{ - DisplayName: to.Ptr("ContosoDevCenter"), - Encryption: &armdevcenter.Encryption{ - CustomerManagedKeyEncryption: &armdevcenter.CustomerManagedKeyEncryption{ - KeyEncryptionKeyIdentity: &armdevcenter.CustomerManagedKeyEncryptionKeyIdentity{ - IdentityType: to.Ptr(armdevcenter.IdentityTypeUserAssignedIdentity), - UserAssignedIdentityResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/identityGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testidentity1"), - }, - KeyEncryptionKeyURL: to.Ptr("https://contosovault.vault.azure.net/keys/contosokek"), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DevCenter = armdevcenter.DevCenter{ - // Name: to.Ptr("Contoso"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-11T22:00:08.896Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-11T22:00:10.896Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "CostCode": to.Ptr("12345"), - // }, - // Identity: &armdevcenter.ManagedServiceIdentity{ - // Type: to.Ptr(armdevcenter.ManagedServiceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armdevcenter.UserAssignedIdentity{ - // "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/identityGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testidentity1": &armdevcenter.UserAssignedIdentity{ - // ClientID: to.Ptr("e35621a5-f615-4a20-940e-de8a84b15abc"), - // PrincipalID: to.Ptr("2111b8fc-e123-485a-b408-bf1153189494"), - // }, - // }, - // }, - // Properties: &armdevcenter.Properties{ - // DisplayName: to.Ptr("ContosoDevCenter"), - // Encryption: &armdevcenter.Encryption{ - // CustomerManagedKeyEncryption: &armdevcenter.CustomerManagedKeyEncryption{ - // KeyEncryptionKeyIdentity: &armdevcenter.CustomerManagedKeyEncryptionKeyIdentity{ - // IdentityType: to.Ptr(armdevcenter.IdentityTypeUserAssignedIdentity), - // UserAssignedIdentityResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/identityGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testidentity1"), - // }, - // KeyEncryptionKeyURL: to.Ptr("https://contosovault.vault.azure.net/keys/contosokek"), - // }, - // }, - // DevCenterURI: to.Ptr("https://4c7c8922-78e9-4928-aa6f-75ba59355371-contoso.centralus.devcenter.azure.com"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/DevCenters_CreateWithUserIdentity.json -func ExampleDevCentersClient_BeginCreateOrUpdate_devCentersCreateWithUserIdentity() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDevCentersClient().BeginCreateOrUpdate(ctx, "rg1", "Contoso", armdevcenter.DevCenter{ - Location: to.Ptr("centralus"), - Tags: map[string]*string{ - "CostCode": to.Ptr("12345"), - }, - Identity: &armdevcenter.ManagedServiceIdentity{ - Type: to.Ptr(armdevcenter.ManagedServiceIdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armdevcenter.UserAssignedIdentity{ - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/identityGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testidentity1": {}, - }, - }, - Properties: &armdevcenter.Properties{ - DisplayName: to.Ptr("ContosoDevCenter"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DevCenter = armdevcenter.DevCenter{ - // Name: to.Ptr("Contoso"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-11T22:00:08.896Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-11T22:00:10.896Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "CostCode": to.Ptr("12345"), - // }, - // Identity: &armdevcenter.ManagedServiceIdentity{ - // Type: to.Ptr(armdevcenter.ManagedServiceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armdevcenter.UserAssignedIdentity{ - // "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/identityGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testidentity1": &armdevcenter.UserAssignedIdentity{ - // ClientID: to.Ptr("e35621a5-f615-4a20-940e-de8a84b15abc"), - // PrincipalID: to.Ptr("2111b8fc-e123-485a-b408-bf1153189494"), - // }, - // }, - // }, - // Properties: &armdevcenter.Properties{ - // DisplayName: to.Ptr("ContosoDevCenter"), - // DevCenterURI: to.Ptr("https://4c7c8922-78e9-4928-aa6f-75ba59355371-contoso.centralus.devcenter.azure.com"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/DevCenters_Patch.json -func ExampleDevCentersClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDevCentersClient().BeginUpdate(ctx, "rg1", "Contoso", armdevcenter.Update{ - Tags: map[string]*string{ - "CostCode": to.Ptr("12345"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DevCenter = armdevcenter.DevCenter{ - // Name: to.Ptr("Contoso"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-11T22:00:08.896Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-11T22:00:10.896Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "CostCode": to.Ptr("12345"), - // }, - // Properties: &armdevcenter.Properties{ - // DisplayName: to.Ptr("ContosoDevCenter"), - // DevCenterURI: to.Ptr("https://4c7c8922-78e9-4928-aa6f-75ba59355371-contoso.centralus.devcenter.azure.com"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/DevCenters_Delete.json -func ExampleDevCentersClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDevCentersClient().BeginDelete(ctx, "rg1", "Contoso", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/encryptionsets_client.go b/sdk/resourcemanager/devcenter/armdevcenter/encryptionsets_client.go new file mode 100644 index 000000000000..33728a899355 --- /dev/null +++ b/sdk/resourcemanager/devcenter/armdevcenter/encryptionsets_client.go @@ -0,0 +1,435 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdevcenter + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// EncryptionSetsClient contains the methods for the EncryptionSets group. +// Don't use this type directly, use NewEncryptionSetsClient() instead. +type EncryptionSetsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewEncryptionSetsClient creates a new instance of EncryptionSetsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewEncryptionSetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*EncryptionSetsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &EncryptionSetsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a devcenter encryption set resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - devCenterName - The name of the devcenter. +// - encryptionSetName - The name of the devcenter encryption set. +// - body - Represents a devcenter encryption set. +// - options - EncryptionSetsClientBeginCreateOrUpdateOptions contains the optional parameters for the EncryptionSetsClient.BeginCreateOrUpdate +// method. +func (client *EncryptionSetsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, devCenterName string, encryptionSetName string, body EncryptionSet, options *EncryptionSetsClientBeginCreateOrUpdateOptions) (*runtime.Poller[EncryptionSetsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, devCenterName, encryptionSetName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EncryptionSetsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EncryptionSetsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates or updates a devcenter encryption set resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +func (client *EncryptionSetsClient) createOrUpdate(ctx context.Context, resourceGroupName string, devCenterName string, encryptionSetName string, body EncryptionSet, options *EncryptionSetsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "EncryptionSetsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, devCenterName, encryptionSetName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *EncryptionSetsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, devCenterName string, encryptionSetName string, body EncryptionSet, options *EncryptionSetsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}/encryptionSets/{encryptionSetName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if devCenterName == "" { + return nil, errors.New("parameter devCenterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{devCenterName}", url.PathEscape(devCenterName)) + if encryptionSetName == "" { + return nil, errors.New("parameter encryptionSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{encryptionSetName}", url.PathEscape(encryptionSetName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a devcenter encryption set +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - devCenterName - The name of the devcenter. +// - encryptionSetName - The name of the devcenter encryption set. +// - options - EncryptionSetsClientBeginDeleteOptions contains the optional parameters for the EncryptionSetsClient.BeginDelete +// method. +func (client *EncryptionSetsClient) BeginDelete(ctx context.Context, resourceGroupName string, devCenterName string, encryptionSetName string, options *EncryptionSetsClientBeginDeleteOptions) (*runtime.Poller[EncryptionSetsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, devCenterName, encryptionSetName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EncryptionSetsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EncryptionSetsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a devcenter encryption set +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +func (client *EncryptionSetsClient) deleteOperation(ctx context.Context, resourceGroupName string, devCenterName string, encryptionSetName string, options *EncryptionSetsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "EncryptionSetsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, devCenterName, encryptionSetName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *EncryptionSetsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, devCenterName string, encryptionSetName string, options *EncryptionSetsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}/encryptionSets/{encryptionSetName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if devCenterName == "" { + return nil, errors.New("parameter devCenterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{devCenterName}", url.PathEscape(devCenterName)) + if encryptionSetName == "" { + return nil, errors.New("parameter encryptionSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{encryptionSetName}", url.PathEscape(encryptionSetName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a devcenter encryption set. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - devCenterName - The name of the devcenter. +// - encryptionSetName - The name of the devcenter encryption set. +// - options - EncryptionSetsClientGetOptions contains the optional parameters for the EncryptionSetsClient.Get method. +func (client *EncryptionSetsClient) Get(ctx context.Context, resourceGroupName string, devCenterName string, encryptionSetName string, options *EncryptionSetsClientGetOptions) (EncryptionSetsClientGetResponse, error) { + var err error + const operationName = "EncryptionSetsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, devCenterName, encryptionSetName, options) + if err != nil { + return EncryptionSetsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EncryptionSetsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EncryptionSetsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *EncryptionSetsClient) getCreateRequest(ctx context.Context, resourceGroupName string, devCenterName string, encryptionSetName string, options *EncryptionSetsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}/encryptionSets/{encryptionSetName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if devCenterName == "" { + return nil, errors.New("parameter devCenterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{devCenterName}", url.PathEscape(devCenterName)) + if encryptionSetName == "" { + return nil, errors.New("parameter encryptionSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{encryptionSetName}", url.PathEscape(encryptionSetName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *EncryptionSetsClient) getHandleResponse(resp *http.Response) (EncryptionSetsClientGetResponse, error) { + result := EncryptionSetsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EncryptionSet); err != nil { + return EncryptionSetsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all encryption sets in the devcenter. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - devCenterName - The name of the devcenter. +// - options - EncryptionSetsClientListOptions contains the optional parameters for the EncryptionSetsClient.NewListPager method. +func (client *EncryptionSetsClient) NewListPager(resourceGroupName string, devCenterName string, options *EncryptionSetsClientListOptions) *runtime.Pager[EncryptionSetsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[EncryptionSetsClientListResponse]{ + More: func(page EncryptionSetsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *EncryptionSetsClientListResponse) (EncryptionSetsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EncryptionSetsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, devCenterName, options) + }, nil) + if err != nil { + return EncryptionSetsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *EncryptionSetsClient) listCreateRequest(ctx context.Context, resourceGroupName string, devCenterName string, options *EncryptionSetsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}/encryptionSets" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if devCenterName == "" { + return nil, errors.New("parameter devCenterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{devCenterName}", url.PathEscape(devCenterName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *EncryptionSetsClient) listHandleResponse(resp *http.Response) (EncryptionSetsClientListResponse, error) { + result := EncryptionSetsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EncryptionSetListResult); err != nil { + return EncryptionSetsClientListResponse{}, err + } + return result, nil +} + +// BeginUpdate - Partially updates a devcenter encryption set. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - devCenterName - The name of the devcenter. +// - encryptionSetName - The name of the devcenter encryption set. +// - body - Updatable devcenter encryption set properties. +// - options - EncryptionSetsClientBeginUpdateOptions contains the optional parameters for the EncryptionSetsClient.BeginUpdate +// method. +func (client *EncryptionSetsClient) BeginUpdate(ctx context.Context, resourceGroupName string, devCenterName string, encryptionSetName string, body EncryptionSetUpdate, options *EncryptionSetsClientBeginUpdateOptions) (*runtime.Poller[EncryptionSetsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, devCenterName, encryptionSetName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EncryptionSetsClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EncryptionSetsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Partially updates a devcenter encryption set. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +func (client *EncryptionSetsClient) update(ctx context.Context, resourceGroupName string, devCenterName string, encryptionSetName string, body EncryptionSetUpdate, options *EncryptionSetsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "EncryptionSetsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, devCenterName, encryptionSetName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *EncryptionSetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, devCenterName string, encryptionSetName string, body EncryptionSetUpdate, options *EncryptionSetsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}/encryptionSets/{encryptionSetName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if devCenterName == "" { + return nil, errors.New("parameter devCenterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{devCenterName}", url.PathEscape(devCenterName)) + if encryptionSetName == "" { + return nil, errors.New("parameter encryptionSetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{encryptionSetName}", url.PathEscape(encryptionSetName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/environmentdefinitions_client.go b/sdk/resourcemanager/devcenter/armdevcenter/environmentdefinitions_client.go index 8510162702f3..c34233a5d9b0 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/environmentdefinitions_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/environmentdefinitions_client.go @@ -47,7 +47,7 @@ func NewEnvironmentDefinitionsClient(subscriptionID string, credential azcore.To // Get - Gets an environment definition from the catalog. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - catalogName - The name of the Catalog. @@ -104,7 +104,7 @@ func (client *EnvironmentDefinitionsClient) getCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -122,7 +122,7 @@ func (client *EnvironmentDefinitionsClient) getHandleResponse(resp *http.Respons // GetByProjectCatalog - Gets an environment definition from the catalog. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - catalogName - The name of the Catalog. @@ -179,7 +179,7 @@ func (client *EnvironmentDefinitionsClient) getByProjectCatalogCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -197,7 +197,7 @@ func (client *EnvironmentDefinitionsClient) getByProjectCatalogHandleResponse(re // GetErrorDetails - Gets Environment Definition error details // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - catalogName - The name of the Catalog. @@ -254,7 +254,7 @@ func (client *EnvironmentDefinitionsClient) getErrorDetailsCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -271,7 +271,7 @@ func (client *EnvironmentDefinitionsClient) getErrorDetailsHandleResponse(resp * // NewListByCatalogPager - List environment definitions in the catalog. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - catalogName - The name of the Catalog. @@ -327,7 +327,7 @@ func (client *EnvironmentDefinitionsClient) listByCatalogCreateRequest(ctx conte if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -344,7 +344,7 @@ func (client *EnvironmentDefinitionsClient) listByCatalogHandleResponse(resp *ht // NewListByProjectCatalogPager - Lists the environment definitions in this project catalog. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - catalogName - The name of the Catalog. @@ -397,7 +397,7 @@ func (client *EnvironmentDefinitionsClient) listByProjectCatalogCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/devcenter/armdevcenter/environmentdefinitions_client_example_test.go b/sdk/resourcemanager/devcenter/armdevcenter/environmentdefinitions_client_example_test.go deleted file mode 100644 index 22f687b4fa59..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/environmentdefinitions_client_example_test.go +++ /dev/null @@ -1,293 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdevcenter_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/EnvironmentDefinitions_ListByProjectCatalog.json -func ExampleEnvironmentDefinitionsClient_NewListByProjectCatalogPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewEnvironmentDefinitionsClient().NewListByProjectCatalogPager("rg1", "DevProject", "myCatalog", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EnvironmentDefinitionListResult = armdevcenter.EnvironmentDefinitionListResult{ - // Value: []*armdevcenter.EnvironmentDefinition{ - // { - // Name: to.Ptr("myEnvironmentDefinition"), - // Type: to.Ptr("Microsoft.DevCenter/projects/catalogs/environmentDefinitions"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/DevProject/catalogs/myCatalog/environmentDefinitions/myEnvironmentDefinition"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.EnvironmentDefinitionProperties{ - // Description: to.Ptr("My sample environment definition."), - // Parameters: []*armdevcenter.EnvironmentDefinitionParameter{ - // { - // Name: to.Ptr("Function App Runtime"), - // Type: to.Ptr(armdevcenter.ParameterTypeString), - // ID: to.Ptr("functionAppRuntime"), - // Required: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Storage Account Type"), - // Type: to.Ptr(armdevcenter.ParameterTypeString), - // ID: to.Ptr("storageAccountType"), - // Required: to.Ptr(true), - // }, - // { - // Name: to.Ptr("HTTPS only"), - // Type: to.Ptr(armdevcenter.ParameterTypeBoolean), - // ID: to.Ptr("httpsOnly"), - // ReadOnly: to.Ptr(true), - // Required: to.Ptr(true), - // }}, - // TemplatePath: to.Ptr("azuredeploy.json"), - // ValidationStatus: to.Ptr(armdevcenter.CatalogResourceValidationStatusSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/EnvironmentDefinitions_GetByProjectCatalog.json -func ExampleEnvironmentDefinitionsClient_GetByProjectCatalog() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEnvironmentDefinitionsClient().GetByProjectCatalog(ctx, "rg1", "DevProject", "myCatalog", "myEnvironmentDefinition", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.EnvironmentDefinition = armdevcenter.EnvironmentDefinition{ - // Name: to.Ptr("myEnvironmentDefinition"), - // Type: to.Ptr("Microsoft.DevCenter/projects/catalogs/environmentDefinitions"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/DevProject/catalogs/myCatalog/environmentDefinitions/myEnvironmentDefinition"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.EnvironmentDefinitionProperties{ - // Description: to.Ptr("My sample environment definition."), - // Parameters: []*armdevcenter.EnvironmentDefinitionParameter{ - // { - // Name: to.Ptr("Function App Runtime"), - // Type: to.Ptr(armdevcenter.ParameterTypeString), - // ID: to.Ptr("functionAppRuntime"), - // Required: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Storage Account Type"), - // Type: to.Ptr(armdevcenter.ParameterTypeString), - // ID: to.Ptr("storageAccountType"), - // Required: to.Ptr(true), - // }, - // { - // Name: to.Ptr("HTTPS only"), - // Type: to.Ptr(armdevcenter.ParameterTypeBoolean), - // ID: to.Ptr("httpsOnly"), - // ReadOnly: to.Ptr(true), - // Required: to.Ptr(true), - // }}, - // TemplatePath: to.Ptr("azuredeploy.json"), - // ValidationStatus: to.Ptr(armdevcenter.CatalogResourceValidationStatusSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/EnvironmentDefinitions_ListByCatalog.json -func ExampleEnvironmentDefinitionsClient_NewListByCatalogPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewEnvironmentDefinitionsClient().NewListByCatalogPager("rg1", "Contoso", "myCatalog", &armdevcenter.EnvironmentDefinitionsClientListByCatalogOptions{Top: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EnvironmentDefinitionListResult = armdevcenter.EnvironmentDefinitionListResult{ - // Value: []*armdevcenter.EnvironmentDefinition{ - // { - // Name: to.Ptr("myEnvironmentDefinition"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters/catalogs/environmentDefinitions"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso/catalogs/myCatalog/environmentDefinitions/myEnvironmentDefinition"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.EnvironmentDefinitionProperties{ - // Description: to.Ptr("My sample environment definition."), - // Parameters: []*armdevcenter.EnvironmentDefinitionParameter{ - // { - // Name: to.Ptr("Function App Runtime"), - // Type: to.Ptr(armdevcenter.ParameterTypeString), - // ID: to.Ptr("functionAppRuntime"), - // Required: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Storage Account Type"), - // Type: to.Ptr(armdevcenter.ParameterTypeString), - // ID: to.Ptr("storageAccountType"), - // Required: to.Ptr(true), - // }, - // { - // Name: to.Ptr("HTTPS only"), - // Type: to.Ptr(armdevcenter.ParameterTypeBoolean), - // ID: to.Ptr("httpsOnly"), - // ReadOnly: to.Ptr(true), - // Required: to.Ptr(true), - // }}, - // TemplatePath: to.Ptr("azuredeploy.json"), - // ValidationStatus: to.Ptr(armdevcenter.CatalogResourceValidationStatusSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/EnvironmentDefinitions_Get.json -func ExampleEnvironmentDefinitionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEnvironmentDefinitionsClient().Get(ctx, "rg1", "Contoso", "myCatalog", "myEnvironmentDefinition", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.EnvironmentDefinition = armdevcenter.EnvironmentDefinition{ - // Name: to.Ptr("myEnvironmentDefinition"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters/catalogs/environmentDefinitions"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso/catalogs/myCatalog/environmentDefinitions/myEnvironmentDefinition"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.EnvironmentDefinitionProperties{ - // Description: to.Ptr("My sample environment definition."), - // Parameters: []*armdevcenter.EnvironmentDefinitionParameter{ - // { - // Name: to.Ptr("Function App Runtime"), - // Type: to.Ptr(armdevcenter.ParameterTypeString), - // ID: to.Ptr("functionAppRuntime"), - // Required: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Storage Account Type"), - // Type: to.Ptr(armdevcenter.ParameterTypeString), - // ID: to.Ptr("storageAccountType"), - // Required: to.Ptr(true), - // }, - // { - // Name: to.Ptr("HTTPS only"), - // Type: to.Ptr(armdevcenter.ParameterTypeBoolean), - // ID: to.Ptr("httpsOnly"), - // ReadOnly: to.Ptr(true), - // Required: to.Ptr(true), - // }}, - // TemplatePath: to.Ptr("azuredeploy.json"), - // ValidationStatus: to.Ptr(armdevcenter.CatalogResourceValidationStatusSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/EnvironmentDefinitions_GetErrorDetails.json -func ExampleEnvironmentDefinitionsClient_GetErrorDetails() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEnvironmentDefinitionsClient().GetErrorDetails(ctx, "rg1", "Contoso", "myCatalog", "myEnvironmentDefinition", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CatalogResourceValidationErrorDetails = armdevcenter.CatalogResourceValidationErrorDetails{ - // Errors: []*armdevcenter.CatalogErrorDetails{ - // { - // Code: to.Ptr("ParameterValueInvalid"), - // Message: to.Ptr("Expected parameter value for 'InstanceCount' to be integer but found the string 'test'."), - // }}, - // } -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/environmenttypes_client.go b/sdk/resourcemanager/devcenter/armdevcenter/environmenttypes_client.go index fcc53a1eea4d..5e837320354f 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/environmenttypes_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/environmenttypes_client.go @@ -47,7 +47,7 @@ func NewEnvironmentTypesClient(subscriptionID string, credential azcore.TokenCre // CreateOrUpdate - Creates or updates an environment type. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - environmentTypeName - The name of the environment type. @@ -100,7 +100,7 @@ func (client *EnvironmentTypesClient) createOrUpdateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -121,7 +121,7 @@ func (client *EnvironmentTypesClient) createOrUpdateHandleResponse(resp *http.Re // Delete - Deletes an environment type. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - environmentTypeName - The name of the environment type. @@ -171,7 +171,7 @@ func (client *EnvironmentTypesClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -180,7 +180,7 @@ func (client *EnvironmentTypesClient) deleteCreateRequest(ctx context.Context, r // Get - Gets an environment type. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - environmentTypeName - The name of the environment type. @@ -231,7 +231,7 @@ func (client *EnvironmentTypesClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -248,7 +248,7 @@ func (client *EnvironmentTypesClient) getHandleResponse(resp *http.Response) (En // NewListByDevCenterPager - Lists environment types for the devcenter. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - options - EnvironmentTypesClientListByDevCenterOptions contains the optional parameters for the EnvironmentTypesClient.NewListByDevCenterPager @@ -299,7 +299,7 @@ func (client *EnvironmentTypesClient) listByDevCenterCreateRequest(ctx context.C if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -317,7 +317,7 @@ func (client *EnvironmentTypesClient) listByDevCenterHandleResponse(resp *http.R // Update - Partially updates an environment type. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - environmentTypeName - The name of the environment type. @@ -369,7 +369,7 @@ func (client *EnvironmentTypesClient) updateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { diff --git a/sdk/resourcemanager/devcenter/armdevcenter/environmenttypes_client_example_test.go b/sdk/resourcemanager/devcenter/armdevcenter/environmenttypes_client_example_test.go deleted file mode 100644 index 6c65e9f31a21..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/environmenttypes_client_example_test.go +++ /dev/null @@ -1,214 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdevcenter_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/EnvironmentTypes_List.json -func ExampleEnvironmentTypesClient_NewListByDevCenterPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewEnvironmentTypesClient().NewListByDevCenterPager("rg1", "Contoso", &armdevcenter.EnvironmentTypesClientListByDevCenterOptions{Top: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EnvironmentTypeListResult = armdevcenter.EnvironmentTypeListResult{ - // Value: []*armdevcenter.EnvironmentType{ - // { - // Name: to.Ptr("DevTest"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters/environmenttypes"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso/environmentTypes/DevTest"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // CreatedBy: to.Ptr("User1@contoso.com"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // LastModifiedBy: to.Ptr("User1@contoso.com"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "CostCenter": to.Ptr("RnD"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/EnvironmentTypes_Get.json -func ExampleEnvironmentTypesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEnvironmentTypesClient().Get(ctx, "rg1", "Contoso", "DevTest", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.EnvironmentType = armdevcenter.EnvironmentType{ - // Name: to.Ptr("DevTest"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters/environmenttypes"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso/environmentTypes/DevTest"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // CreatedBy: to.Ptr("User1@contoso.com"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // LastModifiedBy: to.Ptr("User1@contoso.com"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.EnvironmentTypeProperties{ - // DisplayName: to.Ptr("Dev"), - // }, - // Tags: map[string]*string{ - // "CostCenter": to.Ptr("RnD"), - // "hidden-title": to.Ptr("Dev"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/EnvironmentTypes_Put.json -func ExampleEnvironmentTypesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEnvironmentTypesClient().CreateOrUpdate(ctx, "rg1", "Contoso", "DevTest", armdevcenter.EnvironmentType{ - Properties: &armdevcenter.EnvironmentTypeProperties{ - DisplayName: to.Ptr("Dev"), - }, - Tags: map[string]*string{ - "Owner": to.Ptr("superuser"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.EnvironmentType = armdevcenter.EnvironmentType{ - // Name: to.Ptr("DevTest"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters/environmenttypes"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso/environmentTypes/DevTest"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // CreatedBy: to.Ptr("User1@contoso.com"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // LastModifiedBy: to.Ptr("User1@contoso.com"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.EnvironmentTypeProperties{ - // DisplayName: to.Ptr("Dev"), - // }, - // Tags: map[string]*string{ - // "Owner": to.Ptr("superuser"), - // "hidden-title": to.Ptr("Dev"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/EnvironmentTypes_Patch.json -func ExampleEnvironmentTypesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEnvironmentTypesClient().Update(ctx, "rg1", "Contoso", "DevTest", armdevcenter.EnvironmentTypeUpdate{ - Properties: &armdevcenter.EnvironmentTypeUpdateProperties{ - DisplayName: to.Ptr("Dev"), - }, - Tags: map[string]*string{ - "Owner": to.Ptr("superuser"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.EnvironmentType = armdevcenter.EnvironmentType{ - // Name: to.Ptr("DevTest"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters/environmenttypes"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso/environmentTypes/DevTest"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // CreatedBy: to.Ptr("User1@contoso.com"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // LastModifiedBy: to.Ptr("User1@contoso.com"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.EnvironmentTypeProperties{ - // DisplayName: to.Ptr("Dev"), - // }, - // Tags: map[string]*string{ - // "Owner": to.Ptr("superuser"), - // "hidden-title": to.Ptr("Dev"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/EnvironmentTypes_Delete.json -func ExampleEnvironmentTypesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewEnvironmentTypesClient().Delete(ctx, "rg1", "Contoso", "DevTest", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/fake/curationprofiles_server.go b/sdk/resourcemanager/devcenter/armdevcenter/fake/curationprofiles_server.go new file mode 100644 index 000000000000..b45238aa861a --- /dev/null +++ b/sdk/resourcemanager/devcenter/armdevcenter/fake/curationprofiles_server.go @@ -0,0 +1,354 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// CurationProfilesServer is a fake server for instances of the armdevcenter.CurationProfilesClient type. +type CurationProfilesServer struct { + // BeginCreateOrUpdate is the fake for method CurationProfilesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, devCenterName string, curationProfileName string, body armdevcenter.CurationProfile, options *armdevcenter.CurationProfilesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armdevcenter.CurationProfilesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method CurationProfilesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, devCenterName string, curationProfileName string, options *armdevcenter.CurationProfilesClientBeginDeleteOptions) (resp azfake.PollerResponder[armdevcenter.CurationProfilesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method CurationProfilesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, devCenterName string, curationProfileName string, options *armdevcenter.CurationProfilesClientGetOptions) (resp azfake.Responder[armdevcenter.CurationProfilesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByDevCenterPager is the fake for method CurationProfilesClient.NewListByDevCenterPager + // HTTP status codes to indicate success: http.StatusOK + NewListByDevCenterPager func(resourceGroupName string, devCenterName string, options *armdevcenter.CurationProfilesClientListByDevCenterOptions) (resp azfake.PagerResponder[armdevcenter.CurationProfilesClientListByDevCenterResponse]) + + // BeginUpdate is the fake for method CurationProfilesClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, devCenterName string, curationProfileName string, body armdevcenter.CurationProfileUpdate, options *armdevcenter.CurationProfilesClientBeginUpdateOptions) (resp azfake.PollerResponder[armdevcenter.CurationProfilesClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewCurationProfilesServerTransport creates a new instance of CurationProfilesServerTransport with the provided implementation. +// The returned CurationProfilesServerTransport instance is connected to an instance of armdevcenter.CurationProfilesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewCurationProfilesServerTransport(srv *CurationProfilesServer) *CurationProfilesServerTransport { + return &CurationProfilesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armdevcenter.CurationProfilesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armdevcenter.CurationProfilesClientDeleteResponse]](), + newListByDevCenterPager: newTracker[azfake.PagerResponder[armdevcenter.CurationProfilesClientListByDevCenterResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armdevcenter.CurationProfilesClientUpdateResponse]](), + } +} + +// CurationProfilesServerTransport connects instances of armdevcenter.CurationProfilesClient to instances of CurationProfilesServer. +// Don't use this type directly, use NewCurationProfilesServerTransport instead. +type CurationProfilesServerTransport struct { + srv *CurationProfilesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armdevcenter.CurationProfilesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armdevcenter.CurationProfilesClientDeleteResponse]] + newListByDevCenterPager *tracker[azfake.PagerResponder[armdevcenter.CurationProfilesClientListByDevCenterResponse]] + beginUpdate *tracker[azfake.PollerResponder[armdevcenter.CurationProfilesClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for CurationProfilesServerTransport. +func (c *CurationProfilesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "CurationProfilesClient.BeginCreateOrUpdate": + resp, err = c.dispatchBeginCreateOrUpdate(req) + case "CurationProfilesClient.BeginDelete": + resp, err = c.dispatchBeginDelete(req) + case "CurationProfilesClient.Get": + resp, err = c.dispatchGet(req) + case "CurationProfilesClient.NewListByDevCenterPager": + resp, err = c.dispatchNewListByDevCenterPager(req) + case "CurationProfilesClient.BeginUpdate": + resp, err = c.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *CurationProfilesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if c.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := c.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/devcenters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/curationProfiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdevcenter.CurationProfile](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + devCenterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("devCenterName")]) + if err != nil { + return nil, err + } + curationProfileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("curationProfileName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, devCenterNameParam, curationProfileNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + c.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + c.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + c.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (c *CurationProfilesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if c.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := c.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/devcenters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/curationProfiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + devCenterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("devCenterName")]) + if err != nil { + return nil, err + } + curationProfileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("curationProfileName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginDelete(req.Context(), resourceGroupNameParam, devCenterNameParam, curationProfileNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + c.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + c.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + c.beginDelete.remove(req) + } + + return resp, nil +} + +func (c *CurationProfilesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if c.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/devcenters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/curationProfiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + devCenterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("devCenterName")]) + if err != nil { + return nil, err + } + curationProfileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("curationProfileName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, devCenterNameParam, curationProfileNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CurationProfile, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *CurationProfilesServerTransport) dispatchNewListByDevCenterPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListByDevCenterPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByDevCenterPager not implemented")} + } + newListByDevCenterPager := c.newListByDevCenterPager.get(req) + if newListByDevCenterPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/devcenters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/curationProfiles` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + devCenterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("devCenterName")]) + if err != nil { + return nil, err + } + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armdevcenter.CurationProfilesClientListByDevCenterOptions + if topParam != nil { + options = &armdevcenter.CurationProfilesClientListByDevCenterOptions{ + Top: topParam, + } + } + resp := c.srv.NewListByDevCenterPager(resourceGroupNameParam, devCenterNameParam, options) + newListByDevCenterPager = &resp + c.newListByDevCenterPager.add(req, newListByDevCenterPager) + server.PagerResponderInjectNextLinks(newListByDevCenterPager, req, func(page *armdevcenter.CurationProfilesClientListByDevCenterResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByDevCenterPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListByDevCenterPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByDevCenterPager) { + c.newListByDevCenterPager.remove(req) + } + return resp, nil +} + +func (c *CurationProfilesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if c.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := c.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/devcenters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/curationProfiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdevcenter.CurationProfileUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + devCenterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("devCenterName")]) + if err != nil { + return nil, err + } + curationProfileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("curationProfileName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginUpdate(req.Context(), resourceGroupNameParam, devCenterNameParam, curationProfileNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + c.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + c.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + c.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/fake/customizationtasks_server.go b/sdk/resourcemanager/devcenter/armdevcenter/fake/customizationtasks_server.go new file mode 100644 index 000000000000..2f81e0ed8359 --- /dev/null +++ b/sdk/resourcemanager/devcenter/armdevcenter/fake/customizationtasks_server.go @@ -0,0 +1,233 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// CustomizationTasksServer is a fake server for instances of the armdevcenter.CustomizationTasksClient type. +type CustomizationTasksServer struct { + // Get is the fake for method CustomizationTasksClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, devCenterName string, catalogName string, taskName string, options *armdevcenter.CustomizationTasksClientGetOptions) (resp azfake.Responder[armdevcenter.CustomizationTasksClientGetResponse], errResp azfake.ErrorResponder) + + // GetErrorDetails is the fake for method CustomizationTasksClient.GetErrorDetails + // HTTP status codes to indicate success: http.StatusOK + GetErrorDetails func(ctx context.Context, resourceGroupName string, devCenterName string, catalogName string, taskName string, options *armdevcenter.CustomizationTasksClientGetErrorDetailsOptions) (resp azfake.Responder[armdevcenter.CustomizationTasksClientGetErrorDetailsResponse], errResp azfake.ErrorResponder) + + // NewListByCatalogPager is the fake for method CustomizationTasksClient.NewListByCatalogPager + // HTTP status codes to indicate success: http.StatusOK + NewListByCatalogPager func(resourceGroupName string, devCenterName string, catalogName string, options *armdevcenter.CustomizationTasksClientListByCatalogOptions) (resp azfake.PagerResponder[armdevcenter.CustomizationTasksClientListByCatalogResponse]) +} + +// NewCustomizationTasksServerTransport creates a new instance of CustomizationTasksServerTransport with the provided implementation. +// The returned CustomizationTasksServerTransport instance is connected to an instance of armdevcenter.CustomizationTasksClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewCustomizationTasksServerTransport(srv *CustomizationTasksServer) *CustomizationTasksServerTransport { + return &CustomizationTasksServerTransport{ + srv: srv, + newListByCatalogPager: newTracker[azfake.PagerResponder[armdevcenter.CustomizationTasksClientListByCatalogResponse]](), + } +} + +// CustomizationTasksServerTransport connects instances of armdevcenter.CustomizationTasksClient to instances of CustomizationTasksServer. +// Don't use this type directly, use NewCustomizationTasksServerTransport instead. +type CustomizationTasksServerTransport struct { + srv *CustomizationTasksServer + newListByCatalogPager *tracker[azfake.PagerResponder[armdevcenter.CustomizationTasksClientListByCatalogResponse]] +} + +// Do implements the policy.Transporter interface for CustomizationTasksServerTransport. +func (c *CustomizationTasksServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "CustomizationTasksClient.Get": + resp, err = c.dispatchGet(req) + case "CustomizationTasksClient.GetErrorDetails": + resp, err = c.dispatchGetErrorDetails(req) + case "CustomizationTasksClient.NewListByCatalogPager": + resp, err = c.dispatchNewListByCatalogPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *CustomizationTasksServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if c.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/devcenters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/catalogs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tasks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + devCenterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("devCenterName")]) + if err != nil { + return nil, err + } + catalogNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("catalogName")]) + if err != nil { + return nil, err + } + taskNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("taskName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, devCenterNameParam, catalogNameParam, taskNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CustomizationTask, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *CustomizationTasksServerTransport) dispatchGetErrorDetails(req *http.Request) (*http.Response, error) { + if c.srv.GetErrorDetails == nil { + return nil, &nonRetriableError{errors.New("fake for method GetErrorDetails not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/devcenters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/catalogs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tasks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getErrorDetails` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + devCenterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("devCenterName")]) + if err != nil { + return nil, err + } + catalogNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("catalogName")]) + if err != nil { + return nil, err + } + taskNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("taskName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.GetErrorDetails(req.Context(), resourceGroupNameParam, devCenterNameParam, catalogNameParam, taskNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CatalogResourceValidationErrorDetails, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *CustomizationTasksServerTransport) dispatchNewListByCatalogPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListByCatalogPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByCatalogPager not implemented")} + } + newListByCatalogPager := c.newListByCatalogPager.get(req) + if newListByCatalogPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/devcenters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/catalogs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tasks` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + devCenterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("devCenterName")]) + if err != nil { + return nil, err + } + catalogNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("catalogName")]) + if err != nil { + return nil, err + } + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armdevcenter.CustomizationTasksClientListByCatalogOptions + if topParam != nil { + options = &armdevcenter.CustomizationTasksClientListByCatalogOptions{ + Top: topParam, + } + } + resp := c.srv.NewListByCatalogPager(resourceGroupNameParam, devCenterNameParam, catalogNameParam, options) + newListByCatalogPager = &resp + c.newListByCatalogPager.add(req, newListByCatalogPager) + server.PagerResponderInjectNextLinks(newListByCatalogPager, req, func(page *armdevcenter.CustomizationTasksClientListByCatalogResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByCatalogPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListByCatalogPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByCatalogPager) { + c.newListByCatalogPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/fake/encryptionsets_server.go b/sdk/resourcemanager/devcenter/armdevcenter/fake/encryptionsets_server.go new file mode 100644 index 000000000000..1d2c1916b158 --- /dev/null +++ b/sdk/resourcemanager/devcenter/armdevcenter/fake/encryptionsets_server.go @@ -0,0 +1,354 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// EncryptionSetsServer is a fake server for instances of the armdevcenter.EncryptionSetsClient type. +type EncryptionSetsServer struct { + // BeginCreateOrUpdate is the fake for method EncryptionSetsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, devCenterName string, encryptionSetName string, body armdevcenter.EncryptionSet, options *armdevcenter.EncryptionSetsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armdevcenter.EncryptionSetsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method EncryptionSetsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, devCenterName string, encryptionSetName string, options *armdevcenter.EncryptionSetsClientBeginDeleteOptions) (resp azfake.PollerResponder[armdevcenter.EncryptionSetsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method EncryptionSetsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, devCenterName string, encryptionSetName string, options *armdevcenter.EncryptionSetsClientGetOptions) (resp azfake.Responder[armdevcenter.EncryptionSetsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method EncryptionSetsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, devCenterName string, options *armdevcenter.EncryptionSetsClientListOptions) (resp azfake.PagerResponder[armdevcenter.EncryptionSetsClientListResponse]) + + // BeginUpdate is the fake for method EncryptionSetsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, devCenterName string, encryptionSetName string, body armdevcenter.EncryptionSetUpdate, options *armdevcenter.EncryptionSetsClientBeginUpdateOptions) (resp azfake.PollerResponder[armdevcenter.EncryptionSetsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewEncryptionSetsServerTransport creates a new instance of EncryptionSetsServerTransport with the provided implementation. +// The returned EncryptionSetsServerTransport instance is connected to an instance of armdevcenter.EncryptionSetsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewEncryptionSetsServerTransport(srv *EncryptionSetsServer) *EncryptionSetsServerTransport { + return &EncryptionSetsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armdevcenter.EncryptionSetsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armdevcenter.EncryptionSetsClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armdevcenter.EncryptionSetsClientListResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armdevcenter.EncryptionSetsClientUpdateResponse]](), + } +} + +// EncryptionSetsServerTransport connects instances of armdevcenter.EncryptionSetsClient to instances of EncryptionSetsServer. +// Don't use this type directly, use NewEncryptionSetsServerTransport instead. +type EncryptionSetsServerTransport struct { + srv *EncryptionSetsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armdevcenter.EncryptionSetsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armdevcenter.EncryptionSetsClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armdevcenter.EncryptionSetsClientListResponse]] + beginUpdate *tracker[azfake.PollerResponder[armdevcenter.EncryptionSetsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for EncryptionSetsServerTransport. +func (e *EncryptionSetsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "EncryptionSetsClient.BeginCreateOrUpdate": + resp, err = e.dispatchBeginCreateOrUpdate(req) + case "EncryptionSetsClient.BeginDelete": + resp, err = e.dispatchBeginDelete(req) + case "EncryptionSetsClient.Get": + resp, err = e.dispatchGet(req) + case "EncryptionSetsClient.NewListPager": + resp, err = e.dispatchNewListPager(req) + case "EncryptionSetsClient.BeginUpdate": + resp, err = e.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (e *EncryptionSetsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if e.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := e.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/devcenters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/encryptionSets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdevcenter.EncryptionSet](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + devCenterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("devCenterName")]) + if err != nil { + return nil, err + } + encryptionSetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("encryptionSetName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, devCenterNameParam, encryptionSetNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + e.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + e.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + e.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (e *EncryptionSetsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if e.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := e.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/devcenters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/encryptionSets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + devCenterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("devCenterName")]) + if err != nil { + return nil, err + } + encryptionSetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("encryptionSetName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginDelete(req.Context(), resourceGroupNameParam, devCenterNameParam, encryptionSetNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + e.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + e.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + e.beginDelete.remove(req) + } + + return resp, nil +} + +func (e *EncryptionSetsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if e.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/devcenters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/encryptionSets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + devCenterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("devCenterName")]) + if err != nil { + return nil, err + } + encryptionSetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("encryptionSetName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Get(req.Context(), resourceGroupNameParam, devCenterNameParam, encryptionSetNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).EncryptionSet, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *EncryptionSetsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if e.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := e.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/devcenters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/encryptionSets` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + devCenterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("devCenterName")]) + if err != nil { + return nil, err + } + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armdevcenter.EncryptionSetsClientListOptions + if topParam != nil { + options = &armdevcenter.EncryptionSetsClientListOptions{ + Top: topParam, + } + } + resp := e.srv.NewListPager(resourceGroupNameParam, devCenterNameParam, options) + newListPager = &resp + e.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armdevcenter.EncryptionSetsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + e.newListPager.remove(req) + } + return resp, nil +} + +func (e *EncryptionSetsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if e.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := e.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/devcenters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/encryptionSets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdevcenter.EncryptionSetUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + devCenterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("devCenterName")]) + if err != nil { + return nil, err + } + encryptionSetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("encryptionSetName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginUpdate(req.Context(), resourceGroupNameParam, devCenterNameParam, encryptionSetNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + e.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + e.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + e.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/fake/images_server.go b/sdk/resourcemanager/devcenter/armdevcenter/fake/images_server.go index ec38f062fc99..e2e6a5f33fe7 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/fake/images_server.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/fake/images_server.go @@ -29,6 +29,10 @@ type ImagesServer struct { // HTTP status codes to indicate success: http.StatusOK Get func(ctx context.Context, resourceGroupName string, devCenterName string, galleryName string, imageName string, options *armdevcenter.ImagesClientGetOptions) (resp azfake.Responder[armdevcenter.ImagesClientGetResponse], errResp azfake.ErrorResponder) + // GetByProject is the fake for method ImagesClient.GetByProject + // HTTP status codes to indicate success: http.StatusOK + GetByProject func(ctx context.Context, resourceGroupName string, projectName string, imageName string, options *armdevcenter.ImagesClientGetByProjectOptions) (resp azfake.Responder[armdevcenter.ImagesClientGetByProjectResponse], errResp azfake.ErrorResponder) + // NewListByDevCenterPager is the fake for method ImagesClient.NewListByDevCenterPager // HTTP status codes to indicate success: http.StatusOK NewListByDevCenterPager func(resourceGroupName string, devCenterName string, options *armdevcenter.ImagesClientListByDevCenterOptions) (resp azfake.PagerResponder[armdevcenter.ImagesClientListByDevCenterResponse]) @@ -36,6 +40,10 @@ type ImagesServer struct { // NewListByGalleryPager is the fake for method ImagesClient.NewListByGalleryPager // HTTP status codes to indicate success: http.StatusOK NewListByGalleryPager func(resourceGroupName string, devCenterName string, galleryName string, options *armdevcenter.ImagesClientListByGalleryOptions) (resp azfake.PagerResponder[armdevcenter.ImagesClientListByGalleryResponse]) + + // NewListByProjectPager is the fake for method ImagesClient.NewListByProjectPager + // HTTP status codes to indicate success: http.StatusOK + NewListByProjectPager func(resourceGroupName string, projectName string, options *armdevcenter.ImagesClientListByProjectOptions) (resp azfake.PagerResponder[armdevcenter.ImagesClientListByProjectResponse]) } // NewImagesServerTransport creates a new instance of ImagesServerTransport with the provided implementation. @@ -46,6 +54,7 @@ func NewImagesServerTransport(srv *ImagesServer) *ImagesServerTransport { srv: srv, newListByDevCenterPager: newTracker[azfake.PagerResponder[armdevcenter.ImagesClientListByDevCenterResponse]](), newListByGalleryPager: newTracker[azfake.PagerResponder[armdevcenter.ImagesClientListByGalleryResponse]](), + newListByProjectPager: newTracker[azfake.PagerResponder[armdevcenter.ImagesClientListByProjectResponse]](), } } @@ -55,6 +64,7 @@ type ImagesServerTransport struct { srv *ImagesServer newListByDevCenterPager *tracker[azfake.PagerResponder[armdevcenter.ImagesClientListByDevCenterResponse]] newListByGalleryPager *tracker[azfake.PagerResponder[armdevcenter.ImagesClientListByGalleryResponse]] + newListByProjectPager *tracker[azfake.PagerResponder[armdevcenter.ImagesClientListByProjectResponse]] } // Do implements the policy.Transporter interface for ImagesServerTransport. @@ -71,10 +81,14 @@ func (i *ImagesServerTransport) Do(req *http.Request) (*http.Response, error) { switch method { case "ImagesClient.Get": resp, err = i.dispatchGet(req) + case "ImagesClient.GetByProject": + resp, err = i.dispatchGetByProject(req) case "ImagesClient.NewListByDevCenterPager": resp, err = i.dispatchNewListByDevCenterPager(req) case "ImagesClient.NewListByGalleryPager": resp, err = i.dispatchNewListByGalleryPager(req) + case "ImagesClient.NewListByProjectPager": + resp, err = i.dispatchNewListByProjectPager(req) default: err = fmt.Errorf("unhandled API %s", method) } @@ -127,6 +141,43 @@ func (i *ImagesServerTransport) dispatchGet(req *http.Request) (*http.Response, return resp, nil } +func (i *ImagesServerTransport) dispatchGetByProject(req *http.Request) (*http.Response, error) { + if i.srv.GetByProject == nil { + return nil, &nonRetriableError{errors.New("fake for method GetByProject not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/images/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + imageNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("imageName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.GetByProject(req.Context(), resourceGroupNameParam, projectNameParam, imageNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Image, req) + if err != nil { + return nil, err + } + return resp, nil +} + func (i *ImagesServerTransport) dispatchNewListByDevCenterPager(req *http.Request) (*http.Response, error) { if i.srv.NewListByDevCenterPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListByDevCenterPager not implemented")} @@ -254,3 +305,44 @@ func (i *ImagesServerTransport) dispatchNewListByGalleryPager(req *http.Request) } return resp, nil } + +func (i *ImagesServerTransport) dispatchNewListByProjectPager(req *http.Request) (*http.Response, error) { + if i.srv.NewListByProjectPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByProjectPager not implemented")} + } + newListByProjectPager := i.newListByProjectPager.get(req) + if newListByProjectPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/images` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + resp := i.srv.NewListByProjectPager(resourceGroupNameParam, projectNameParam, nil) + newListByProjectPager = &resp + i.newListByProjectPager.add(req, newListByProjectPager) + server.PagerResponderInjectNextLinks(newListByProjectPager, req, func(page *armdevcenter.ImagesClientListByProjectResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByProjectPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + i.newListByProjectPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByProjectPager) { + i.newListByProjectPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/fake/imageversions_server.go b/sdk/resourcemanager/devcenter/armdevcenter/fake/imageversions_server.go index 322b3385f2a2..ce8f3ce3cb7c 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/fake/imageversions_server.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/fake/imageversions_server.go @@ -28,9 +28,17 @@ type ImageVersionsServer struct { // HTTP status codes to indicate success: http.StatusOK Get func(ctx context.Context, resourceGroupName string, devCenterName string, galleryName string, imageName string, versionName string, options *armdevcenter.ImageVersionsClientGetOptions) (resp azfake.Responder[armdevcenter.ImageVersionsClientGetResponse], errResp azfake.ErrorResponder) + // GetByProject is the fake for method ImageVersionsClient.GetByProject + // HTTP status codes to indicate success: http.StatusOK + GetByProject func(ctx context.Context, resourceGroupName string, projectName string, imageName string, versionName string, options *armdevcenter.ImageVersionsClientGetByProjectOptions) (resp azfake.Responder[armdevcenter.ImageVersionsClientGetByProjectResponse], errResp azfake.ErrorResponder) + // NewListByImagePager is the fake for method ImageVersionsClient.NewListByImagePager // HTTP status codes to indicate success: http.StatusOK NewListByImagePager func(resourceGroupName string, devCenterName string, galleryName string, imageName string, options *armdevcenter.ImageVersionsClientListByImageOptions) (resp azfake.PagerResponder[armdevcenter.ImageVersionsClientListByImageResponse]) + + // NewListByProjectPager is the fake for method ImageVersionsClient.NewListByProjectPager + // HTTP status codes to indicate success: http.StatusOK + NewListByProjectPager func(resourceGroupName string, projectName string, imageName string, options *armdevcenter.ImageVersionsClientListByProjectOptions) (resp azfake.PagerResponder[armdevcenter.ImageVersionsClientListByProjectResponse]) } // NewImageVersionsServerTransport creates a new instance of ImageVersionsServerTransport with the provided implementation. @@ -38,16 +46,18 @@ type ImageVersionsServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewImageVersionsServerTransport(srv *ImageVersionsServer) *ImageVersionsServerTransport { return &ImageVersionsServerTransport{ - srv: srv, - newListByImagePager: newTracker[azfake.PagerResponder[armdevcenter.ImageVersionsClientListByImageResponse]](), + srv: srv, + newListByImagePager: newTracker[azfake.PagerResponder[armdevcenter.ImageVersionsClientListByImageResponse]](), + newListByProjectPager: newTracker[azfake.PagerResponder[armdevcenter.ImageVersionsClientListByProjectResponse]](), } } // ImageVersionsServerTransport connects instances of armdevcenter.ImageVersionsClient to instances of ImageVersionsServer. // Don't use this type directly, use NewImageVersionsServerTransport instead. type ImageVersionsServerTransport struct { - srv *ImageVersionsServer - newListByImagePager *tracker[azfake.PagerResponder[armdevcenter.ImageVersionsClientListByImageResponse]] + srv *ImageVersionsServer + newListByImagePager *tracker[azfake.PagerResponder[armdevcenter.ImageVersionsClientListByImageResponse]] + newListByProjectPager *tracker[azfake.PagerResponder[armdevcenter.ImageVersionsClientListByProjectResponse]] } // Do implements the policy.Transporter interface for ImageVersionsServerTransport. @@ -64,8 +74,12 @@ func (i *ImageVersionsServerTransport) Do(req *http.Request) (*http.Response, er switch method { case "ImageVersionsClient.Get": resp, err = i.dispatchGet(req) + case "ImageVersionsClient.GetByProject": + resp, err = i.dispatchGetByProject(req) case "ImageVersionsClient.NewListByImagePager": resp, err = i.dispatchNewListByImagePager(req) + case "ImageVersionsClient.NewListByProjectPager": + resp, err = i.dispatchNewListByProjectPager(req) default: err = fmt.Errorf("unhandled API %s", method) } @@ -122,6 +136,47 @@ func (i *ImageVersionsServerTransport) dispatchGet(req *http.Request) (*http.Res return resp, nil } +func (i *ImageVersionsServerTransport) dispatchGetByProject(req *http.Request) (*http.Response, error) { + if i.srv.GetByProject == nil { + return nil, &nonRetriableError{errors.New("fake for method GetByProject not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/images/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/versions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + imageNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("imageName")]) + if err != nil { + return nil, err + } + versionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("versionName")]) + if err != nil { + return nil, err + } + respr, errRespr := i.srv.GetByProject(req.Context(), resourceGroupNameParam, projectNameParam, imageNameParam, versionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ImageVersion, req) + if err != nil { + return nil, err + } + return resp, nil +} + func (i *ImageVersionsServerTransport) dispatchNewListByImagePager(req *http.Request) (*http.Response, error) { if i.srv.NewListByImagePager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListByImagePager not implemented")} @@ -170,3 +225,48 @@ func (i *ImageVersionsServerTransport) dispatchNewListByImagePager(req *http.Req } return resp, nil } + +func (i *ImageVersionsServerTransport) dispatchNewListByProjectPager(req *http.Request) (*http.Response, error) { + if i.srv.NewListByProjectPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByProjectPager not implemented")} + } + newListByProjectPager := i.newListByProjectPager.get(req) + if newListByProjectPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/images/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/versions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + imageNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("imageName")]) + if err != nil { + return nil, err + } + resp := i.srv.NewListByProjectPager(resourceGroupNameParam, projectNameParam, imageNameParam, nil) + newListByProjectPager = &resp + i.newListByProjectPager.add(req, newListByProjectPager) + server.PagerResponderInjectNextLinks(newListByProjectPager, req, func(page *armdevcenter.ImageVersionsClientListByProjectResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByProjectPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + i.newListByProjectPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByProjectPager) { + i.newListByProjectPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/fake/planmembers_server.go b/sdk/resourcemanager/devcenter/armdevcenter/fake/planmembers_server.go new file mode 100644 index 000000000000..b7d792fbf969 --- /dev/null +++ b/sdk/resourcemanager/devcenter/armdevcenter/fake/planmembers_server.go @@ -0,0 +1,354 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// PlanMembersServer is a fake server for instances of the armdevcenter.PlanMembersClient type. +type PlanMembersServer struct { + // BeginCreateOrUpdate is the fake for method PlanMembersClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, planName string, memberName string, body armdevcenter.PlanMember, options *armdevcenter.PlanMembersClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armdevcenter.PlanMembersClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method PlanMembersClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, planName string, memberName string, options *armdevcenter.PlanMembersClientBeginDeleteOptions) (resp azfake.PollerResponder[armdevcenter.PlanMembersClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method PlanMembersClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, planName string, memberName string, options *armdevcenter.PlanMembersClientGetOptions) (resp azfake.Responder[armdevcenter.PlanMembersClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method PlanMembersClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, planName string, options *armdevcenter.PlanMembersClientListOptions) (resp azfake.PagerResponder[armdevcenter.PlanMembersClientListResponse]) + + // BeginUpdate is the fake for method PlanMembersClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, planName string, memberName string, body armdevcenter.PlanMemberUpdate, options *armdevcenter.PlanMembersClientBeginUpdateOptions) (resp azfake.PollerResponder[armdevcenter.PlanMembersClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewPlanMembersServerTransport creates a new instance of PlanMembersServerTransport with the provided implementation. +// The returned PlanMembersServerTransport instance is connected to an instance of armdevcenter.PlanMembersClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPlanMembersServerTransport(srv *PlanMembersServer) *PlanMembersServerTransport { + return &PlanMembersServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armdevcenter.PlanMembersClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armdevcenter.PlanMembersClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armdevcenter.PlanMembersClientListResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armdevcenter.PlanMembersClientUpdateResponse]](), + } +} + +// PlanMembersServerTransport connects instances of armdevcenter.PlanMembersClient to instances of PlanMembersServer. +// Don't use this type directly, use NewPlanMembersServerTransport instead. +type PlanMembersServerTransport struct { + srv *PlanMembersServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armdevcenter.PlanMembersClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armdevcenter.PlanMembersClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armdevcenter.PlanMembersClientListResponse]] + beginUpdate *tracker[azfake.PollerResponder[armdevcenter.PlanMembersClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for PlanMembersServerTransport. +func (p *PlanMembersServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "PlanMembersClient.BeginCreateOrUpdate": + resp, err = p.dispatchBeginCreateOrUpdate(req) + case "PlanMembersClient.BeginDelete": + resp, err = p.dispatchBeginDelete(req) + case "PlanMembersClient.Get": + resp, err = p.dispatchGet(req) + case "PlanMembersClient.NewListPager": + resp, err = p.dispatchNewListPager(req) + case "PlanMembersClient.BeginUpdate": + resp, err = p.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (p *PlanMembersServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if p.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := p.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/plans/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/members/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdevcenter.PlanMember](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + planNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planName")]) + if err != nil { + return nil, err + } + memberNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("memberName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, planNameParam, memberNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + p.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + p.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + p.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (p *PlanMembersServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if p.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := p.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/plans/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/members/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + planNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planName")]) + if err != nil { + return nil, err + } + memberNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("memberName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, planNameParam, memberNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + p.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + p.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + p.beginDelete.remove(req) + } + + return resp, nil +} + +func (p *PlanMembersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/plans/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/members/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + planNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planName")]) + if err != nil { + return nil, err + } + memberNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("memberName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, planNameParam, memberNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PlanMember, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PlanMembersServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := p.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/plans/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/members` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + planNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planName")]) + if err != nil { + return nil, err + } + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armdevcenter.PlanMembersClientListOptions + if topParam != nil { + options = &armdevcenter.PlanMembersClientListOptions{ + Top: topParam, + } + } + resp := p.srv.NewListPager(resourceGroupNameParam, planNameParam, options) + newListPager = &resp + p.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armdevcenter.PlanMembersClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + p.newListPager.remove(req) + } + return resp, nil +} + +func (p *PlanMembersServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if p.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := p.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/plans/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/members/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdevcenter.PlanMemberUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + planNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planName")]) + if err != nil { + return nil, err + } + memberNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("memberName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginUpdate(req.Context(), resourceGroupNameParam, planNameParam, memberNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + p.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + p.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + p.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/fake/plans_server.go b/sdk/resourcemanager/devcenter/armdevcenter/fake/plans_server.go new file mode 100644 index 000000000000..f4b5defcbf25 --- /dev/null +++ b/sdk/resourcemanager/devcenter/armdevcenter/fake/plans_server.go @@ -0,0 +1,396 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// PlansServer is a fake server for instances of the armdevcenter.PlansClient type. +type PlansServer struct { + // BeginCreateOrUpdate is the fake for method PlansClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, planName string, body armdevcenter.Plan, options *armdevcenter.PlansClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armdevcenter.PlansClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method PlansClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, planName string, options *armdevcenter.PlansClientBeginDeleteOptions) (resp azfake.PollerResponder[armdevcenter.PlansClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method PlansClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, planName string, options *armdevcenter.PlansClientGetOptions) (resp azfake.Responder[armdevcenter.PlansClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method PlansClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armdevcenter.PlansClientListByResourceGroupOptions) (resp azfake.PagerResponder[armdevcenter.PlansClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method PlansClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armdevcenter.PlansClientListBySubscriptionOptions) (resp azfake.PagerResponder[armdevcenter.PlansClientListBySubscriptionResponse]) + + // BeginUpdate is the fake for method PlansClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, planName string, body armdevcenter.PlanUpdate, options *armdevcenter.PlansClientBeginUpdateOptions) (resp azfake.PollerResponder[armdevcenter.PlansClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewPlansServerTransport creates a new instance of PlansServerTransport with the provided implementation. +// The returned PlansServerTransport instance is connected to an instance of armdevcenter.PlansClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPlansServerTransport(srv *PlansServer) *PlansServerTransport { + return &PlansServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armdevcenter.PlansClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armdevcenter.PlansClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armdevcenter.PlansClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armdevcenter.PlansClientListBySubscriptionResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armdevcenter.PlansClientUpdateResponse]](), + } +} + +// PlansServerTransport connects instances of armdevcenter.PlansClient to instances of PlansServer. +// Don't use this type directly, use NewPlansServerTransport instead. +type PlansServerTransport struct { + srv *PlansServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armdevcenter.PlansClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armdevcenter.PlansClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armdevcenter.PlansClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armdevcenter.PlansClientListBySubscriptionResponse]] + beginUpdate *tracker[azfake.PollerResponder[armdevcenter.PlansClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for PlansServerTransport. +func (p *PlansServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "PlansClient.BeginCreateOrUpdate": + resp, err = p.dispatchBeginCreateOrUpdate(req) + case "PlansClient.BeginDelete": + resp, err = p.dispatchBeginDelete(req) + case "PlansClient.Get": + resp, err = p.dispatchGet(req) + case "PlansClient.NewListByResourceGroupPager": + resp, err = p.dispatchNewListByResourceGroupPager(req) + case "PlansClient.NewListBySubscriptionPager": + resp, err = p.dispatchNewListBySubscriptionPager(req) + case "PlansClient.BeginUpdate": + resp, err = p.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (p *PlansServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if p.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := p.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/plans/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdevcenter.Plan](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + planNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, planNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + p.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + p.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + p.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (p *PlansServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if p.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := p.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/plans/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + planNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, planNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + p.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + p.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + p.beginDelete.remove(req) + } + + return resp, nil +} + +func (p *PlansServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/plans/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + planNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, planNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Plan, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PlansServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := p.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/plans` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armdevcenter.PlansClientListByResourceGroupOptions + if topParam != nil { + options = &armdevcenter.PlansClientListByResourceGroupOptions{ + Top: topParam, + } + } + resp := p.srv.NewListByResourceGroupPager(resourceGroupNameParam, options) + newListByResourceGroupPager = &resp + p.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armdevcenter.PlansClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + p.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (p *PlansServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := p.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/plans` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armdevcenter.PlansClientListBySubscriptionOptions + if topParam != nil { + options = &armdevcenter.PlansClientListBySubscriptionOptions{ + Top: topParam, + } + } + resp := p.srv.NewListBySubscriptionPager(options) + newListBySubscriptionPager = &resp + p.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armdevcenter.PlansClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + p.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (p *PlansServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if p.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := p.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/plans/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdevcenter.PlanUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + planNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginUpdate(req.Context(), resourceGroupNameParam, planNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + p.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + p.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + p.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/fake/projectcatalogimagedefinitionbuild_server.go b/sdk/resourcemanager/devcenter/armdevcenter/fake/projectcatalogimagedefinitionbuild_server.go new file mode 100644 index 000000000000..a59f82ee0563 --- /dev/null +++ b/sdk/resourcemanager/devcenter/armdevcenter/fake/projectcatalogimagedefinitionbuild_server.go @@ -0,0 +1,229 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter/v2" + "net/http" + "net/url" + "regexp" +) + +// ProjectCatalogImageDefinitionBuildServer is a fake server for instances of the armdevcenter.ProjectCatalogImageDefinitionBuildClient type. +type ProjectCatalogImageDefinitionBuildServer struct { + // BeginCancel is the fake for method ProjectCatalogImageDefinitionBuildClient.BeginCancel + // HTTP status codes to indicate success: http.StatusAccepted + BeginCancel func(ctx context.Context, resourceGroupName string, projectName string, catalogName string, imageDefinitionName string, buildName string, options *armdevcenter.ProjectCatalogImageDefinitionBuildClientBeginCancelOptions) (resp azfake.PollerResponder[armdevcenter.ProjectCatalogImageDefinitionBuildClientCancelResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ProjectCatalogImageDefinitionBuildClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, projectName string, catalogName string, imageDefinitionName string, buildName string, options *armdevcenter.ProjectCatalogImageDefinitionBuildClientGetOptions) (resp azfake.Responder[armdevcenter.ProjectCatalogImageDefinitionBuildClientGetResponse], errResp azfake.ErrorResponder) + + // GetBuildDetails is the fake for method ProjectCatalogImageDefinitionBuildClient.GetBuildDetails + // HTTP status codes to indicate success: http.StatusOK + GetBuildDetails func(ctx context.Context, resourceGroupName string, projectName string, catalogName string, imageDefinitionName string, buildName string, options *armdevcenter.ProjectCatalogImageDefinitionBuildClientGetBuildDetailsOptions) (resp azfake.Responder[armdevcenter.ProjectCatalogImageDefinitionBuildClientGetBuildDetailsResponse], errResp azfake.ErrorResponder) +} + +// NewProjectCatalogImageDefinitionBuildServerTransport creates a new instance of ProjectCatalogImageDefinitionBuildServerTransport with the provided implementation. +// The returned ProjectCatalogImageDefinitionBuildServerTransport instance is connected to an instance of armdevcenter.ProjectCatalogImageDefinitionBuildClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewProjectCatalogImageDefinitionBuildServerTransport(srv *ProjectCatalogImageDefinitionBuildServer) *ProjectCatalogImageDefinitionBuildServerTransport { + return &ProjectCatalogImageDefinitionBuildServerTransport{ + srv: srv, + beginCancel: newTracker[azfake.PollerResponder[armdevcenter.ProjectCatalogImageDefinitionBuildClientCancelResponse]](), + } +} + +// ProjectCatalogImageDefinitionBuildServerTransport connects instances of armdevcenter.ProjectCatalogImageDefinitionBuildClient to instances of ProjectCatalogImageDefinitionBuildServer. +// Don't use this type directly, use NewProjectCatalogImageDefinitionBuildServerTransport instead. +type ProjectCatalogImageDefinitionBuildServerTransport struct { + srv *ProjectCatalogImageDefinitionBuildServer + beginCancel *tracker[azfake.PollerResponder[armdevcenter.ProjectCatalogImageDefinitionBuildClientCancelResponse]] +} + +// Do implements the policy.Transporter interface for ProjectCatalogImageDefinitionBuildServerTransport. +func (p *ProjectCatalogImageDefinitionBuildServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ProjectCatalogImageDefinitionBuildClient.BeginCancel": + resp, err = p.dispatchBeginCancel(req) + case "ProjectCatalogImageDefinitionBuildClient.Get": + resp, err = p.dispatchGet(req) + case "ProjectCatalogImageDefinitionBuildClient.GetBuildDetails": + resp, err = p.dispatchGetBuildDetails(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (p *ProjectCatalogImageDefinitionBuildServerTransport) dispatchBeginCancel(req *http.Request) (*http.Response, error) { + if p.srv.BeginCancel == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCancel not implemented")} + } + beginCancel := p.beginCancel.get(req) + if beginCancel == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/catalogs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/imageDefinitions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/builds/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cancel` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 6 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + catalogNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("catalogName")]) + if err != nil { + return nil, err + } + imageDefinitionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("imageDefinitionName")]) + if err != nil { + return nil, err + } + buildNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("buildName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginCancel(req.Context(), resourceGroupNameParam, projectNameParam, catalogNameParam, imageDefinitionNameParam, buildNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCancel = &respr + p.beginCancel.add(req, beginCancel) + } + + resp, err := server.PollerResponderNext(beginCancel, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + p.beginCancel.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCancel) { + p.beginCancel.remove(req) + } + + return resp, nil +} + +func (p *ProjectCatalogImageDefinitionBuildServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/catalogs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/imageDefinitions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/builds/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 6 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + catalogNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("catalogName")]) + if err != nil { + return nil, err + } + imageDefinitionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("imageDefinitionName")]) + if err != nil { + return nil, err + } + buildNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("buildName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, projectNameParam, catalogNameParam, imageDefinitionNameParam, buildNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ImageDefinitionBuild, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *ProjectCatalogImageDefinitionBuildServerTransport) dispatchGetBuildDetails(req *http.Request) (*http.Response, error) { + if p.srv.GetBuildDetails == nil { + return nil, &nonRetriableError{errors.New("fake for method GetBuildDetails not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/catalogs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/imageDefinitions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/builds/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getBuildDetails` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 6 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + catalogNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("catalogName")]) + if err != nil { + return nil, err + } + imageDefinitionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("imageDefinitionName")]) + if err != nil { + return nil, err + } + buildNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("buildName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.GetBuildDetails(req.Context(), resourceGroupNameParam, projectNameParam, catalogNameParam, imageDefinitionNameParam, buildNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ImageDefinitionBuildDetails, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/fake/projectcatalogimagedefinitionbuilds_server.go b/sdk/resourcemanager/devcenter/armdevcenter/fake/projectcatalogimagedefinitionbuilds_server.go new file mode 100644 index 000000000000..95e61efbb9b2 --- /dev/null +++ b/sdk/resourcemanager/devcenter/armdevcenter/fake/projectcatalogimagedefinitionbuilds_server.go @@ -0,0 +1,120 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter/v2" + "net/http" + "net/url" + "regexp" +) + +// ProjectCatalogImageDefinitionBuildsServer is a fake server for instances of the armdevcenter.ProjectCatalogImageDefinitionBuildsClient type. +type ProjectCatalogImageDefinitionBuildsServer struct { + // NewListByImageDefinitionPager is the fake for method ProjectCatalogImageDefinitionBuildsClient.NewListByImageDefinitionPager + // HTTP status codes to indicate success: http.StatusOK + NewListByImageDefinitionPager func(resourceGroupName string, projectName string, catalogName string, imageDefinitionName string, options *armdevcenter.ProjectCatalogImageDefinitionBuildsClientListByImageDefinitionOptions) (resp azfake.PagerResponder[armdevcenter.ProjectCatalogImageDefinitionBuildsClientListByImageDefinitionResponse]) +} + +// NewProjectCatalogImageDefinitionBuildsServerTransport creates a new instance of ProjectCatalogImageDefinitionBuildsServerTransport with the provided implementation. +// The returned ProjectCatalogImageDefinitionBuildsServerTransport instance is connected to an instance of armdevcenter.ProjectCatalogImageDefinitionBuildsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewProjectCatalogImageDefinitionBuildsServerTransport(srv *ProjectCatalogImageDefinitionBuildsServer) *ProjectCatalogImageDefinitionBuildsServerTransport { + return &ProjectCatalogImageDefinitionBuildsServerTransport{ + srv: srv, + newListByImageDefinitionPager: newTracker[azfake.PagerResponder[armdevcenter.ProjectCatalogImageDefinitionBuildsClientListByImageDefinitionResponse]](), + } +} + +// ProjectCatalogImageDefinitionBuildsServerTransport connects instances of armdevcenter.ProjectCatalogImageDefinitionBuildsClient to instances of ProjectCatalogImageDefinitionBuildsServer. +// Don't use this type directly, use NewProjectCatalogImageDefinitionBuildsServerTransport instead. +type ProjectCatalogImageDefinitionBuildsServerTransport struct { + srv *ProjectCatalogImageDefinitionBuildsServer + newListByImageDefinitionPager *tracker[azfake.PagerResponder[armdevcenter.ProjectCatalogImageDefinitionBuildsClientListByImageDefinitionResponse]] +} + +// Do implements the policy.Transporter interface for ProjectCatalogImageDefinitionBuildsServerTransport. +func (p *ProjectCatalogImageDefinitionBuildsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ProjectCatalogImageDefinitionBuildsClient.NewListByImageDefinitionPager": + resp, err = p.dispatchNewListByImageDefinitionPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (p *ProjectCatalogImageDefinitionBuildsServerTransport) dispatchNewListByImageDefinitionPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListByImageDefinitionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByImageDefinitionPager not implemented")} + } + newListByImageDefinitionPager := p.newListByImageDefinitionPager.get(req) + if newListByImageDefinitionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/catalogs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/imageDefinitions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/builds` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + catalogNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("catalogName")]) + if err != nil { + return nil, err + } + imageDefinitionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("imageDefinitionName")]) + if err != nil { + return nil, err + } + resp := p.srv.NewListByImageDefinitionPager(resourceGroupNameParam, projectNameParam, catalogNameParam, imageDefinitionNameParam, nil) + newListByImageDefinitionPager = &resp + p.newListByImageDefinitionPager.add(req, newListByImageDefinitionPager) + server.PagerResponderInjectNextLinks(newListByImageDefinitionPager, req, func(page *armdevcenter.ProjectCatalogImageDefinitionBuildsClientListByImageDefinitionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByImageDefinitionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListByImageDefinitionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByImageDefinitionPager) { + p.newListByImageDefinitionPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/fake/projectcatalogimagedefinitions_server.go b/sdk/resourcemanager/devcenter/armdevcenter/fake/projectcatalogimagedefinitions_server.go new file mode 100644 index 000000000000..792a65f5f6fa --- /dev/null +++ b/sdk/resourcemanager/devcenter/armdevcenter/fake/projectcatalogimagedefinitions_server.go @@ -0,0 +1,246 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// ProjectCatalogImageDefinitionsServer is a fake server for instances of the armdevcenter.ProjectCatalogImageDefinitionsClient type. +type ProjectCatalogImageDefinitionsServer struct { + // BeginBuildImage is the fake for method ProjectCatalogImageDefinitionsClient.BeginBuildImage + // HTTP status codes to indicate success: http.StatusAccepted + BeginBuildImage func(ctx context.Context, resourceGroupName string, projectName string, catalogName string, imageDefinitionName string, options *armdevcenter.ProjectCatalogImageDefinitionsClientBeginBuildImageOptions) (resp azfake.PollerResponder[armdevcenter.ProjectCatalogImageDefinitionsClientBuildImageResponse], errResp azfake.ErrorResponder) + + // GetByProjectCatalog is the fake for method ProjectCatalogImageDefinitionsClient.GetByProjectCatalog + // HTTP status codes to indicate success: http.StatusOK + GetByProjectCatalog func(ctx context.Context, resourceGroupName string, projectName string, catalogName string, imageDefinitionName string, options *armdevcenter.ProjectCatalogImageDefinitionsClientGetByProjectCatalogOptions) (resp azfake.Responder[armdevcenter.ProjectCatalogImageDefinitionsClientGetByProjectCatalogResponse], errResp azfake.ErrorResponder) + + // NewListByProjectCatalogPager is the fake for method ProjectCatalogImageDefinitionsClient.NewListByProjectCatalogPager + // HTTP status codes to indicate success: http.StatusOK + NewListByProjectCatalogPager func(resourceGroupName string, projectName string, catalogName string, options *armdevcenter.ProjectCatalogImageDefinitionsClientListByProjectCatalogOptions) (resp azfake.PagerResponder[armdevcenter.ProjectCatalogImageDefinitionsClientListByProjectCatalogResponse]) +} + +// NewProjectCatalogImageDefinitionsServerTransport creates a new instance of ProjectCatalogImageDefinitionsServerTransport with the provided implementation. +// The returned ProjectCatalogImageDefinitionsServerTransport instance is connected to an instance of armdevcenter.ProjectCatalogImageDefinitionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewProjectCatalogImageDefinitionsServerTransport(srv *ProjectCatalogImageDefinitionsServer) *ProjectCatalogImageDefinitionsServerTransport { + return &ProjectCatalogImageDefinitionsServerTransport{ + srv: srv, + beginBuildImage: newTracker[azfake.PollerResponder[armdevcenter.ProjectCatalogImageDefinitionsClientBuildImageResponse]](), + newListByProjectCatalogPager: newTracker[azfake.PagerResponder[armdevcenter.ProjectCatalogImageDefinitionsClientListByProjectCatalogResponse]](), + } +} + +// ProjectCatalogImageDefinitionsServerTransport connects instances of armdevcenter.ProjectCatalogImageDefinitionsClient to instances of ProjectCatalogImageDefinitionsServer. +// Don't use this type directly, use NewProjectCatalogImageDefinitionsServerTransport instead. +type ProjectCatalogImageDefinitionsServerTransport struct { + srv *ProjectCatalogImageDefinitionsServer + beginBuildImage *tracker[azfake.PollerResponder[armdevcenter.ProjectCatalogImageDefinitionsClientBuildImageResponse]] + newListByProjectCatalogPager *tracker[azfake.PagerResponder[armdevcenter.ProjectCatalogImageDefinitionsClientListByProjectCatalogResponse]] +} + +// Do implements the policy.Transporter interface for ProjectCatalogImageDefinitionsServerTransport. +func (p *ProjectCatalogImageDefinitionsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ProjectCatalogImageDefinitionsClient.BeginBuildImage": + resp, err = p.dispatchBeginBuildImage(req) + case "ProjectCatalogImageDefinitionsClient.GetByProjectCatalog": + resp, err = p.dispatchGetByProjectCatalog(req) + case "ProjectCatalogImageDefinitionsClient.NewListByProjectCatalogPager": + resp, err = p.dispatchNewListByProjectCatalogPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (p *ProjectCatalogImageDefinitionsServerTransport) dispatchBeginBuildImage(req *http.Request) (*http.Response, error) { + if p.srv.BeginBuildImage == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginBuildImage not implemented")} + } + beginBuildImage := p.beginBuildImage.get(req) + if beginBuildImage == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/catalogs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/imageDefinitions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/buildImage` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + catalogNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("catalogName")]) + if err != nil { + return nil, err + } + imageDefinitionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("imageDefinitionName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginBuildImage(req.Context(), resourceGroupNameParam, projectNameParam, catalogNameParam, imageDefinitionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginBuildImage = &respr + p.beginBuildImage.add(req, beginBuildImage) + } + + resp, err := server.PollerResponderNext(beginBuildImage, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + p.beginBuildImage.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginBuildImage) { + p.beginBuildImage.remove(req) + } + + return resp, nil +} + +func (p *ProjectCatalogImageDefinitionsServerTransport) dispatchGetByProjectCatalog(req *http.Request) (*http.Response, error) { + if p.srv.GetByProjectCatalog == nil { + return nil, &nonRetriableError{errors.New("fake for method GetByProjectCatalog not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/catalogs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/imageDefinitions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + catalogNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("catalogName")]) + if err != nil { + return nil, err + } + imageDefinitionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("imageDefinitionName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.GetByProjectCatalog(req.Context(), resourceGroupNameParam, projectNameParam, catalogNameParam, imageDefinitionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ImageDefinition, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *ProjectCatalogImageDefinitionsServerTransport) dispatchNewListByProjectCatalogPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListByProjectCatalogPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByProjectCatalogPager not implemented")} + } + newListByProjectCatalogPager := p.newListByProjectCatalogPager.get(req) + if newListByProjectCatalogPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/catalogs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/imageDefinitions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + catalogNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("catalogName")]) + if err != nil { + return nil, err + } + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armdevcenter.ProjectCatalogImageDefinitionsClientListByProjectCatalogOptions + if topParam != nil { + options = &armdevcenter.ProjectCatalogImageDefinitionsClientListByProjectCatalogOptions{ + Top: topParam, + } + } + resp := p.srv.NewListByProjectCatalogPager(resourceGroupNameParam, projectNameParam, catalogNameParam, options) + newListByProjectCatalogPager = &resp + p.newListByProjectCatalogPager.add(req, newListByProjectCatalogPager) + server.PagerResponderInjectNextLinks(newListByProjectCatalogPager, req, func(page *armdevcenter.ProjectCatalogImageDefinitionsClientListByProjectCatalogResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByProjectCatalogPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListByProjectCatalogPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByProjectCatalogPager) { + p.newListByProjectCatalogPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/fake/projectpolicies_server.go b/sdk/resourcemanager/devcenter/armdevcenter/fake/projectpolicies_server.go new file mode 100644 index 000000000000..2b9ea66d3518 --- /dev/null +++ b/sdk/resourcemanager/devcenter/armdevcenter/fake/projectpolicies_server.go @@ -0,0 +1,354 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// ProjectPoliciesServer is a fake server for instances of the armdevcenter.ProjectPoliciesClient type. +type ProjectPoliciesServer struct { + // BeginCreateOrUpdate is the fake for method ProjectPoliciesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, devCenterName string, projectPolicyName string, body armdevcenter.ProjectPolicy, options *armdevcenter.ProjectPoliciesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armdevcenter.ProjectPoliciesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method ProjectPoliciesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, devCenterName string, projectPolicyName string, options *armdevcenter.ProjectPoliciesClientBeginDeleteOptions) (resp azfake.PollerResponder[armdevcenter.ProjectPoliciesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ProjectPoliciesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, devCenterName string, projectPolicyName string, options *armdevcenter.ProjectPoliciesClientGetOptions) (resp azfake.Responder[armdevcenter.ProjectPoliciesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByDevCenterPager is the fake for method ProjectPoliciesClient.NewListByDevCenterPager + // HTTP status codes to indicate success: http.StatusOK + NewListByDevCenterPager func(resourceGroupName string, devCenterName string, options *armdevcenter.ProjectPoliciesClientListByDevCenterOptions) (resp azfake.PagerResponder[armdevcenter.ProjectPoliciesClientListByDevCenterResponse]) + + // BeginUpdate is the fake for method ProjectPoliciesClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, devCenterName string, projectPolicyName string, body armdevcenter.ProjectPolicyUpdate, options *armdevcenter.ProjectPoliciesClientBeginUpdateOptions) (resp azfake.PollerResponder[armdevcenter.ProjectPoliciesClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewProjectPoliciesServerTransport creates a new instance of ProjectPoliciesServerTransport with the provided implementation. +// The returned ProjectPoliciesServerTransport instance is connected to an instance of armdevcenter.ProjectPoliciesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewProjectPoliciesServerTransport(srv *ProjectPoliciesServer) *ProjectPoliciesServerTransport { + return &ProjectPoliciesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armdevcenter.ProjectPoliciesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armdevcenter.ProjectPoliciesClientDeleteResponse]](), + newListByDevCenterPager: newTracker[azfake.PagerResponder[armdevcenter.ProjectPoliciesClientListByDevCenterResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armdevcenter.ProjectPoliciesClientUpdateResponse]](), + } +} + +// ProjectPoliciesServerTransport connects instances of armdevcenter.ProjectPoliciesClient to instances of ProjectPoliciesServer. +// Don't use this type directly, use NewProjectPoliciesServerTransport instead. +type ProjectPoliciesServerTransport struct { + srv *ProjectPoliciesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armdevcenter.ProjectPoliciesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armdevcenter.ProjectPoliciesClientDeleteResponse]] + newListByDevCenterPager *tracker[azfake.PagerResponder[armdevcenter.ProjectPoliciesClientListByDevCenterResponse]] + beginUpdate *tracker[azfake.PollerResponder[armdevcenter.ProjectPoliciesClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for ProjectPoliciesServerTransport. +func (p *ProjectPoliciesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ProjectPoliciesClient.BeginCreateOrUpdate": + resp, err = p.dispatchBeginCreateOrUpdate(req) + case "ProjectPoliciesClient.BeginDelete": + resp, err = p.dispatchBeginDelete(req) + case "ProjectPoliciesClient.Get": + resp, err = p.dispatchGet(req) + case "ProjectPoliciesClient.NewListByDevCenterPager": + resp, err = p.dispatchNewListByDevCenterPager(req) + case "ProjectPoliciesClient.BeginUpdate": + resp, err = p.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (p *ProjectPoliciesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if p.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := p.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/devcenters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projectPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdevcenter.ProjectPolicy](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + devCenterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("devCenterName")]) + if err != nil { + return nil, err + } + projectPolicyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectPolicyName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, devCenterNameParam, projectPolicyNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + p.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + p.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + p.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (p *ProjectPoliciesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if p.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := p.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/devcenters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projectPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + devCenterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("devCenterName")]) + if err != nil { + return nil, err + } + projectPolicyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectPolicyName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, devCenterNameParam, projectPolicyNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + p.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + p.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + p.beginDelete.remove(req) + } + + return resp, nil +} + +func (p *ProjectPoliciesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/devcenters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projectPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + devCenterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("devCenterName")]) + if err != nil { + return nil, err + } + projectPolicyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectPolicyName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, devCenterNameParam, projectPolicyNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ProjectPolicy, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *ProjectPoliciesServerTransport) dispatchNewListByDevCenterPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListByDevCenterPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByDevCenterPager not implemented")} + } + newListByDevCenterPager := p.newListByDevCenterPager.get(req) + if newListByDevCenterPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/devcenters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projectPolicies` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + devCenterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("devCenterName")]) + if err != nil { + return nil, err + } + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armdevcenter.ProjectPoliciesClientListByDevCenterOptions + if topParam != nil { + options = &armdevcenter.ProjectPoliciesClientListByDevCenterOptions{ + Top: topParam, + } + } + resp := p.srv.NewListByDevCenterPager(resourceGroupNameParam, devCenterNameParam, options) + newListByDevCenterPager = &resp + p.newListByDevCenterPager.add(req, newListByDevCenterPager) + server.PagerResponderInjectNextLinks(newListByDevCenterPager, req, func(page *armdevcenter.ProjectPoliciesClientListByDevCenterResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByDevCenterPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListByDevCenterPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByDevCenterPager) { + p.newListByDevCenterPager.remove(req) + } + return resp, nil +} + +func (p *ProjectPoliciesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if p.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := p.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/devcenters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projectPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdevcenter.ProjectPolicyUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + devCenterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("devCenterName")]) + if err != nil { + return nil, err + } + projectPolicyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectPolicyName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginUpdate(req.Context(), resourceGroupNameParam, devCenterNameParam, projectPolicyNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + p.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + p.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + p.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/fake/projects_server.go b/sdk/resourcemanager/devcenter/armdevcenter/fake/projects_server.go index 2b790318a972..19ea8a10b873 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/fake/projects_server.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/fake/projects_server.go @@ -37,6 +37,10 @@ type ProjectsServer struct { // HTTP status codes to indicate success: http.StatusOK Get func(ctx context.Context, resourceGroupName string, projectName string, options *armdevcenter.ProjectsClientGetOptions) (resp azfake.Responder[armdevcenter.ProjectsClientGetResponse], errResp azfake.ErrorResponder) + // GetInheritedSettings is the fake for method ProjectsClient.GetInheritedSettings + // HTTP status codes to indicate success: http.StatusOK + GetInheritedSettings func(ctx context.Context, resourceGroupName string, projectName string, options *armdevcenter.ProjectsClientGetInheritedSettingsOptions) (resp azfake.Responder[armdevcenter.ProjectsClientGetInheritedSettingsResponse], errResp azfake.ErrorResponder) + // NewListByResourceGroupPager is the fake for method ProjectsClient.NewListByResourceGroupPager // HTTP status codes to indicate success: http.StatusOK NewListByResourceGroupPager func(resourceGroupName string, options *armdevcenter.ProjectsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armdevcenter.ProjectsClientListByResourceGroupResponse]) @@ -93,6 +97,8 @@ func (p *ProjectsServerTransport) Do(req *http.Request) (*http.Response, error) resp, err = p.dispatchBeginDelete(req) case "ProjectsClient.Get": resp, err = p.dispatchGet(req) + case "ProjectsClient.GetInheritedSettings": + resp, err = p.dispatchGetInheritedSettings(req) case "ProjectsClient.NewListByResourceGroupPager": resp, err = p.dispatchNewListByResourceGroupPager(req) case "ProjectsClient.NewListBySubscriptionPager": @@ -235,6 +241,39 @@ func (p *ProjectsServerTransport) dispatchGet(req *http.Request) (*http.Response return resp, nil } +func (p *ProjectsServerTransport) dispatchGetInheritedSettings(req *http.Request) (*http.Response, error) { + if p.srv.GetInheritedSettings == nil { + return nil, &nonRetriableError{errors.New("fake for method GetInheritedSettings not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getInheritedSettings` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.GetInheritedSettings(req.Context(), resourceGroupNameParam, projectNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).InheritedSettingsForProject, req) + if err != nil { + return nil, err + } + return resp, nil +} + func (p *ProjectsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { if p.srv.NewListByResourceGroupPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/fake/server_factory.go b/sdk/resourcemanager/devcenter/armdevcenter/fake/server_factory.go index f3ec1e974455..dd012ca03867 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/fake/server_factory.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/fake/server_factory.go @@ -23,8 +23,11 @@ type ServerFactory struct { CatalogsServer CatalogsServer CheckNameAvailabilityServer CheckNameAvailabilityServer CheckScopedNameAvailabilityServer CheckScopedNameAvailabilityServer + CurationProfilesServer CurationProfilesServer + CustomizationTasksServer CustomizationTasksServer DevBoxDefinitionsServer DevBoxDefinitionsServer DevCentersServer DevCentersServer + EncryptionSetsServer EncryptionSetsServer EnvironmentDefinitionsServer EnvironmentDefinitionsServer EnvironmentTypesServer EnvironmentTypesServer GalleriesServer GalleriesServer @@ -33,11 +36,17 @@ type ServerFactory struct { NetworkConnectionsServer NetworkConnectionsServer OperationStatusesServer OperationStatusesServer OperationsServer OperationsServer + PlanMembersServer PlanMembersServer + PlansServer PlansServer PoolsServer PoolsServer ProjectAllowedEnvironmentTypesServer ProjectAllowedEnvironmentTypesServer ProjectCatalogEnvironmentDefinitionsServer ProjectCatalogEnvironmentDefinitionsServer + ProjectCatalogImageDefinitionBuildServer ProjectCatalogImageDefinitionBuildServer + ProjectCatalogImageDefinitionBuildsServer ProjectCatalogImageDefinitionBuildsServer + ProjectCatalogImageDefinitionsServer ProjectCatalogImageDefinitionsServer ProjectCatalogsServer ProjectCatalogsServer ProjectEnvironmentTypesServer ProjectEnvironmentTypesServer + ProjectPoliciesServer ProjectPoliciesServer ProjectsServer ProjectsServer SKUsServer SKUsServer SchedulesServer SchedulesServer @@ -62,8 +71,11 @@ type ServerFactoryTransport struct { trCatalogsServer *CatalogsServerTransport trCheckNameAvailabilityServer *CheckNameAvailabilityServerTransport trCheckScopedNameAvailabilityServer *CheckScopedNameAvailabilityServerTransport + trCurationProfilesServer *CurationProfilesServerTransport + trCustomizationTasksServer *CustomizationTasksServerTransport trDevBoxDefinitionsServer *DevBoxDefinitionsServerTransport trDevCentersServer *DevCentersServerTransport + trEncryptionSetsServer *EncryptionSetsServerTransport trEnvironmentDefinitionsServer *EnvironmentDefinitionsServerTransport trEnvironmentTypesServer *EnvironmentTypesServerTransport trGalleriesServer *GalleriesServerTransport @@ -72,11 +84,17 @@ type ServerFactoryTransport struct { trNetworkConnectionsServer *NetworkConnectionsServerTransport trOperationStatusesServer *OperationStatusesServerTransport trOperationsServer *OperationsServerTransport + trPlanMembersServer *PlanMembersServerTransport + trPlansServer *PlansServerTransport trPoolsServer *PoolsServerTransport trProjectAllowedEnvironmentTypesServer *ProjectAllowedEnvironmentTypesServerTransport trProjectCatalogEnvironmentDefinitionsServer *ProjectCatalogEnvironmentDefinitionsServerTransport + trProjectCatalogImageDefinitionBuildServer *ProjectCatalogImageDefinitionBuildServerTransport + trProjectCatalogImageDefinitionBuildsServer *ProjectCatalogImageDefinitionBuildsServerTransport + trProjectCatalogImageDefinitionsServer *ProjectCatalogImageDefinitionsServerTransport trProjectCatalogsServer *ProjectCatalogsServerTransport trProjectEnvironmentTypesServer *ProjectEnvironmentTypesServerTransport + trProjectPoliciesServer *ProjectPoliciesServerTransport trProjectsServer *ProjectsServerTransport trSKUsServer *SKUsServerTransport trSchedulesServer *SchedulesServerTransport @@ -114,6 +132,16 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewCheckScopedNameAvailabilityServerTransport(&s.srv.CheckScopedNameAvailabilityServer) }) resp, err = s.trCheckScopedNameAvailabilityServer.Do(req) + case "CurationProfilesClient": + initServer(s, &s.trCurationProfilesServer, func() *CurationProfilesServerTransport { + return NewCurationProfilesServerTransport(&s.srv.CurationProfilesServer) + }) + resp, err = s.trCurationProfilesServer.Do(req) + case "CustomizationTasksClient": + initServer(s, &s.trCustomizationTasksServer, func() *CustomizationTasksServerTransport { + return NewCustomizationTasksServerTransport(&s.srv.CustomizationTasksServer) + }) + resp, err = s.trCustomizationTasksServer.Do(req) case "DevBoxDefinitionsClient": initServer(s, &s.trDevBoxDefinitionsServer, func() *DevBoxDefinitionsServerTransport { return NewDevBoxDefinitionsServerTransport(&s.srv.DevBoxDefinitionsServer) @@ -122,6 +150,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { case "DevCentersClient": initServer(s, &s.trDevCentersServer, func() *DevCentersServerTransport { return NewDevCentersServerTransport(&s.srv.DevCentersServer) }) resp, err = s.trDevCentersServer.Do(req) + case "EncryptionSetsClient": + initServer(s, &s.trEncryptionSetsServer, func() *EncryptionSetsServerTransport { + return NewEncryptionSetsServerTransport(&s.srv.EncryptionSetsServer) + }) + resp, err = s.trEncryptionSetsServer.Do(req) case "EnvironmentDefinitionsClient": initServer(s, &s.trEnvironmentDefinitionsServer, func() *EnvironmentDefinitionsServerTransport { return NewEnvironmentDefinitionsServerTransport(&s.srv.EnvironmentDefinitionsServer) @@ -156,6 +189,12 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { case "OperationsClient": initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) resp, err = s.trOperationsServer.Do(req) + case "PlanMembersClient": + initServer(s, &s.trPlanMembersServer, func() *PlanMembersServerTransport { return NewPlanMembersServerTransport(&s.srv.PlanMembersServer) }) + resp, err = s.trPlanMembersServer.Do(req) + case "PlansClient": + initServer(s, &s.trPlansServer, func() *PlansServerTransport { return NewPlansServerTransport(&s.srv.PlansServer) }) + resp, err = s.trPlansServer.Do(req) case "PoolsClient": initServer(s, &s.trPoolsServer, func() *PoolsServerTransport { return NewPoolsServerTransport(&s.srv.PoolsServer) }) resp, err = s.trPoolsServer.Do(req) @@ -169,6 +208,21 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewProjectCatalogEnvironmentDefinitionsServerTransport(&s.srv.ProjectCatalogEnvironmentDefinitionsServer) }) resp, err = s.trProjectCatalogEnvironmentDefinitionsServer.Do(req) + case "ProjectCatalogImageDefinitionBuildClient": + initServer(s, &s.trProjectCatalogImageDefinitionBuildServer, func() *ProjectCatalogImageDefinitionBuildServerTransport { + return NewProjectCatalogImageDefinitionBuildServerTransport(&s.srv.ProjectCatalogImageDefinitionBuildServer) + }) + resp, err = s.trProjectCatalogImageDefinitionBuildServer.Do(req) + case "ProjectCatalogImageDefinitionBuildsClient": + initServer(s, &s.trProjectCatalogImageDefinitionBuildsServer, func() *ProjectCatalogImageDefinitionBuildsServerTransport { + return NewProjectCatalogImageDefinitionBuildsServerTransport(&s.srv.ProjectCatalogImageDefinitionBuildsServer) + }) + resp, err = s.trProjectCatalogImageDefinitionBuildsServer.Do(req) + case "ProjectCatalogImageDefinitionsClient": + initServer(s, &s.trProjectCatalogImageDefinitionsServer, func() *ProjectCatalogImageDefinitionsServerTransport { + return NewProjectCatalogImageDefinitionsServerTransport(&s.srv.ProjectCatalogImageDefinitionsServer) + }) + resp, err = s.trProjectCatalogImageDefinitionsServer.Do(req) case "ProjectCatalogsClient": initServer(s, &s.trProjectCatalogsServer, func() *ProjectCatalogsServerTransport { return NewProjectCatalogsServerTransport(&s.srv.ProjectCatalogsServer) @@ -179,6 +233,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewProjectEnvironmentTypesServerTransport(&s.srv.ProjectEnvironmentTypesServer) }) resp, err = s.trProjectEnvironmentTypesServer.Do(req) + case "ProjectPoliciesClient": + initServer(s, &s.trProjectPoliciesServer, func() *ProjectPoliciesServerTransport { + return NewProjectPoliciesServerTransport(&s.srv.ProjectPoliciesServer) + }) + resp, err = s.trProjectPoliciesServer.Do(req) case "ProjectsClient": initServer(s, &s.trProjectsServer, func() *ProjectsServerTransport { return NewProjectsServerTransport(&s.srv.ProjectsServer) }) resp, err = s.trProjectsServer.Do(req) diff --git a/sdk/resourcemanager/devcenter/armdevcenter/fake/skus_server.go b/sdk/resourcemanager/devcenter/armdevcenter/fake/skus_server.go index 62f7687d805b..e0f94e342878 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/fake/skus_server.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/fake/skus_server.go @@ -24,6 +24,10 @@ import ( // SKUsServer is a fake server for instances of the armdevcenter.SKUsClient type. type SKUsServer struct { + // NewListByProjectPager is the fake for method SKUsClient.NewListByProjectPager + // HTTP status codes to indicate success: http.StatusOK + NewListByProjectPager func(resourceGroupName string, projectName string, options *armdevcenter.SKUsClientListByProjectOptions) (resp azfake.PagerResponder[armdevcenter.SKUsClientListByProjectResponse]) + // NewListBySubscriptionPager is the fake for method SKUsClient.NewListBySubscriptionPager // HTTP status codes to indicate success: http.StatusOK NewListBySubscriptionPager func(options *armdevcenter.SKUsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armdevcenter.SKUsClientListBySubscriptionResponse]) @@ -35,6 +39,7 @@ type SKUsServer struct { func NewSKUsServerTransport(srv *SKUsServer) *SKUsServerTransport { return &SKUsServerTransport{ srv: srv, + newListByProjectPager: newTracker[azfake.PagerResponder[armdevcenter.SKUsClientListByProjectResponse]](), newListBySubscriptionPager: newTracker[azfake.PagerResponder[armdevcenter.SKUsClientListBySubscriptionResponse]](), } } @@ -43,6 +48,7 @@ func NewSKUsServerTransport(srv *SKUsServer) *SKUsServerTransport { // Don't use this type directly, use NewSKUsServerTransport instead. type SKUsServerTransport struct { srv *SKUsServer + newListByProjectPager *tracker[azfake.PagerResponder[armdevcenter.SKUsClientListByProjectResponse]] newListBySubscriptionPager *tracker[azfake.PagerResponder[armdevcenter.SKUsClientListBySubscriptionResponse]] } @@ -58,6 +64,8 @@ func (s *SKUsServerTransport) Do(req *http.Request) (*http.Response, error) { var err error switch method { + case "SKUsClient.NewListByProjectPager": + resp, err = s.dispatchNewListByProjectPager(req) case "SKUsClient.NewListBySubscriptionPager": resp, err = s.dispatchNewListBySubscriptionPager(req) default: @@ -71,6 +79,47 @@ func (s *SKUsServerTransport) Do(req *http.Request) (*http.Response, error) { return resp, nil } +func (s *SKUsServerTransport) dispatchNewListByProjectPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByProjectPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByProjectPager not implemented")} + } + newListByProjectPager := s.newListByProjectPager.get(req) + if newListByProjectPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevCenter/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listSkus` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListByProjectPager(resourceGroupNameParam, projectNameParam, nil) + newListByProjectPager = &resp + s.newListByProjectPager.add(req, newListByProjectPager) + server.PagerResponderInjectNextLinks(newListByProjectPager, req, func(page *armdevcenter.SKUsClientListByProjectResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByProjectPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListByProjectPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByProjectPager) { + s.newListByProjectPager.remove(req) + } + return resp, nil +} + func (s *SKUsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { if s.srv.NewListBySubscriptionPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/galleries_client.go b/sdk/resourcemanager/devcenter/armdevcenter/galleries_client.go index f6ae211c2899..7258f2715831 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/galleries_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/galleries_client.go @@ -47,7 +47,7 @@ func NewGalleriesClient(subscriptionID string, credential azcore.TokenCredential // BeginCreateOrUpdate - Creates or updates a gallery. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - galleryName - The name of the gallery. @@ -75,7 +75,7 @@ func (client *GalleriesClient) BeginCreateOrUpdate(ctx context.Context, resource // CreateOrUpdate - Creates or updates a gallery. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *GalleriesClient) createOrUpdate(ctx context.Context, resourceGroupName string, devCenterName string, galleryName string, body Gallery, options *GalleriesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "GalleriesClient.BeginCreateOrUpdate" @@ -121,7 +121,7 @@ func (client *GalleriesClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -133,7 +133,7 @@ func (client *GalleriesClient) createOrUpdateCreateRequest(ctx context.Context, // BeginDelete - Deletes a gallery resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - galleryName - The name of the gallery. @@ -159,7 +159,7 @@ func (client *GalleriesClient) BeginDelete(ctx context.Context, resourceGroupNam // Delete - Deletes a gallery resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *GalleriesClient) deleteOperation(ctx context.Context, resourceGroupName string, devCenterName string, galleryName string, options *GalleriesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "GalleriesClient.BeginDelete" @@ -205,7 +205,7 @@ func (client *GalleriesClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -214,7 +214,7 @@ func (client *GalleriesClient) deleteCreateRequest(ctx context.Context, resource // Get - Gets a gallery // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - galleryName - The name of the gallery. @@ -265,7 +265,7 @@ func (client *GalleriesClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -282,7 +282,7 @@ func (client *GalleriesClient) getHandleResponse(resp *http.Response) (Galleries // NewListByDevCenterPager - Lists galleries for a devcenter. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - options - GalleriesClientListByDevCenterOptions contains the optional parameters for the GalleriesClient.NewListByDevCenterPager @@ -333,7 +333,7 @@ func (client *GalleriesClient) listByDevCenterCreateRequest(ctx context.Context, if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/devcenter/armdevcenter/galleries_client_example_test.go b/sdk/resourcemanager/devcenter/armdevcenter/galleries_client_example_test.go deleted file mode 100644 index d0065fda0b59..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/galleries_client_example_test.go +++ /dev/null @@ -1,184 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdevcenter_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Galleries_List.json -func ExampleGalleriesClient_NewListByDevCenterPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGalleriesClient().NewListByDevCenterPager("rg1", "Contoso", &armdevcenter.GalleriesClientListByDevCenterOptions{Top: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.GalleryListResult = armdevcenter.GalleryListResult{ - // Value: []*armdevcenter.Gallery{ - // { - // Name: to.Ptr("StandardGallery"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters/galleries"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso/galleries/default"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // CreatedBy: to.Ptr("User1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // LastModifiedBy: to.Ptr("User1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.GalleryProperties{ - // GalleryResourceID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.Compute/galleries/CentralGallery"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("StandardGallery"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters/galleries"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso/galleries/ImageGallery"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // CreatedBy: to.Ptr("User1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // LastModifiedBy: to.Ptr("User1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.GalleryProperties{ - // GalleryResourceID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.Compute/galleries/SharedGallery"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Galleries_Get.json -func ExampleGalleriesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGalleriesClient().Get(ctx, "rg1", "Contoso", "StandardGallery", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Gallery = armdevcenter.Gallery{ - // Name: to.Ptr("StandardGallery"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters/galleries"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso/galleries/StandardGallery"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // CreatedBy: to.Ptr("User1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // LastModifiedBy: to.Ptr("User1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.GalleryProperties{ - // GalleryResourceID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.Compute/galleries/StandardGallery"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Galleries_Create.json -func ExampleGalleriesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleriesClient().BeginCreateOrUpdate(ctx, "rg1", "Contoso", "StandardGallery", armdevcenter.Gallery{ - Properties: &armdevcenter.GalleryProperties{ - GalleryResourceID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.Compute/galleries/StandardGallery"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Gallery = armdevcenter.Gallery{ - // Name: to.Ptr("StandardGallery"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters/galleries"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso/galleries/StandardGallery"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // CreatedBy: to.Ptr("User1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // LastModifiedBy: to.Ptr("User1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.GalleryProperties{ - // GalleryResourceID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.Compute/galleries/StandardGallery"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Galleries_Delete.json -func ExampleGalleriesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGalleriesClient().BeginDelete(ctx, "rg1", "Contoso", "StandardGallery", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/go.mod b/sdk/resourcemanager/devcenter/armdevcenter/go.mod index 8aeababe30c0..ae7143e8bc50 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/go.mod +++ b/sdk/resourcemanager/devcenter/armdevcenter/go.mod @@ -4,7 +4,6 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 @@ -12,6 +11,7 @@ require ( ) require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/golang-jwt/jwt/v5 v5.2.1 // indirect diff --git a/sdk/resourcemanager/devcenter/armdevcenter/images_client.go b/sdk/resourcemanager/devcenter/armdevcenter/images_client.go index 1a0fb32c4870..e6995e5016c0 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/images_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/images_client.go @@ -47,7 +47,7 @@ func NewImagesClient(subscriptionID string, credential azcore.TokenCredential, o // Get - Gets a gallery image. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - galleryName - The name of the gallery. @@ -103,7 +103,7 @@ func (client *ImagesClient) getCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -118,9 +118,78 @@ func (client *ImagesClient) getHandleResponse(resp *http.Response) (ImagesClient return result, nil } +// GetByProject - Gets an image. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - projectName - The name of the project. +// - imageName - The name of the image. +// - options - ImagesClientGetByProjectOptions contains the optional parameters for the ImagesClient.GetByProject method. +func (client *ImagesClient) GetByProject(ctx context.Context, resourceGroupName string, projectName string, imageName string, options *ImagesClientGetByProjectOptions) (ImagesClientGetByProjectResponse, error) { + var err error + const operationName = "ImagesClient.GetByProject" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getByProjectCreateRequest(ctx, resourceGroupName, projectName, imageName, options) + if err != nil { + return ImagesClientGetByProjectResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ImagesClientGetByProjectResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ImagesClientGetByProjectResponse{}, err + } + resp, err := client.getByProjectHandleResponse(httpResp) + return resp, err +} + +// getByProjectCreateRequest creates the GetByProject request. +func (client *ImagesClient) getByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, imageName string, options *ImagesClientGetByProjectOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects/{projectName}/images/{imageName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if imageName == "" { + return nil, errors.New("parameter imageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{imageName}", url.PathEscape(imageName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getByProjectHandleResponse handles the GetByProject response. +func (client *ImagesClient) getByProjectHandleResponse(resp *http.Response) (ImagesClientGetByProjectResponse, error) { + result := ImagesClientGetByProjectResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Image); err != nil { + return ImagesClientGetByProjectResponse{}, err + } + return result, nil +} + // NewListByDevCenterPager - Lists images for a devcenter. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - options - ImagesClientListByDevCenterOptions contains the optional parameters for the ImagesClient.NewListByDevCenterPager @@ -171,7 +240,7 @@ func (client *ImagesClient) listByDevCenterCreateRequest(ctx context.Context, re if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -188,7 +257,7 @@ func (client *ImagesClient) listByDevCenterHandleResponse(resp *http.Response) ( // NewListByGalleryPager - Lists images for a gallery. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - galleryName - The name of the gallery. @@ -244,7 +313,7 @@ func (client *ImagesClient) listByGalleryCreateRequest(ctx context.Context, reso if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -258,3 +327,68 @@ func (client *ImagesClient) listByGalleryHandleResponse(resp *http.Response) (Im } return result, nil } + +// NewListByProjectPager - Lists images for a project. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - projectName - The name of the project. +// - options - ImagesClientListByProjectOptions contains the optional parameters for the ImagesClient.NewListByProjectPager +// method. +func (client *ImagesClient) NewListByProjectPager(resourceGroupName string, projectName string, options *ImagesClientListByProjectOptions) *runtime.Pager[ImagesClientListByProjectResponse] { + return runtime.NewPager(runtime.PagingHandler[ImagesClientListByProjectResponse]{ + More: func(page ImagesClientListByProjectResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ImagesClientListByProjectResponse) (ImagesClientListByProjectResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ImagesClient.NewListByProjectPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByProjectCreateRequest(ctx, resourceGroupName, projectName, options) + }, nil) + if err != nil { + return ImagesClientListByProjectResponse{}, err + } + return client.listByProjectHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByProjectCreateRequest creates the ListByProject request. +func (client *ImagesClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *ImagesClientListByProjectOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects/{projectName}/images" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByProjectHandleResponse handles the ListByProject response. +func (client *ImagesClient) listByProjectHandleResponse(resp *http.Response) (ImagesClientListByProjectResponse, error) { + result := ImagesClientListByProjectResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ImageListResult); err != nil { + return ImagesClientListByProjectResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/images_client_example_test.go b/sdk/resourcemanager/devcenter/armdevcenter/images_client_example_test.go deleted file mode 100644 index 9bbd767f9911..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/images_client_example_test.go +++ /dev/null @@ -1,242 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdevcenter_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Images_ListByDevCenter.json -func ExampleImagesClient_NewListByDevCenterPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewImagesClient().NewListByDevCenterPager("rg1", "Contoso", &armdevcenter.ImagesClientListByDevCenterOptions{Top: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ImageListResult = armdevcenter.ImageListResult{ - // Value: []*armdevcenter.Image{ - // { - // Name: to.Ptr("ContosoBaseImage"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters/galleries/images"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso/galleries/DevGallery/images/ContosoBaseImage"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.ImageProperties{ - // Description: to.Ptr("Windows 10 Enterprise + OS Optimizations 1909"), - // Offer: to.Ptr("windows-ent-cpc"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // Publisher: to.Ptr("MicrosoftWindowsDesktop"), - // RecommendedMachineConfiguration: &armdevcenter.RecommendedMachineConfiguration{ - // Memory: &armdevcenter.ResourceRange{ - // Max: to.Ptr[int32](256), - // Min: to.Ptr[int32](128), - // }, - // VCPUs: &armdevcenter.ResourceRange{ - // Max: to.Ptr[int32](4), - // Min: to.Ptr[int32](2), - // }, - // }, - // SKU: to.Ptr("19h2-ent-cpc-os-g2"), - // }, - // }, - // { - // Name: to.Ptr("ContosoBaseImage2"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters/galleries/images"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso/galleries/DevGallery/images/ContosoBaseImage2"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.ImageProperties{ - // Description: to.Ptr("Standard Windows Dev/Test image."), - // Offer: to.Ptr("Finance"), - // Publisher: to.Ptr("Contoso"), - // RecommendedMachineConfiguration: &armdevcenter.RecommendedMachineConfiguration{ - // Memory: &armdevcenter.ResourceRange{ - // Max: to.Ptr[int32](512), - // Min: to.Ptr[int32](256), - // }, - // VCPUs: &armdevcenter.ResourceRange{ - // Max: to.Ptr[int32](8), - // Min: to.Ptr[int32](4), - // }, - // }, - // SKU: to.Ptr("Backend"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Images_ListByGallery.json -func ExampleImagesClient_NewListByGalleryPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewImagesClient().NewListByGalleryPager("rg1", "Contoso", "DevGallery", &armdevcenter.ImagesClientListByGalleryOptions{Top: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ImageListResult = armdevcenter.ImageListResult{ - // Value: []*armdevcenter.Image{ - // { - // Name: to.Ptr("ContosoBaseImage"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters/galleries/images"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso/galleries/DevGallery/images/ContosoBaseImage"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.ImageProperties{ - // Description: to.Ptr("Windows 10 Enterprise + OS Optimizations 1909"), - // Offer: to.Ptr("windows-ent-cpc"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // Publisher: to.Ptr("MicrosoftWindowsDesktop"), - // RecommendedMachineConfiguration: &armdevcenter.RecommendedMachineConfiguration{ - // Memory: &armdevcenter.ResourceRange{ - // Max: to.Ptr[int32](256), - // Min: to.Ptr[int32](128), - // }, - // VCPUs: &armdevcenter.ResourceRange{ - // Max: to.Ptr[int32](4), - // Min: to.Ptr[int32](2), - // }, - // }, - // SKU: to.Ptr("19h2-ent-cpc-os-g2"), - // }, - // }, - // { - // Name: to.Ptr("ContosoBaseImage2"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters/galleries/images"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso/galleries/DevGallery/images/ContosoBaseImage2"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.ImageProperties{ - // Description: to.Ptr("Standard Windows Dev/Test image."), - // Offer: to.Ptr("Finance"), - // Publisher: to.Ptr("Contoso"), - // RecommendedMachineConfiguration: &armdevcenter.RecommendedMachineConfiguration{ - // Memory: &armdevcenter.ResourceRange{ - // Max: to.Ptr[int32](512), - // Min: to.Ptr[int32](256), - // }, - // VCPUs: &armdevcenter.ResourceRange{ - // Max: to.Ptr[int32](8), - // Min: to.Ptr[int32](4), - // }, - // }, - // SKU: to.Ptr("Backend"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Images_Get.json -func ExampleImagesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewImagesClient().Get(ctx, "rg1", "Contoso", "DefaultDevGallery", "ContosoBaseImage", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Image = armdevcenter.Image{ - // Name: to.Ptr("ContosoBaseImage"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters/galleries/images"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso/galleries/DefaultDevGallery/images/ContosoBaseImage"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.ImageProperties{ - // Description: to.Ptr("Standard Windows Dev/Test image."), - // Offer: to.Ptr("Finance"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // Publisher: to.Ptr("Contoso"), - // RecommendedMachineConfiguration: &armdevcenter.RecommendedMachineConfiguration{ - // Memory: &armdevcenter.ResourceRange{ - // Max: to.Ptr[int32](512), - // Min: to.Ptr[int32](256), - // }, - // VCPUs: &armdevcenter.ResourceRange{ - // Max: to.Ptr[int32](8), - // Min: to.Ptr[int32](4), - // }, - // }, - // SKU: to.Ptr("Backend"), - // }, - // } -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/imageversions_client.go b/sdk/resourcemanager/devcenter/armdevcenter/imageversions_client.go index 2cc825d3cf88..80c88b666daf 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/imageversions_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/imageversions_client.go @@ -46,7 +46,7 @@ func NewImageVersionsClient(subscriptionID string, credential azcore.TokenCreden // Get - Gets an image version. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - galleryName - The name of the gallery. @@ -107,7 +107,7 @@ func (client *ImageVersionsClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -122,9 +122,84 @@ func (client *ImageVersionsClient) getHandleResponse(resp *http.Response) (Image return result, nil } +// GetByProject - Gets an image version. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - projectName - The name of the project. +// - imageName - The name of the image. +// - versionName - The version of the image. +// - options - ImageVersionsClientGetByProjectOptions contains the optional parameters for the ImageVersionsClient.GetByProject +// method. +func (client *ImageVersionsClient) GetByProject(ctx context.Context, resourceGroupName string, projectName string, imageName string, versionName string, options *ImageVersionsClientGetByProjectOptions) (ImageVersionsClientGetByProjectResponse, error) { + var err error + const operationName = "ImageVersionsClient.GetByProject" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getByProjectCreateRequest(ctx, resourceGroupName, projectName, imageName, versionName, options) + if err != nil { + return ImageVersionsClientGetByProjectResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ImageVersionsClientGetByProjectResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ImageVersionsClientGetByProjectResponse{}, err + } + resp, err := client.getByProjectHandleResponse(httpResp) + return resp, err +} + +// getByProjectCreateRequest creates the GetByProject request. +func (client *ImageVersionsClient) getByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, imageName string, versionName string, options *ImageVersionsClientGetByProjectOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects/{projectName}/images/{imageName}/versions/{versionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if imageName == "" { + return nil, errors.New("parameter imageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{imageName}", url.PathEscape(imageName)) + if versionName == "" { + return nil, errors.New("parameter versionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{versionName}", url.PathEscape(versionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getByProjectHandleResponse handles the GetByProject response. +func (client *ImageVersionsClient) getByProjectHandleResponse(resp *http.Response) (ImageVersionsClientGetByProjectResponse, error) { + result := ImageVersionsClientGetByProjectResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ImageVersion); err != nil { + return ImageVersionsClientGetByProjectResponse{}, err + } + return result, nil +} + // NewListByImagePager - Lists versions for an image. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - devCenterName - The name of the devcenter. // - galleryName - The name of the gallery. @@ -182,7 +257,7 @@ func (client *ImageVersionsClient) listByImageCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -196,3 +271,73 @@ func (client *ImageVersionsClient) listByImageHandleResponse(resp *http.Response } return result, nil } + +// NewListByProjectPager - Lists versions for an image. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - projectName - The name of the project. +// - imageName - The name of the image. +// - options - ImageVersionsClientListByProjectOptions contains the optional parameters for the ImageVersionsClient.NewListByProjectPager +// method. +func (client *ImageVersionsClient) NewListByProjectPager(resourceGroupName string, projectName string, imageName string, options *ImageVersionsClientListByProjectOptions) *runtime.Pager[ImageVersionsClientListByProjectResponse] { + return runtime.NewPager(runtime.PagingHandler[ImageVersionsClientListByProjectResponse]{ + More: func(page ImageVersionsClientListByProjectResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ImageVersionsClientListByProjectResponse) (ImageVersionsClientListByProjectResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ImageVersionsClient.NewListByProjectPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByProjectCreateRequest(ctx, resourceGroupName, projectName, imageName, options) + }, nil) + if err != nil { + return ImageVersionsClientListByProjectResponse{}, err + } + return client.listByProjectHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByProjectCreateRequest creates the ListByProject request. +func (client *ImageVersionsClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, imageName string, options *ImageVersionsClientListByProjectOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects/{projectName}/images/{imageName}/versions" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if imageName == "" { + return nil, errors.New("parameter imageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{imageName}", url.PathEscape(imageName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByProjectHandleResponse handles the ListByProject response. +func (client *ImageVersionsClient) listByProjectHandleResponse(resp *http.Response) (ImageVersionsClientListByProjectResponse, error) { + result := ImageVersionsClientListByProjectResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ImageVersionListResult); err != nil { + return ImageVersionsClientListByProjectResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/imageversions_client_example_test.go b/sdk/resourcemanager/devcenter/armdevcenter/imageversions_client_example_test.go deleted file mode 100644 index dc0c0dd22245..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/imageversions_client_example_test.go +++ /dev/null @@ -1,104 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdevcenter_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/ImageVersions_List.json -func ExampleImageVersionsClient_NewListByImagePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewImageVersionsClient().NewListByImagePager("rg1", "Contoso", "DefaultDevGallery", "Win11", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ImageVersionListResult = armdevcenter.ImageVersionListResult{ - // Value: []*armdevcenter.ImageVersion{ - // { - // Name: to.Ptr("1.0.0"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters/galleries/images/versions"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso/galleries/DefaultDevGallery/images/Win11/versions/1.0.0"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.ImageVersionProperties{ - // ExcludeFromLatest: to.Ptr(false), - // OSDiskImageSizeInGb: to.Ptr[int32](64), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-01T12:45:16.845Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/ImageVersions_Get.json -func ExampleImageVersionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewImageVersionsClient().Get(ctx, "rg1", "Contoso", "DefaultDevGallery", "Win11", "1.0.0", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ImageVersion = armdevcenter.ImageVersion{ - // Name: to.Ptr("1.0.0"), - // Type: to.Ptr("Microsoft.DevCenter/devcenters/galleries/images/versions"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso/galleries/DefaultDevGallery/images/Win11/versions/1.0.0"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.ImageVersionProperties{ - // ExcludeFromLatest: to.Ptr(false), - // OSDiskImageSizeInGb: to.Ptr[int32](64), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-01T12:45:16.845Z"); return t}()), - // }, - // } -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/models.go b/sdk/resourcemanager/devcenter/armdevcenter/models.go index a5d87f8375d8..b745dddc3679 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/models.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/models.go @@ -249,6 +249,62 @@ type CheckScopedNameAvailabilityRequest struct { Type *string } +// CurationProfile - Represents an curation profile resource. +type CurationProfile struct { + // Properties of an curation profile. + Properties *CurationProfileProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// CurationProfileListResult - Results of the curation profile list operation. +type CurationProfileListResult struct { + // READ-ONLY; URL to get the next set of results if there are any. + NextLink *string + + // READ-ONLY; Current page of results. + Value []*CurationProfile +} + +// CurationProfileProperties - Properties of an curation profile. +type CurationProfileProperties struct { + // Resource policies that are a part of this curation profile. + ResourcePolicies []*ResourcePolicy + + // Resources that have access to the shared resources that are a part of this curation profile. + Scopes []*string + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState +} + +// CurationProfileUpdate - The curation profile properties for partial update. Properties not provided in the update request +// will not be changed. +type CurationProfileUpdate struct { + // Properties of an curation profile to be updated. + Properties *CurationProfileUpdateProperties +} + +// CurationProfileUpdateProperties - Properties of an curation profile. These properties can be updated after the resource +// has been created. +type CurationProfileUpdateProperties struct { + // Resource policies that are a part of this curation profile. + ResourcePolicies []*ResourcePolicy + + // Resources that have access to the shared resources that are a part of this curation profile. + Scopes []*string +} + // CustomerManagedKeyEncryption - All Customer-managed key encryption properties for the resource. type CustomerManagedKeyEncryption struct { // All identity configuration for Customer-managed key settings defining which identity should be used to auth to Key Vault. @@ -275,6 +331,57 @@ type CustomerManagedKeyEncryptionKeyIdentity struct { UserAssignedIdentityResourceID *string } +// CustomizationTask - Represents a Task to be used in customizing a Dev Box. +type CustomizationTask struct { + // Task properties + Properties *CustomizationTaskProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// CustomizationTaskInput - Input for a Task. +type CustomizationTaskInput struct { + // READ-ONLY; Description of the input. + Description *string + + // READ-ONLY; Whether or not the input is required. + Required *bool + + // READ-ONLY; Type of the input. + Type *CustomizationTaskInputType +} + +// CustomizationTaskListResult - Results of the Task list operation. +type CustomizationTaskListResult struct { + // READ-ONLY; URL to get the next set of results if there are any. + NextLink *string + + // READ-ONLY; Current page of results. + Value []*CustomizationTask +} + +// CustomizationTaskProperties - Properties of a Task. +type CustomizationTaskProperties struct { + // READ-ONLY; Inputs to the task. + Inputs map[string]*CustomizationTaskInput + + // READ-ONLY; The default timeout for the task. + Timeout *int32 + + // READ-ONLY; Validation status for the Task. + ValidationStatus *CatalogResourceValidationStatus +} + // DevBoxDefinition - Represents a definition for a Developer Machine. type DevBoxDefinition struct { // REQUIRED; The geo-location where the resource lives @@ -368,6 +475,12 @@ type DevBoxDefinitionUpdateProperties struct { SKU *SKU } +// DevBoxProvisioningSettings - Provisioning settings that apply to all Dev Boxes created in this dev center +type DevBoxProvisioningSettings struct { + // Whether project catalogs associated with projects in this dev center can be configured to sync catalog items. + InstallAzureMonitorAgentEnableStatus *InstallAzureMonitorAgentEnableStatus +} + // DevCenter - Represents a devcenter resource. type DevCenter struct { // REQUIRED; The geo-location where the resource lives @@ -400,6 +513,84 @@ type Encryption struct { CustomerManagedKeyEncryption *CustomerManagedKeyEncryption } +// EncryptionSet - Represents a devcenter encryption set resource. +type EncryptionSet struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Managed identity properties + Identity *ManagedServiceIdentity + + // Properties of a devcenter encryption set. + Properties *EncryptionSetProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// EncryptionSetListResult - Result of the list devcenter encryption set operation +type EncryptionSetListResult struct { + // READ-ONLY; URL to get the next set of results if there are any. + NextLink *string + + // READ-ONLY; Current page of results. + Value []*EncryptionSet +} + +// EncryptionSetProperties - Properties of the devcenter encryption set. +type EncryptionSetProperties struct { + // Devbox disk encryption enable or disable status. Indicates if Devbox disks encryption using DevCenter CMK is enabled or + // not. + DevboxDisksEncryptionEnableStatus *DevboxDisksEncryptionEnableStatus + + // Key encryption key Url, versioned or non-versioned. Ex: https://contosovault.vault.azure.net/keys/contosokek/562a4bb76b524a1493a6afe8e536ee78 + // or https://contosovault.vault.azure.net/keys/contosokek. + KeyEncryptionKeyURL *string + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState +} + +// EncryptionSetUpdate - The devcenter encryption set resource for partial updates. Properties not provided in the update +// request will not be changed. +type EncryptionSetUpdate struct { + // Managed identity properties + Identity *ManagedServiceIdentity + + // The geo-location where the resource lives + Location *string + + // Properties of a Dev Center encryption set to be updated. + Properties *EncryptionSetUpdateProperties + + // Resource tags. + Tags map[string]*string +} + +// EncryptionSetUpdateProperties - Properties of the devcenter encryption set. These properties can be updated after the resource +// has been created. +type EncryptionSetUpdateProperties struct { + // Devbox disk encryption enable or disable status. Indicates if Devbox disks encryption using DevCenter CMK is enabled or + // not. + DevboxDisksEncryptionEnableStatus *DevboxDisksEncryptionEnableStatus + + // Key encryption key Url, versioned or non-versioned. Ex: https://contosovault.vault.azure.net/keys/contosokek/562a4bb76b524a1493a6afe8e536ee78 + // or https://contosovault.vault.azure.net/keys/contosokek. + KeyEncryptionKeyURL *string +} + // EndpointDependency - A domain name and connection details used to access a dependency. type EndpointDependency struct { // READ-ONLY; Human-readable supplemental information about the dependency and when it is applicable. @@ -714,6 +905,197 @@ type Image struct { Type *string } +// ImageCreationErrorDetails - Image creation error details +type ImageCreationErrorDetails struct { + // An identifier for the error. + Code *string + + // A message describing the error. + Message *string +} + +// ImageDefinition - Represents a definition for an Image. +type ImageDefinition struct { + // Image Definition properties + Properties *ImageDefinitionProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ImageDefinitionBuild - Represents a specific build of an Image Definition. +type ImageDefinitionBuild struct { + // Image Definition Build properties + Properties *ImageDefinitionBuildProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ImageDefinitionBuildDetails - Represents a specific build of an Image Definition. +type ImageDefinitionBuildDetails struct { + // READ-ONLY; End time of the task group. + EndTime *time.Time + + // READ-ONLY; Details for image creation error. Populated when the image creation is not successful. + ErrorDetails *ImageCreationErrorDetails + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The specific image version used by the build. + ImageReference *ImageReference + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Start time of the task group. + StartTime *time.Time + + // READ-ONLY; The status of the build. + Status *ImageDefinitionBuildStatus + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The list of task groups executed during the image definition build. + TaskGroups []*ImageDefinitionBuildTaskGroup + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ImageDefinitionBuildListResult - Results of the Image Definition Build list operation. +type ImageDefinitionBuildListResult struct { + // READ-ONLY; URL to get the next set of results if there are any. + NextLink *string + + // READ-ONLY; Current page of results. + Value []*ImageDefinitionBuild +} + +// ImageDefinitionBuildProperties - Properties of an Image Definition Build. +type ImageDefinitionBuildProperties struct { + // READ-ONLY; End time of the task group. + EndTime *time.Time + + // READ-ONLY; Details for image creation error. Populated when the image creation is not successful. + ErrorDetails *ImageCreationErrorDetails + + // READ-ONLY; The specific image version used by the build. + ImageReference *ImageReference + + // READ-ONLY; Start time of the task group. + StartTime *time.Time + + // READ-ONLY; The status of the build. + Status *ImageDefinitionBuildStatus +} + +// ImageDefinitionBuildTask - A task executed during the image definition build. +type ImageDefinitionBuildTask struct { + // Display name to help differentiate multiple instances of the same task. + DisplayName *string + + // The name of the task. + Name *string + + // Parameters for the task. + Parameters []*ImageDefinitionBuildTaskParametersItem + + // READ-ONLY; End time of the task. + EndTime *time.Time + + // READ-ONLY; ID of the task instance. + ID *string + + // READ-ONLY; The URI for retrieving logs for the task execution. + LogURI *string + + // READ-ONLY; Start time of the task. + StartTime *time.Time + + // READ-ONLY; The status of the task. + Status *ImageDefinitionBuildStatus +} + +// ImageDefinitionBuildTaskGroup - A task group executed during the image definition build. +type ImageDefinitionBuildTaskGroup struct { + // READ-ONLY; End time of the task group. + EndTime *time.Time + + // READ-ONLY; The name of the task group. + Name *string + + // READ-ONLY; Start time of the task group. + StartTime *time.Time + + // READ-ONLY; The status of the task group. + Status *ImageDefinitionBuildStatus + + // READ-ONLY; The list of tasks executed during the task group. + Tasks []*ImageDefinitionBuildTask +} + +type ImageDefinitionBuildTaskParametersItem struct { + // REQUIRED + Key *string + + // REQUIRED + Value *string +} + +// ImageDefinitionListResult - Results of the Image Definition list operation. +type ImageDefinitionListResult struct { + // READ-ONLY; URL to get the next set of results if there are any. + NextLink *string + + // READ-ONLY; Current page of results. + Value []*ImageDefinition +} + +// ImageDefinitionProperties - Properties of an Image Definition. +type ImageDefinitionProperties struct { + // Image reference information. + ImageReference *ImageReference + + // Details about the latest build. + LatestBuild *LatestImageBuild + + // READ-ONLY; Image reference information for the currently active image (only populated during updates). + ActiveImageReference *ImageReference + + // READ-ONLY; The URL to the repository file containing the image definition. + FileURL *string + + // READ-ONLY; Details for image validator error. Populated when the image validation is not successful. + ImageValidationErrorDetails *ImageValidationErrorDetails + + // READ-ONLY; Validation status of the configured image. + ImageValidationStatus *ImageValidationStatus + + // READ-ONLY; Validation status for the Image Definition. + ValidationStatus *CatalogResourceValidationStatus +} + // ImageListResult - Results of the image list operation. type ImageListResult struct { // READ-ONLY; URL to get the next set of results if there are any. @@ -812,6 +1194,30 @@ type ImageVersionProperties struct { PublishedDate *time.Time } +// InheritedSettingsForProject - Applicable inherited settings for a project. +type InheritedSettingsForProject struct { + // READ-ONLY; Network settings that will be enforced on this project. + NetworkSettings *ProjectNetworkSettings + + // READ-ONLY; Dev Center settings to be used when associating a project with a catalog. + ProjectCatalogSettings *ProjectCatalogSettingsInfo +} + +// LatestImageBuild - Details about the latest build. +type LatestImageBuild struct { + // READ-ONLY; End time of the task group. + EndTime *time.Time + + // READ-ONLY; Identifier of a build. + Name *string + + // READ-ONLY; Start time of the task group. + StartTime *time.Time + + // READ-ONLY; The state of an Image Definition Build. + Status *ImageDefinitionBuildStatus +} + // ListResult - Result of the list devcenters operation type ListResult struct { // READ-ONLY; URL to get the next set of results if there are any. @@ -948,6 +1354,12 @@ type NetworkProperties struct { ProvisioningState *ProvisioningState } +// NetworkSettings - Network settings for the Dev Center. +type NetworkSettings struct { + // Indicates whether pools in this Dev Center can use Microsoft Hosted Networks. Defaults to Enabled if not set. + MicrosoftHostedNetworkEnableStatus *MicrosoftHostedNetworkEnableStatus +} + // Operation - Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { // Localized display information for this particular operation. @@ -1079,6 +1491,137 @@ type OutboundEnvironmentEndpointCollection struct { Value []*OutboundEnvironmentEndpoint } +// Plan - Represents a devcenter plan resource. +type Plan struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Plan properties + Properties *PlanProperties + + // The SKU for DevCenters created using this definition. + SKU *SKU + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// PlanListResult - Result of the list devcenter plans operation +type PlanListResult struct { + // READ-ONLY; URL to get the next set of results if there are any. + NextLink *string + + // READ-ONLY; Current page of results. + Value []*Plan +} + +// PlanMember - Represents a devcenter plan member resource. +type PlanMember struct { + // Plan member properties + Properties *PlanMemberProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// PlanMemberProperties - Properties of the devcenter plan member. +type PlanMemberProperties struct { + // The unique id of the member. + MemberID *string + + // The type of the member (user, group) + MemberType *PlanMemberType + + // The tier of the member. + Tier *string + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; The sync status of the member. + SyncStatus *PlanMemberSyncStatus +} + +// PlanMemberSyncStatus - The sync status of the plan member. +type PlanMemberSyncStatus struct { + // Error response describing why the sync failed. + LastSyncError *ErrorDetail + + // READ-ONLY; When the plan member was last synced. + LastSyncTime *time.Time + + // READ-ONLY; The synchronization state of the plan member. + SyncState *PlanMemberSyncState +} + +// PlanMemberUpdate - The devcenter plan member resource for partial updates. Properties not provided in the update request +// will not be changed. +type PlanMemberUpdate struct { + // Plan member update properties + Properties *PlanMemberUpdateProperties + + // Resource tags. + Tags map[string]*string +} + +// PlanMemberUpdateProperties - Properties of the devcenter plan member. +type PlanMemberUpdateProperties struct { + // The tier of the member. + Tier *string +} + +// PlanMembersListResult - Result of the list devcenter plan members operation +type PlanMembersListResult struct { + // READ-ONLY; URL to get the next set of results if there are any. + NextLink *string + + // READ-ONLY; Current page of results. + Value []*PlanMember +} + +// PlanProperties - Properties of the devcenter plan. +type PlanProperties struct { + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState +} + +// PlanUpdate - The devcenter plan resource for partial updates. Properties not provided in the update request will not be +// changed. +type PlanUpdate struct { + // The geo-location where the resource lives + Location *string + + // The SKU for DevCenters created using this definition. + SKU *SKU + + // Resource tags. + Tags map[string]*string +} + // Pool - A pool of Virtual Machines. type Pool struct { // REQUIRED; The geo-location where the resource lives @@ -1103,6 +1646,18 @@ type Pool struct { Type *string } +// PoolDevBoxDefinition - Represents a definition for a Developer Machine. +type PoolDevBoxDefinition struct { + // Image reference information. + ImageReference *ImageReference + + // The SKU for Dev Boxes created from the Pool. + SKU *SKU + + // READ-ONLY; Image reference information for the currently active image (only populated during updates). + ActiveImageReference *ImageReference +} + // PoolListResult - Results of the machine pool list operation. type PoolListResult struct { // READ-ONLY; URL to get the next set of results if there are any. @@ -1114,9 +1669,16 @@ type PoolListResult struct { // PoolProperties - Properties of a Pool type PoolProperties struct { - // Name of a Dev Box definition in parent Project of this Pool + // A definition of the machines that are created from this Pool. Will be ignored if devBoxDefinitionType is Reference or not + // provided. + DevBoxDefinition *PoolDevBoxDefinition + + // Name of a Dev Box definition in parent Project of this Pool. Will be ignored if devBoxDefinitionType is Value. DevBoxDefinitionName *string + // Indicates if the pool is created from an existing Dev Box Definition or if one is provided directly. + DevBoxDefinitionType *PoolDevBoxDefinitionType + // The display name of the pool. DisplayName *string @@ -1139,6 +1701,9 @@ type PoolProperties struct { // Stop on disconnect configuration settings for Dev Boxes created in this pool. StopOnDisconnect *StopOnDisconnectConfiguration + // Stop on no connect configuration settings for Dev Boxes created in this pool. + StopOnNoConnect *StopOnNoConnectConfiguration + // Indicates whether the pool uses a Virtual Network managed by Microsoft or a customer provided network. VirtualNetworkType *VirtualNetworkType @@ -1170,9 +1735,16 @@ type PoolUpdate struct { // PoolUpdateProperties - Properties of a Pool. These properties can be updated after the resource has been created. type PoolUpdateProperties struct { - // Name of a Dev Box definition in parent Project of this Pool + // A definition of the machines that are created from this Pool. Will be ignored if devBoxDefinitionType is Reference or not + // provided. + DevBoxDefinition *PoolDevBoxDefinition + + // Name of a Dev Box definition in parent Project of this Pool. Will be ignored if devBoxDefinitionType is Value. DevBoxDefinitionName *string + // Indicates if the pool is created from an existing Dev Box Definition or if one is provided directly. + DevBoxDefinitionType *PoolDevBoxDefinitionType + // The display name of the pool. DisplayName *string @@ -1195,6 +1767,9 @@ type PoolUpdateProperties struct { // Stop on disconnect configuration settings for Dev Boxes created in this pool. StopOnDisconnect *StopOnDisconnectConfiguration + // Stop on no connect configuration settings for Dev Boxes created in this pool. + StopOnNoConnect *StopOnNoConnectConfiguration + // Indicates whether the pool uses a Virtual Network managed by Microsoft or a customer provided network. VirtualNetworkType *VirtualNetworkType } @@ -1350,6 +1925,68 @@ type ProjectListResult struct { Value []*Project } +// ProjectNetworkSettings - Network settings for the project. +type ProjectNetworkSettings struct { + // READ-ONLY; Indicates whether pools in this Dev Center can use Microsoft Hosted Networks. Defaults to Enabled if not set. + MicrosoftHostedNetworkEnableStatus *MicrosoftHostedNetworkEnableStatus +} + +// ProjectPolicy - Represents an project policy resource. +type ProjectPolicy struct { + // Properties of an project policy. + Properties *ProjectPolicyProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ProjectPolicyListResult - Results of the project policy list operation. +type ProjectPolicyListResult struct { + // READ-ONLY; URL to get the next set of results if there are any. + NextLink *string + + // READ-ONLY; Current page of results. + Value []*ProjectPolicy +} + +// ProjectPolicyProperties - Properties of an project policy. +type ProjectPolicyProperties struct { + // Resource policies that are a part of this project policy. + ResourcePolicies []*ResourcePolicy + + // Resources that have access to the shared resources that are a part of this project policy. + Scopes []*string + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState +} + +// ProjectPolicyUpdate - The project policy properties for partial update. Properties not provided in the update request will +// not be changed. +type ProjectPolicyUpdate struct { + // Properties of an project policy to be updated. + Properties *ProjectPolicyUpdateProperties +} + +// ProjectPolicyUpdateProperties - Properties of an project policy. These properties can be updated after the resource has +// been created. +type ProjectPolicyUpdateProperties struct { + // Resource policies that are a part of this project policy. + ResourcePolicies []*ResourcePolicy + + // Resources that have access to the shared resources that are a part of this project policy. + Scopes []*string +} + // ProjectProperties - Properties of a project. type ProjectProperties struct { // Settings to be used when associating a project with a catalog. @@ -1411,15 +2048,27 @@ type ProjectUpdateProperties struct { // Properties of the devcenter. type Properties struct { + // Settings to be used in the provisioning of all Dev Boxes that belong to this dev center. + DevBoxProvisioningSettings *DevBoxProvisioningSettings + // The display name of the devcenter. DisplayName *string // Encryption settings to be used for server-side encryption for proprietary content (such as catalogs, logs, customizations). Encryption *Encryption + // Network settings that will be enforced on network resources associated with the Dev Center. + NetworkSettings *NetworkSettings + + // Resource Id of an associated Plan + PlanID *string + // Dev Center settings to be used when associating a project with a catalog. ProjectCatalogSettings *ProjectCatalogSettingsInfo + // Indicates the resource types that are restricted from being accessed by a project unless allowed by a project policy. + RestrictedResourceTypes []*DevCenterResourceType + // READ-ONLY; The URI of the Dev Center. DevCenterURI *string @@ -1436,6 +2085,15 @@ type RecommendedMachineConfiguration struct { VCPUs *ResourceRange } +// ResourcePolicy - A resource policy. +type ResourcePolicy struct { + // Optional. When specified, this expression is used to filter the resources. + Filter *string + + // Resources that are included and shared as a part of a project policy. + Resources *string +} + // ResourceRange - Properties for a range of values. type ResourceRange struct { // READ-ONLY; Maximum value. @@ -1447,7 +2105,7 @@ type ResourceRange struct { // SKU - The resource model definition representing SKU type SKU struct { - // REQUIRED; The name of the SKU. Ex - P3. It is typically a letter+number code + // REQUIRED; The name of the SKU. E.g. P3. It is typically a letter+number code Name *string // If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the @@ -1467,7 +2125,7 @@ type SKU struct { // SKUInfo - The resource model definition representing SKU for DevCenter resources type SKUInfo struct { - // REQUIRED; The name of the SKU. Ex - P3. It is typically a letter+number code + // REQUIRED; The name of the SKU. E.g. P3. It is typically a letter+number code Name *string // If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the @@ -1597,6 +2255,15 @@ type StopOnDisconnectConfiguration struct { Status *StopOnDisconnectEnableStatus } +// StopOnNoConnectConfiguration - Stop on no connect configuration settings for Dev Boxes created in this pool. +type StopOnNoConnectConfiguration struct { + // The specified time in minutes to wait before stopping a Dev Box if no connection is made. + GracePeriodMinutes *int32 + + // Enables the feature to stop a started Dev Box when it has not been connected to, once the grace period has lapsed. + Status *StopOnNoConnectEnableStatus +} + // SyncErrorDetails - Synchronization error details. type SyncErrorDetails struct { // READ-ONLY; Catalog items that have conflicting names. @@ -1671,14 +2338,26 @@ type Update struct { // UpdateProperties - Properties of the devcenter. These properties can be updated after the resource has been created. type UpdateProperties struct { + // Settings to be used in the provisioning of all Dev Boxes that belong to this dev center. + DevBoxProvisioningSettings *DevBoxProvisioningSettings + // The display name of the devcenter. DisplayName *string // Encryption settings to be used for server-side encryption for proprietary content (such as catalogs, logs, customizations). Encryption *Encryption + // Network settings that will be enforced on network resources associated with the Dev Center. + NetworkSettings *NetworkSettings + + // Resource Id of an associated Plan + PlanID *string + // Dev Center settings to be used when associating a project with a catalog. ProjectCatalogSettings *ProjectCatalogSettingsInfo + + // Indicates the resource types that are restricted from being accessed by a project unless allowed by a project policy. + RestrictedResourceTypes []*DevCenterResourceType } // Usage - The core usage details. diff --git a/sdk/resourcemanager/devcenter/armdevcenter/models_serde.go b/sdk/resourcemanager/devcenter/armdevcenter/models_serde.go index 0b6581aaf03f..afff2cfcad8f 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/models_serde.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/models_serde.go @@ -692,6 +692,173 @@ func (c *CheckScopedNameAvailabilityRequest) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type CurationProfile. +func (c CurationProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CurationProfile. +func (c *CurationProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CurationProfileListResult. +func (c CurationProfileListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CurationProfileListResult. +func (c *CurationProfileListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CurationProfileProperties. +func (c CurationProfileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "resourcePolicies", c.ResourcePolicies) + populate(objectMap, "scopes", c.Scopes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CurationProfileProperties. +func (c *CurationProfileProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "resourcePolicies": + err = unpopulate(val, "ResourcePolicies", &c.ResourcePolicies) + delete(rawMsg, key) + case "scopes": + err = unpopulate(val, "Scopes", &c.Scopes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CurationProfileUpdate. +func (c CurationProfileUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CurationProfileUpdate. +func (c *CurationProfileUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CurationProfileUpdateProperties. +func (c CurationProfileUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "resourcePolicies", c.ResourcePolicies) + populate(objectMap, "scopes", c.Scopes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CurationProfileUpdateProperties. +func (c *CurationProfileUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "resourcePolicies": + err = unpopulate(val, "ResourcePolicies", &c.ResourcePolicies) + delete(rawMsg, key) + case "scopes": + err = unpopulate(val, "Scopes", &c.Scopes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type CustomerManagedKeyEncryption. func (c CustomerManagedKeyEncryption) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -758,6 +925,150 @@ func (c *CustomerManagedKeyEncryptionKeyIdentity) UnmarshalJSON(data []byte) err return nil } +// MarshalJSON implements the json.Marshaller interface for type CustomizationTask. +func (c CustomizationTask) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomizationTask. +func (c *CustomizationTask) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomizationTaskInput. +func (c CustomizationTaskInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", c.Description) + populate(objectMap, "required", c.Required) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomizationTaskInput. +func (c *CustomizationTaskInput) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &c.Description) + delete(rawMsg, key) + case "required": + err = unpopulate(val, "Required", &c.Required) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomizationTaskListResult. +func (c CustomizationTaskListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomizationTaskListResult. +func (c *CustomizationTaskListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomizationTaskProperties. +func (c CustomizationTaskProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "inputs", c.Inputs) + populate(objectMap, "timeout", c.Timeout) + populate(objectMap, "validationStatus", c.ValidationStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomizationTaskProperties. +func (c *CustomizationTaskProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "inputs": + err = unpopulate(val, "Inputs", &c.Inputs) + delete(rawMsg, key) + case "timeout": + err = unpopulate(val, "Timeout", &c.Timeout) + delete(rawMsg, key) + case "validationStatus": + err = unpopulate(val, "ValidationStatus", &c.ValidationStatus) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type DevBoxDefinition. func (d DevBoxDefinition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -973,12 +1284,39 @@ func (d *DevBoxDefinitionUpdateProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DevCenter. -func (d DevCenter) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DevBoxProvisioningSettings. +func (d DevBoxProvisioningSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", d.ID) - populate(objectMap, "identity", d.Identity) - populate(objectMap, "location", d.Location) + populate(objectMap, "installAzureMonitorAgentEnableStatus", d.InstallAzureMonitorAgentEnableStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DevBoxProvisioningSettings. +func (d *DevBoxProvisioningSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "installAzureMonitorAgentEnableStatus": + err = unpopulate(val, "InstallAzureMonitorAgentEnableStatus", &d.InstallAzureMonitorAgentEnableStatus) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DevCenter. +func (d DevCenter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", d.ID) + populate(objectMap, "identity", d.Identity) + populate(objectMap, "location", d.Location) populate(objectMap, "name", d.Name) populate(objectMap, "properties", d.Properties) populate(objectMap, "systemData", d.SystemData) @@ -1055,6 +1393,197 @@ func (e *Encryption) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type EncryptionSet. +func (e EncryptionSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", e.ID) + populate(objectMap, "identity", e.Identity) + populate(objectMap, "location", e.Location) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "tags", e.Tags) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionSet. +func (e *EncryptionSet) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &e.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &e.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &e.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EncryptionSetListResult. +func (e EncryptionSetListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionSetListResult. +func (e *EncryptionSetListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EncryptionSetProperties. +func (e EncryptionSetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "devboxDisksEncryptionEnableStatus", e.DevboxDisksEncryptionEnableStatus) + populate(objectMap, "keyEncryptionKeyUrl", e.KeyEncryptionKeyURL) + populate(objectMap, "provisioningState", e.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionSetProperties. +func (e *EncryptionSetProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "devboxDisksEncryptionEnableStatus": + err = unpopulate(val, "DevboxDisksEncryptionEnableStatus", &e.DevboxDisksEncryptionEnableStatus) + delete(rawMsg, key) + case "keyEncryptionKeyUrl": + err = unpopulate(val, "KeyEncryptionKeyURL", &e.KeyEncryptionKeyURL) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EncryptionSetUpdate. +func (e EncryptionSetUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", e.Identity) + populate(objectMap, "location", e.Location) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "tags", e.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionSetUpdate. +func (e *EncryptionSetUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identity": + err = unpopulate(val, "Identity", &e.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &e.Location) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &e.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EncryptionSetUpdateProperties. +func (e EncryptionSetUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "devboxDisksEncryptionEnableStatus", e.DevboxDisksEncryptionEnableStatus) + populate(objectMap, "keyEncryptionKeyUrl", e.KeyEncryptionKeyURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionSetUpdateProperties. +func (e *EncryptionSetUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "devboxDisksEncryptionEnableStatus": + err = unpopulate(val, "DevboxDisksEncryptionEnableStatus", &e.DevboxDisksEncryptionEnableStatus) + delete(rawMsg, key) + case "keyEncryptionKeyUrl": + err = unpopulate(val, "KeyEncryptionKeyURL", &e.KeyEncryptionKeyURL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type EndpointDependency. func (e EndpointDependency) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1927,16 +2456,16 @@ func (i *Image) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ImageListResult. -func (i ImageListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ImageCreationErrorDetails. +func (i ImageCreationErrorDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", i.NextLink) - populate(objectMap, "value", i.Value) + populate(objectMap, "code", i.Code) + populate(objectMap, "message", i.Message) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ImageListResult. -func (i *ImageListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageCreationErrorDetails. +func (i *ImageCreationErrorDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", i, err) @@ -1944,11 +2473,11 @@ func (i *ImageListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &i.NextLink) + case "code": + err = unpopulate(val, "Code", &i.Code) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &i.Value) + case "message": + err = unpopulate(val, "Message", &i.Message) delete(rawMsg, key) } if err != nil { @@ -1958,21 +2487,19 @@ func (i *ImageListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ImageProperties. -func (i ImageProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ImageDefinition. +func (i ImageDefinition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", i.Description) - populate(objectMap, "hibernateSupport", i.HibernateSupport) - populate(objectMap, "offer", i.Offer) - populate(objectMap, "provisioningState", i.ProvisioningState) - populate(objectMap, "publisher", i.Publisher) - populate(objectMap, "recommendedMachineConfiguration", i.RecommendedMachineConfiguration) - populate(objectMap, "sku", i.SKU) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "systemData", i.SystemData) + populate(objectMap, "type", i.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ImageProperties. -func (i *ImageProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageDefinition. +func (i *ImageDefinition) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", i, err) @@ -1980,26 +2507,20 @@ func (i *ImageProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &i.Description) - delete(rawMsg, key) - case "hibernateSupport": - err = unpopulate(val, "HibernateSupport", &i.HibernateSupport) - delete(rawMsg, key) - case "offer": - err = unpopulate(val, "Offer", &i.Offer) + case "id": + err = unpopulate(val, "ID", &i.ID) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &i.ProvisioningState) + case "name": + err = unpopulate(val, "Name", &i.Name) delete(rawMsg, key) - case "publisher": - err = unpopulate(val, "Publisher", &i.Publisher) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) delete(rawMsg, key) - case "recommendedMachineConfiguration": - err = unpopulate(val, "RecommendedMachineConfiguration", &i.RecommendedMachineConfiguration) + case "systemData": + err = unpopulate(val, "SystemData", &i.SystemData) delete(rawMsg, key) - case "sku": - err = unpopulate(val, "SKU", &i.SKU) + case "type": + err = unpopulate(val, "Type", &i.Type) delete(rawMsg, key) } if err != nil { @@ -2009,16 +2530,19 @@ func (i *ImageProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ImageReference. -func (i ImageReference) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ImageDefinitionBuild. +func (i ImageDefinitionBuild) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "exactVersion", i.ExactVersion) populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "systemData", i.SystemData) + populate(objectMap, "type", i.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ImageReference. -func (i *ImageReference) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageDefinitionBuild. +func (i *ImageDefinitionBuild) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", i, err) @@ -2026,42 +2550,20 @@ func (i *ImageReference) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "exactVersion": - err = unpopulate(val, "ExactVersion", &i.ExactVersion) - delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &i.ID) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ImageValidationErrorDetails. -func (i ImageValidationErrorDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "code", i.Code) - populate(objectMap, "message", i.Message) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ImageValidationErrorDetails. -func (i *ImageValidationErrorDetails) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "code": - err = unpopulate(val, "Code", &i.Code) + case "name": + err = unpopulate(val, "Name", &i.Name) delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &i.Message) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &i.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) delete(rawMsg, key) } if err != nil { @@ -2071,19 +2573,24 @@ func (i *ImageValidationErrorDetails) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ImageVersion. -func (i ImageVersion) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ImageDefinitionBuildDetails. +func (i ImageDefinitionBuildDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "endTime", i.EndTime) + populate(objectMap, "errorDetails", i.ErrorDetails) populate(objectMap, "id", i.ID) + populate(objectMap, "imageReference", i.ImageReference) populate(objectMap, "name", i.Name) - populate(objectMap, "properties", i.Properties) + populateDateTimeRFC3339(objectMap, "startTime", i.StartTime) + populate(objectMap, "status", i.Status) populate(objectMap, "systemData", i.SystemData) + populate(objectMap, "taskGroups", i.TaskGroups) populate(objectMap, "type", i.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ImageVersion. -func (i *ImageVersion) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageDefinitionBuildDetails. +func (i *ImageDefinitionBuildDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", i, err) @@ -2091,18 +2598,33 @@ func (i *ImageVersion) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &i.EndTime) + delete(rawMsg, key) + case "errorDetails": + err = unpopulate(val, "ErrorDetails", &i.ErrorDetails) + delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &i.ID) delete(rawMsg, key) + case "imageReference": + err = unpopulate(val, "ImageReference", &i.ImageReference) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &i.Name) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &i.Properties) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &i.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &i.Status) delete(rawMsg, key) case "systemData": err = unpopulate(val, "SystemData", &i.SystemData) delete(rawMsg, key) + case "taskGroups": + err = unpopulate(val, "TaskGroups", &i.TaskGroups) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &i.Type) delete(rawMsg, key) @@ -2114,16 +2636,16 @@ func (i *ImageVersion) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ImageVersionListResult. -func (i ImageVersionListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ImageDefinitionBuildListResult. +func (i ImageDefinitionBuildListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", i.NextLink) populate(objectMap, "value", i.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ImageVersionListResult. -func (i *ImageVersionListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageDefinitionBuildListResult. +func (i *ImageDefinitionBuildListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", i, err) @@ -2145,19 +2667,65 @@ func (i *ImageVersionListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ImageVersionProperties. -func (i ImageVersionProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ImageDefinitionBuildProperties. +func (i ImageDefinitionBuildProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "excludeFromLatest", i.ExcludeFromLatest) + populateDateTimeRFC3339(objectMap, "endTime", i.EndTime) + populate(objectMap, "errorDetails", i.ErrorDetails) + populate(objectMap, "imageReference", i.ImageReference) + populateDateTimeRFC3339(objectMap, "startTime", i.StartTime) + populate(objectMap, "status", i.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageDefinitionBuildProperties. +func (i *ImageDefinitionBuildProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &i.EndTime) + delete(rawMsg, key) + case "errorDetails": + err = unpopulate(val, "ErrorDetails", &i.ErrorDetails) + delete(rawMsg, key) + case "imageReference": + err = unpopulate(val, "ImageReference", &i.ImageReference) + delete(rawMsg, key) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &i.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &i.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImageDefinitionBuildTask. +func (i ImageDefinitionBuildTask) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", i.DisplayName) + populateDateTimeRFC3339(objectMap, "endTime", i.EndTime) + populate(objectMap, "id", i.ID) + populate(objectMap, "logUri", i.LogURI) populate(objectMap, "name", i.Name) - populate(objectMap, "osDiskImageSizeInGb", i.OSDiskImageSizeInGb) - populate(objectMap, "provisioningState", i.ProvisioningState) - populateDateTimeRFC3339(objectMap, "publishedDate", i.PublishedDate) + populate(objectMap, "parameters", i.Parameters) + populateDateTimeRFC3339(objectMap, "startTime", i.StartTime) + populate(objectMap, "status", i.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ImageVersionProperties. -func (i *ImageVersionProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageDefinitionBuildTask. +func (i *ImageDefinitionBuildTask) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", i, err) @@ -2165,20 +2733,29 @@ func (i *ImageVersionProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "excludeFromLatest": - err = unpopulate(val, "ExcludeFromLatest", &i.ExcludeFromLatest) + case "displayName": + err = unpopulate(val, "DisplayName", &i.DisplayName) + delete(rawMsg, key) + case "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &i.EndTime) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "logUri": + err = unpopulate(val, "LogURI", &i.LogURI) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &i.Name) delete(rawMsg, key) - case "osDiskImageSizeInGb": - err = unpopulate(val, "OSDiskImageSizeInGb", &i.OSDiskImageSizeInGb) + case "parameters": + err = unpopulate(val, "Parameters", &i.Parameters) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &i.ProvisioningState) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &i.StartTime) delete(rawMsg, key) - case "publishedDate": - err = unpopulateDateTimeRFC3339(val, "PublishedDate", &i.PublishedDate) + case "status": + err = unpopulate(val, "Status", &i.Status) delete(rawMsg, key) } if err != nil { @@ -2188,618 +2765,1494 @@ func (i *ImageVersionProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ListResult. -func (l ListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ImageDefinitionBuildTaskGroup. +func (i ImageDefinitionBuildTaskGroup) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", l.NextLink) - populate(objectMap, "value", l.Value) + populateDateTimeRFC3339(objectMap, "endTime", i.EndTime) + populate(objectMap, "name", i.Name) + populateDateTimeRFC3339(objectMap, "startTime", i.StartTime) + populate(objectMap, "status", i.Status) + populate(objectMap, "tasks", i.Tasks) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ListResult. -func (l *ListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageDefinitionBuildTaskGroup. +func (i *ImageDefinitionBuildTaskGroup) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &l.NextLink) + case "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &i.EndTime) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &l.Value) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &i.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &i.Status) + delete(rawMsg, key) + case "tasks": + err = unpopulate(val, "Tasks", &i.Tasks) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ListUsagesResult. -func (l ListUsagesResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ImageDefinitionBuildTaskParametersItem. +func (i ImageDefinitionBuildTaskParametersItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", l.NextLink) - populate(objectMap, "value", l.Value) + populate(objectMap, "key", i.Key) + populate(objectMap, "value", i.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ListUsagesResult. -func (l *ListUsagesResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageDefinitionBuildTaskParametersItem. +func (i *ImageDefinitionBuildTaskParametersItem) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &l.NextLink) + case "key": + err = unpopulate(val, "Key", &i.Key) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &l.Value) + err = unpopulate(val, "Value", &i.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity. -func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ImageDefinitionListResult. +func (i ImageDefinitionListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "principalId", m.PrincipalID) - populate(objectMap, "tenantId", m.TenantID) - populate(objectMap, "type", m.Type) - populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServiceIdentity. -func (m *ManagedServiceIdentity) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageDefinitionListResult. +func (i *ImageDefinitionListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &m.PrincipalID) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &m.TenantID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) delete(rawMsg, key) - case "userAssignedIdentities": - err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) + case "value": + err = unpopulate(val, "Value", &i.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NetworkConnection. -func (n NetworkConnection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ImageDefinitionProperties. +func (i ImageDefinitionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", n.ID) - populate(objectMap, "location", n.Location) - populate(objectMap, "name", n.Name) - populate(objectMap, "properties", n.Properties) - populate(objectMap, "systemData", n.SystemData) - populate(objectMap, "tags", n.Tags) - populate(objectMap, "type", n.Type) + populate(objectMap, "activeImageReference", i.ActiveImageReference) + populate(objectMap, "fileUrl", i.FileURL) + populate(objectMap, "imageReference", i.ImageReference) + populate(objectMap, "imageValidationErrorDetails", i.ImageValidationErrorDetails) + populate(objectMap, "imageValidationStatus", i.ImageValidationStatus) + populate(objectMap, "latestBuild", i.LatestBuild) + populate(objectMap, "validationStatus", i.ValidationStatus) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkConnection. -func (n *NetworkConnection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageDefinitionProperties. +func (i *ImageDefinitionProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &n.ID) + case "activeImageReference": + err = unpopulate(val, "ActiveImageReference", &i.ActiveImageReference) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &n.Location) + case "fileUrl": + err = unpopulate(val, "FileURL", &i.FileURL) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &n.Name) + case "imageReference": + err = unpopulate(val, "ImageReference", &i.ImageReference) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &n.Properties) + case "imageValidationErrorDetails": + err = unpopulate(val, "ImageValidationErrorDetails", &i.ImageValidationErrorDetails) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &n.SystemData) + case "imageValidationStatus": + err = unpopulate(val, "ImageValidationStatus", &i.ImageValidationStatus) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &n.Tags) + case "latestBuild": + err = unpopulate(val, "LatestBuild", &i.LatestBuild) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &n.Type) + case "validationStatus": + err = unpopulate(val, "ValidationStatus", &i.ValidationStatus) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NetworkConnectionListResult. -func (n NetworkConnectionListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ImageListResult. +func (i ImageListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", n.NextLink) - populate(objectMap, "value", n.Value) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkConnectionListResult. -func (n *NetworkConnectionListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageListResult. +func (i *ImageListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": - err = unpopulate(val, "NextLink", &n.NextLink) + err = unpopulate(val, "NextLink", &i.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &n.Value) + err = unpopulate(val, "Value", &i.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NetworkConnectionUpdate. -func (n NetworkConnectionUpdate) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ImageProperties. +func (i ImageProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "location", n.Location) - populate(objectMap, "properties", n.Properties) - populate(objectMap, "tags", n.Tags) + populate(objectMap, "description", i.Description) + populate(objectMap, "hibernateSupport", i.HibernateSupport) + populate(objectMap, "offer", i.Offer) + populate(objectMap, "provisioningState", i.ProvisioningState) + populate(objectMap, "publisher", i.Publisher) + populate(objectMap, "recommendedMachineConfiguration", i.RecommendedMachineConfiguration) + populate(objectMap, "sku", i.SKU) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkConnectionUpdate. -func (n *NetworkConnectionUpdate) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageProperties. +func (i *ImageProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "location": - err = unpopulate(val, "Location", &n.Location) + case "description": + err = unpopulate(val, "Description", &i.Description) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &n.Properties) + case "hibernateSupport": + err = unpopulate(val, "HibernateSupport", &i.HibernateSupport) + delete(rawMsg, key) + case "offer": + err = unpopulate(val, "Offer", &i.Offer) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &i.ProvisioningState) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &i.Publisher) + delete(rawMsg, key) + case "recommendedMachineConfiguration": + err = unpopulate(val, "RecommendedMachineConfiguration", &i.RecommendedMachineConfiguration) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &i.SKU) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImageReference. +func (i ImageReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "exactVersion", i.ExactVersion) + populate(objectMap, "id", i.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageReference. +func (i *ImageReference) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "exactVersion": + err = unpopulate(val, "ExactVersion", &i.ExactVersion) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImageValidationErrorDetails. +func (i ImageValidationErrorDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", i.Code) + populate(objectMap, "message", i.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageValidationErrorDetails. +func (i *ImageValidationErrorDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &i.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &i.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImageVersion. +func (i ImageVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "systemData", i.SystemData) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageVersion. +func (i *ImageVersion) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &i.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImageVersionListResult. +func (i ImageVersionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageVersionListResult. +func (i *ImageVersionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImageVersionProperties. +func (i ImageVersionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "excludeFromLatest", i.ExcludeFromLatest) + populate(objectMap, "name", i.Name) + populate(objectMap, "osDiskImageSizeInGb", i.OSDiskImageSizeInGb) + populate(objectMap, "provisioningState", i.ProvisioningState) + populateDateTimeRFC3339(objectMap, "publishedDate", i.PublishedDate) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageVersionProperties. +func (i *ImageVersionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "excludeFromLatest": + err = unpopulate(val, "ExcludeFromLatest", &i.ExcludeFromLatest) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "osDiskImageSizeInGb": + err = unpopulate(val, "OSDiskImageSizeInGb", &i.OSDiskImageSizeInGb) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &i.ProvisioningState) + delete(rawMsg, key) + case "publishedDate": + err = unpopulateDateTimeRFC3339(val, "PublishedDate", &i.PublishedDate) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InheritedSettingsForProject. +func (i InheritedSettingsForProject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "networkSettings", i.NetworkSettings) + populate(objectMap, "projectCatalogSettings", i.ProjectCatalogSettings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InheritedSettingsForProject. +func (i *InheritedSettingsForProject) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "networkSettings": + err = unpopulate(val, "NetworkSettings", &i.NetworkSettings) + delete(rawMsg, key) + case "projectCatalogSettings": + err = unpopulate(val, "ProjectCatalogSettings", &i.ProjectCatalogSettings) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LatestImageBuild. +func (l LatestImageBuild) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "endTime", l.EndTime) + populate(objectMap, "name", l.Name) + populateDateTimeRFC3339(objectMap, "startTime", l.StartTime) + populate(objectMap, "status", l.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LatestImageBuild. +func (l *LatestImageBuild) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &l.EndTime) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &l.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &l.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListResult. +func (l ListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListResult. +func (l *ListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListUsagesResult. +func (l ListUsagesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListUsagesResult. +func (l *ListUsagesResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity. +func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", m.PrincipalID) + populate(objectMap, "tenantId", m.TenantID) + populate(objectMap, "type", m.Type) + populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServiceIdentity. +func (m *ManagedServiceIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &m.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkConnection. +func (n NetworkConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", n.ID) + populate(objectMap, "location", n.Location) + populate(objectMap, "name", n.Name) + populate(objectMap, "properties", n.Properties) + populate(objectMap, "systemData", n.SystemData) + populate(objectMap, "tags", n.Tags) + populate(objectMap, "type", n.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkConnection. +func (n *NetworkConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &n.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &n.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &n.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &n.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &n.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &n.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &n.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkConnectionListResult. +func (n NetworkConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", n.NextLink) + populate(objectMap, "value", n.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkConnectionListResult. +func (n *NetworkConnectionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &n.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &n.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkConnectionUpdate. +func (n NetworkConnectionUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "location", n.Location) + populate(objectMap, "properties", n.Properties) + populate(objectMap, "tags", n.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkConnectionUpdate. +func (n *NetworkConnectionUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "location": + err = unpopulate(val, "Location", &n.Location) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &n.Properties) delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &n.Tags) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkConnectionUpdateProperties. +func (n NetworkConnectionUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "domainName", n.DomainName) + populate(objectMap, "domainPassword", n.DomainPassword) + populate(objectMap, "domainUsername", n.DomainUsername) + populate(objectMap, "organizationUnit", n.OrganizationUnit) + populate(objectMap, "subnetId", n.SubnetID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkConnectionUpdateProperties. +func (n *NetworkConnectionUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "domainName": + err = unpopulate(val, "DomainName", &n.DomainName) + delete(rawMsg, key) + case "domainPassword": + err = unpopulate(val, "DomainPassword", &n.DomainPassword) + delete(rawMsg, key) + case "domainUsername": + err = unpopulate(val, "DomainUsername", &n.DomainUsername) + delete(rawMsg, key) + case "organizationUnit": + err = unpopulate(val, "OrganizationUnit", &n.OrganizationUnit) + delete(rawMsg, key) + case "subnetId": + err = unpopulate(val, "SubnetID", &n.SubnetID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkProperties. +func (n NetworkProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "domainJoinType", n.DomainJoinType) + populate(objectMap, "domainName", n.DomainName) + populate(objectMap, "domainPassword", n.DomainPassword) + populate(objectMap, "domainUsername", n.DomainUsername) + populate(objectMap, "healthCheckStatus", n.HealthCheckStatus) + populate(objectMap, "networkingResourceGroupName", n.NetworkingResourceGroupName) + populate(objectMap, "organizationUnit", n.OrganizationUnit) + populate(objectMap, "provisioningState", n.ProvisioningState) + populate(objectMap, "subnetId", n.SubnetID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkProperties. +func (n *NetworkProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "domainJoinType": + err = unpopulate(val, "DomainJoinType", &n.DomainJoinType) + delete(rawMsg, key) + case "domainName": + err = unpopulate(val, "DomainName", &n.DomainName) + delete(rawMsg, key) + case "domainPassword": + err = unpopulate(val, "DomainPassword", &n.DomainPassword) + delete(rawMsg, key) + case "domainUsername": + err = unpopulate(val, "DomainUsername", &n.DomainUsername) + delete(rawMsg, key) + case "healthCheckStatus": + err = unpopulate(val, "HealthCheckStatus", &n.HealthCheckStatus) + delete(rawMsg, key) + case "networkingResourceGroupName": + err = unpopulate(val, "NetworkingResourceGroupName", &n.NetworkingResourceGroupName) + delete(rawMsg, key) + case "organizationUnit": + err = unpopulate(val, "OrganizationUnit", &n.OrganizationUnit) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &n.ProvisioningState) + delete(rawMsg, key) + case "subnetId": + err = unpopulate(val, "SubnetID", &n.SubnetID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkSettings. +func (n NetworkSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "microsoftHostedNetworkEnableStatus", n.MicrosoftHostedNetworkEnableStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSettings. +func (n *NetworkSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "microsoftHostedNetworkEnableStatus": + err = unpopulate(val, "MicrosoftHostedNetworkEnableStatus", &n.MicrosoftHostedNetworkEnableStatus) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NetworkConnectionUpdateProperties. -func (n NetworkConnectionUpdateProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationStatus. +func (o OperationStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "domainName", n.DomainName) - populate(objectMap, "domainPassword", n.DomainPassword) - populate(objectMap, "domainUsername", n.DomainUsername) - populate(objectMap, "organizationUnit", n.OrganizationUnit) - populate(objectMap, "subnetId", n.SubnetID) + populateDateTimeRFC3339(objectMap, "endTime", o.EndTime) + populate(objectMap, "error", o.Error) + populate(objectMap, "id", o.ID) + populate(objectMap, "name", o.Name) + populate(objectMap, "operations", o.Operations) + populate(objectMap, "percentComplete", o.PercentComplete) + populateAny(objectMap, "properties", o.Properties) + populate(objectMap, "resourceId", o.ResourceID) + populateDateTimeRFC3339(objectMap, "startTime", o.StartTime) + populate(objectMap, "status", o.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkConnectionUpdateProperties. -func (n *NetworkConnectionUpdateProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatus. +func (o *OperationStatus) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "domainName": - err = unpopulate(val, "DomainName", &n.DomainName) + case "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &o.EndTime) delete(rawMsg, key) - case "domainPassword": - err = unpopulate(val, "DomainPassword", &n.DomainPassword) + case "error": + err = unpopulate(val, "Error", &o.Error) delete(rawMsg, key) - case "domainUsername": - err = unpopulate(val, "DomainUsername", &n.DomainUsername) + case "id": + err = unpopulate(val, "ID", &o.ID) delete(rawMsg, key) - case "organizationUnit": - err = unpopulate(val, "OrganizationUnit", &n.OrganizationUnit) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "operations": + err = unpopulate(val, "Operations", &o.Operations) + delete(rawMsg, key) + case "percentComplete": + err = unpopulate(val, "PercentComplete", &o.PercentComplete) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &o.ResourceID) + delete(rawMsg, key) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &o.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &o.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationStatusResult. +func (o OperationStatusResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "endTime", o.EndTime) + populate(objectMap, "error", o.Error) + populate(objectMap, "id", o.ID) + populate(objectMap, "name", o.Name) + populate(objectMap, "operations", o.Operations) + populate(objectMap, "percentComplete", o.PercentComplete) + populate(objectMap, "resourceId", o.ResourceID) + populateDateTimeRFC3339(objectMap, "startTime", o.StartTime) + populate(objectMap, "status", o.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatusResult. +func (o *OperationStatusResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &o.EndTime) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &o.Error) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "operations": + err = unpopulate(val, "Operations", &o.Operations) + delete(rawMsg, key) + case "percentComplete": + err = unpopulate(val, "PercentComplete", &o.PercentComplete) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &o.ResourceID) + delete(rawMsg, key) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &o.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &o.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OutboundEnvironmentEndpoint. +func (o OutboundEnvironmentEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "category", o.Category) + populate(objectMap, "endpoints", o.Endpoints) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OutboundEnvironmentEndpoint. +func (o *OutboundEnvironmentEndpoint) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "category": + err = unpopulate(val, "Category", &o.Category) + delete(rawMsg, key) + case "endpoints": + err = unpopulate(val, "Endpoints", &o.Endpoints) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OutboundEnvironmentEndpointCollection. +func (o OutboundEnvironmentEndpointCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OutboundEnvironmentEndpointCollection. +func (o *OutboundEnvironmentEndpointCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Plan. +func (p Plan) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "sku", p.SKU) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Plan. +func (p *Plan) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &p.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &p.SKU) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PlanListResult. +func (p PlanListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PlanListResult. +func (p *PlanListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) delete(rawMsg, key) - case "subnetId": - err = unpopulate(val, "SubnetID", &n.SubnetID) + case "value": + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type NetworkProperties. -func (n NetworkProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PlanMember. +func (p PlanMember) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "domainJoinType", n.DomainJoinType) - populate(objectMap, "domainName", n.DomainName) - populate(objectMap, "domainPassword", n.DomainPassword) - populate(objectMap, "domainUsername", n.DomainUsername) - populate(objectMap, "healthCheckStatus", n.HealthCheckStatus) - populate(objectMap, "networkingResourceGroupName", n.NetworkingResourceGroupName) - populate(objectMap, "organizationUnit", n.OrganizationUnit) - populate(objectMap, "provisioningState", n.ProvisioningState) - populate(objectMap, "subnetId", n.SubnetID) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkProperties. -func (n *NetworkProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PlanMember. +func (p *PlanMember) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "domainJoinType": - err = unpopulate(val, "DomainJoinType", &n.DomainJoinType) - delete(rawMsg, key) - case "domainName": - err = unpopulate(val, "DomainName", &n.DomainName) - delete(rawMsg, key) - case "domainPassword": - err = unpopulate(val, "DomainPassword", &n.DomainPassword) - delete(rawMsg, key) - case "domainUsername": - err = unpopulate(val, "DomainUsername", &n.DomainUsername) + case "id": + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) - case "healthCheckStatus": - err = unpopulate(val, "HealthCheckStatus", &n.HealthCheckStatus) + case "name": + err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) - case "networkingResourceGroupName": - err = unpopulate(val, "NetworkingResourceGroupName", &n.NetworkingResourceGroupName) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) - case "organizationUnit": - err = unpopulate(val, "OrganizationUnit", &n.OrganizationUnit) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &n.ProvisioningState) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) delete(rawMsg, key) - case "subnetId": - err = unpopulate(val, "SubnetID", &n.SubnetID) + case "type": + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Operation. -func (o Operation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PlanMemberProperties. +func (p PlanMemberProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "actionType", o.ActionType) - populate(objectMap, "display", o.Display) - populate(objectMap, "isDataAction", o.IsDataAction) - populate(objectMap, "name", o.Name) - populate(objectMap, "origin", o.Origin) + populate(objectMap, "memberId", p.MemberID) + populate(objectMap, "memberType", p.MemberType) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "syncStatus", p.SyncStatus) + populate(objectMap, "tier", p.Tier) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. -func (o *Operation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PlanMemberProperties. +func (p *PlanMemberProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "actionType": - err = unpopulate(val, "ActionType", &o.ActionType) + case "memberId": + err = unpopulate(val, "MemberID", &p.MemberID) delete(rawMsg, key) - case "display": - err = unpopulate(val, "Display", &o.Display) + case "memberType": + err = unpopulate(val, "MemberType", &p.MemberType) delete(rawMsg, key) - case "isDataAction": - err = unpopulate(val, "IsDataAction", &o.IsDataAction) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) + case "syncStatus": + err = unpopulate(val, "SyncStatus", &p.SyncStatus) delete(rawMsg, key) - case "origin": - err = unpopulate(val, "Origin", &o.Origin) + case "tier": + err = unpopulate(val, "Tier", &p.Tier) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. -func (o OperationDisplay) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PlanMemberSyncStatus. +func (p PlanMemberSyncStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", o.Description) - populate(objectMap, "operation", o.Operation) - populate(objectMap, "provider", o.Provider) - populate(objectMap, "resource", o.Resource) + populate(objectMap, "lastSyncError", p.LastSyncError) + populateDateTimeRFC3339(objectMap, "lastSyncTime", p.LastSyncTime) + populate(objectMap, "syncState", p.SyncState) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. -func (o *OperationDisplay) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PlanMemberSyncStatus. +func (p *PlanMemberSyncStatus) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &o.Description) - delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &o.Operation) + case "lastSyncError": + err = unpopulate(val, "LastSyncError", &p.LastSyncError) delete(rawMsg, key) - case "provider": - err = unpopulate(val, "Provider", &o.Provider) + case "lastSyncTime": + err = unpopulateDateTimeRFC3339(val, "LastSyncTime", &p.LastSyncTime) delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &o.Resource) + case "syncState": + err = unpopulate(val, "SyncState", &p.SyncState) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationListResult. -func (o OperationListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PlanMemberUpdate. +func (p PlanMemberUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "tags", p.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. -func (o *OperationListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PlanMemberUpdate. +func (p *PlanMemberUpdate) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &o.NextLink) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &o.Value) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationStatus. -func (o OperationStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PlanMemberUpdateProperties. +func (p PlanMemberUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "endTime", o.EndTime) - populate(objectMap, "error", o.Error) - populate(objectMap, "id", o.ID) - populate(objectMap, "name", o.Name) - populate(objectMap, "operations", o.Operations) - populate(objectMap, "percentComplete", o.PercentComplete) - populateAny(objectMap, "properties", o.Properties) - populate(objectMap, "resourceId", o.ResourceID) - populateDateTimeRFC3339(objectMap, "startTime", o.StartTime) - populate(objectMap, "status", o.Status) + populate(objectMap, "tier", p.Tier) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatus. -func (o *OperationStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PlanMemberUpdateProperties. +func (p *PlanMemberUpdateProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &o.EndTime) - delete(rawMsg, key) - case "error": - err = unpopulate(val, "Error", &o.Error) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &o.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - case "operations": - err = unpopulate(val, "Operations", &o.Operations) - delete(rawMsg, key) - case "percentComplete": - err = unpopulate(val, "PercentComplete", &o.PercentComplete) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &o.Properties) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &o.ResourceID) - delete(rawMsg, key) - case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &o.StartTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &o.Status) + case "tier": + err = unpopulate(val, "Tier", &p.Tier) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationStatusResult. -func (o OperationStatusResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PlanMembersListResult. +func (p PlanMembersListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "endTime", o.EndTime) - populate(objectMap, "error", o.Error) - populate(objectMap, "id", o.ID) - populate(objectMap, "name", o.Name) - populate(objectMap, "operations", o.Operations) - populate(objectMap, "percentComplete", o.PercentComplete) - populate(objectMap, "resourceId", o.ResourceID) - populateDateTimeRFC3339(objectMap, "startTime", o.StartTime) - populate(objectMap, "status", o.Status) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatusResult. -func (o *OperationStatusResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PlanMembersListResult. +func (p *PlanMembersListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &o.EndTime) - delete(rawMsg, key) - case "error": - err = unpopulate(val, "Error", &o.Error) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &o.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - case "operations": - err = unpopulate(val, "Operations", &o.Operations) - delete(rawMsg, key) - case "percentComplete": - err = unpopulate(val, "PercentComplete", &o.PercentComplete) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &o.ResourceID) - delete(rawMsg, key) - case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &o.StartTime) + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &o.Status) + case "value": + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OutboundEnvironmentEndpoint. -func (o OutboundEnvironmentEndpoint) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PlanProperties. +func (p PlanProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "category", o.Category) - populate(objectMap, "endpoints", o.Endpoints) + populate(objectMap, "provisioningState", p.ProvisioningState) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OutboundEnvironmentEndpoint. -func (o *OutboundEnvironmentEndpoint) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PlanProperties. +func (p *PlanProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "category": - err = unpopulate(val, "Category", &o.Category) - delete(rawMsg, key) - case "endpoints": - err = unpopulate(val, "Endpoints", &o.Endpoints) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OutboundEnvironmentEndpointCollection. -func (o OutboundEnvironmentEndpointCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PlanUpdate. +func (p PlanUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) + populate(objectMap, "location", p.Location) + populate(objectMap, "sku", p.SKU) + populate(objectMap, "tags", p.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OutboundEnvironmentEndpointCollection. -func (o *OutboundEnvironmentEndpointCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PlanUpdate. +func (p *PlanUpdate) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &o.NextLink) + case "location": + err = unpopulate(val, "Location", &p.Location) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &o.Value) + case "sku": + err = unpopulate(val, "SKU", &p.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil @@ -2856,6 +4309,41 @@ func (p *Pool) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type PoolDevBoxDefinition. +func (p PoolDevBoxDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "activeImageReference", p.ActiveImageReference) + populate(objectMap, "imageReference", p.ImageReference) + populate(objectMap, "sku", p.SKU) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PoolDevBoxDefinition. +func (p *PoolDevBoxDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "activeImageReference": + err = unpopulate(val, "ActiveImageReference", &p.ActiveImageReference) + delete(rawMsg, key) + case "imageReference": + err = unpopulate(val, "ImageReference", &p.ImageReference) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &p.SKU) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type PoolListResult. func (p PoolListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2891,7 +4379,9 @@ func (p *PoolListResult) UnmarshalJSON(data []byte) error { func (p PoolProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "devBoxCount", p.DevBoxCount) + populate(objectMap, "devBoxDefinition", p.DevBoxDefinition) populate(objectMap, "devBoxDefinitionName", p.DevBoxDefinitionName) + populate(objectMap, "devBoxDefinitionType", p.DevBoxDefinitionType) populate(objectMap, "displayName", p.DisplayName) populate(objectMap, "healthStatus", p.HealthStatus) populate(objectMap, "healthStatusDetails", p.HealthStatusDetails) @@ -2902,6 +4392,7 @@ func (p PoolProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "provisioningState", p.ProvisioningState) populate(objectMap, "singleSignOnStatus", p.SingleSignOnStatus) populate(objectMap, "stopOnDisconnect", p.StopOnDisconnect) + populate(objectMap, "stopOnNoConnect", p.StopOnNoConnect) populate(objectMap, "virtualNetworkType", p.VirtualNetworkType) return json.Marshal(objectMap) } @@ -2918,9 +4409,15 @@ func (p *PoolProperties) UnmarshalJSON(data []byte) error { case "devBoxCount": err = unpopulate(val, "DevBoxCount", &p.DevBoxCount) delete(rawMsg, key) + case "devBoxDefinition": + err = unpopulate(val, "DevBoxDefinition", &p.DevBoxDefinition) + delete(rawMsg, key) case "devBoxDefinitionName": err = unpopulate(val, "DevBoxDefinitionName", &p.DevBoxDefinitionName) delete(rawMsg, key) + case "devBoxDefinitionType": + err = unpopulate(val, "DevBoxDefinitionType", &p.DevBoxDefinitionType) + delete(rawMsg, key) case "displayName": err = unpopulate(val, "DisplayName", &p.DisplayName) delete(rawMsg, key) @@ -2951,6 +4448,9 @@ func (p *PoolProperties) UnmarshalJSON(data []byte) error { case "stopOnDisconnect": err = unpopulate(val, "StopOnDisconnect", &p.StopOnDisconnect) delete(rawMsg, key) + case "stopOnNoConnect": + err = unpopulate(val, "StopOnNoConnect", &p.StopOnNoConnect) + delete(rawMsg, key) case "virtualNetworkType": err = unpopulate(val, "VirtualNetworkType", &p.VirtualNetworkType) delete(rawMsg, key) @@ -3000,7 +4500,9 @@ func (p *PoolUpdate) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PoolUpdateProperties. func (p PoolUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "devBoxDefinition", p.DevBoxDefinition) populate(objectMap, "devBoxDefinitionName", p.DevBoxDefinitionName) + populate(objectMap, "devBoxDefinitionType", p.DevBoxDefinitionType) populate(objectMap, "displayName", p.DisplayName) populate(objectMap, "licenseType", p.LicenseType) populate(objectMap, "localAdministrator", p.LocalAdministrator) @@ -3008,6 +4510,7 @@ func (p PoolUpdateProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "networkConnectionName", p.NetworkConnectionName) populate(objectMap, "singleSignOnStatus", p.SingleSignOnStatus) populate(objectMap, "stopOnDisconnect", p.StopOnDisconnect) + populate(objectMap, "stopOnNoConnect", p.StopOnNoConnect) populate(objectMap, "virtualNetworkType", p.VirtualNetworkType) return json.Marshal(objectMap) } @@ -3021,9 +4524,15 @@ func (p *PoolUpdateProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "devBoxDefinition": + err = unpopulate(val, "DevBoxDefinition", &p.DevBoxDefinition) + delete(rawMsg, key) case "devBoxDefinitionName": err = unpopulate(val, "DevBoxDefinitionName", &p.DevBoxDefinitionName) delete(rawMsg, key) + case "devBoxDefinitionType": + err = unpopulate(val, "DevBoxDefinitionType", &p.DevBoxDefinitionType) + delete(rawMsg, key) case "displayName": err = unpopulate(val, "DisplayName", &p.DisplayName) delete(rawMsg, key) @@ -3045,6 +4554,9 @@ func (p *PoolUpdateProperties) UnmarshalJSON(data []byte) error { case "stopOnDisconnect": err = unpopulate(val, "StopOnDisconnect", &p.StopOnDisconnect) delete(rawMsg, key) + case "stopOnNoConnect": + err = unpopulate(val, "StopOnNoConnect", &p.StopOnNoConnect) + delete(rawMsg, key) case "virtualNetworkType": err = unpopulate(val, "VirtualNetworkType", &p.VirtualNetworkType) delete(rawMsg, key) @@ -3438,6 +4950,200 @@ func (p *ProjectListResult) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ProjectNetworkSettings. +func (p ProjectNetworkSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "microsoftHostedNetworkEnableStatus", p.MicrosoftHostedNetworkEnableStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProjectNetworkSettings. +func (p *ProjectNetworkSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "microsoftHostedNetworkEnableStatus": + err = unpopulate(val, "MicrosoftHostedNetworkEnableStatus", &p.MicrosoftHostedNetworkEnableStatus) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProjectPolicy. +func (p ProjectPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProjectPolicy. +func (p *ProjectPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProjectPolicyListResult. +func (p ProjectPolicyListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProjectPolicyListResult. +func (p *ProjectPolicyListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProjectPolicyProperties. +func (p ProjectPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "resourcePolicies", p.ResourcePolicies) + populate(objectMap, "scopes", p.Scopes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProjectPolicyProperties. +func (p *ProjectPolicyProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "resourcePolicies": + err = unpopulate(val, "ResourcePolicies", &p.ResourcePolicies) + delete(rawMsg, key) + case "scopes": + err = unpopulate(val, "Scopes", &p.Scopes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProjectPolicyUpdate. +func (p ProjectPolicyUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", p.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProjectPolicyUpdate. +func (p *ProjectPolicyUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProjectPolicyUpdateProperties. +func (p ProjectPolicyUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "resourcePolicies", p.ResourcePolicies) + populate(objectMap, "scopes", p.Scopes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProjectPolicyUpdateProperties. +func (p *ProjectPolicyUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "resourcePolicies": + err = unpopulate(val, "ResourcePolicies", &p.ResourcePolicies) + delete(rawMsg, key) + case "scopes": + err = unpopulate(val, "Scopes", &p.Scopes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ProjectProperties. func (p ProjectProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3574,11 +5280,15 @@ func (p *ProjectUpdateProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Properties. func (p Properties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "devBoxProvisioningSettings", p.DevBoxProvisioningSettings) populate(objectMap, "devCenterUri", p.DevCenterURI) populate(objectMap, "displayName", p.DisplayName) populate(objectMap, "encryption", p.Encryption) + populate(objectMap, "networkSettings", p.NetworkSettings) + populate(objectMap, "planId", p.PlanID) populate(objectMap, "projectCatalogSettings", p.ProjectCatalogSettings) populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "restrictedResourceTypes", p.RestrictedResourceTypes) return json.Marshal(objectMap) } @@ -3591,6 +5301,9 @@ func (p *Properties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "devBoxProvisioningSettings": + err = unpopulate(val, "DevBoxProvisioningSettings", &p.DevBoxProvisioningSettings) + delete(rawMsg, key) case "devCenterUri": err = unpopulate(val, "DevCenterURI", &p.DevCenterURI) delete(rawMsg, key) @@ -3600,12 +5313,21 @@ func (p *Properties) UnmarshalJSON(data []byte) error { case "encryption": err = unpopulate(val, "Encryption", &p.Encryption) delete(rawMsg, key) + case "networkSettings": + err = unpopulate(val, "NetworkSettings", &p.NetworkSettings) + delete(rawMsg, key) + case "planId": + err = unpopulate(val, "PlanID", &p.PlanID) + delete(rawMsg, key) case "projectCatalogSettings": err = unpopulate(val, "ProjectCatalogSettings", &p.ProjectCatalogSettings) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) delete(rawMsg, key) + case "restrictedResourceTypes": + err = unpopulate(val, "RestrictedResourceTypes", &p.RestrictedResourceTypes) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -3645,6 +5367,37 @@ func (r *RecommendedMachineConfiguration) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ResourcePolicy. +func (r ResourcePolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "filter", r.Filter) + populate(objectMap, "resources", r.Resources) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourcePolicy. +func (r *ResourcePolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "filter": + err = unpopulate(val, "Filter", &r.Filter) + delete(rawMsg, key) + case "resources": + err = unpopulate(val, "Resources", &r.Resources) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ResourceRange. func (r ResourceRange) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -4043,6 +5796,37 @@ func (s *StopOnDisconnectConfiguration) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type StopOnNoConnectConfiguration. +func (s StopOnNoConnectConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "gracePeriodMinutes", s.GracePeriodMinutes) + populate(objectMap, "status", s.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StopOnNoConnectConfiguration. +func (s *StopOnNoConnectConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "gracePeriodMinutes": + err = unpopulate(val, "GracePeriodMinutes", &s.GracePeriodMinutes) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type SyncErrorDetails. func (s SyncErrorDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -4218,9 +6002,13 @@ func (u *Update) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type UpdateProperties. func (u UpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "devBoxProvisioningSettings", u.DevBoxProvisioningSettings) populate(objectMap, "displayName", u.DisplayName) populate(objectMap, "encryption", u.Encryption) + populate(objectMap, "networkSettings", u.NetworkSettings) + populate(objectMap, "planId", u.PlanID) populate(objectMap, "projectCatalogSettings", u.ProjectCatalogSettings) + populate(objectMap, "restrictedResourceTypes", u.RestrictedResourceTypes) return json.Marshal(objectMap) } @@ -4233,15 +6021,27 @@ func (u *UpdateProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "devBoxProvisioningSettings": + err = unpopulate(val, "DevBoxProvisioningSettings", &u.DevBoxProvisioningSettings) + delete(rawMsg, key) case "displayName": err = unpopulate(val, "DisplayName", &u.DisplayName) delete(rawMsg, key) case "encryption": err = unpopulate(val, "Encryption", &u.Encryption) delete(rawMsg, key) + case "networkSettings": + err = unpopulate(val, "NetworkSettings", &u.NetworkSettings) + delete(rawMsg, key) + case "planId": + err = unpopulate(val, "PlanID", &u.PlanID) + delete(rawMsg, key) case "projectCatalogSettings": err = unpopulate(val, "ProjectCatalogSettings", &u.ProjectCatalogSettings) delete(rawMsg, key) + case "restrictedResourceTypes": + err = unpopulate(val, "RestrictedResourceTypes", &u.RestrictedResourceTypes) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", u, err) diff --git a/sdk/resourcemanager/devcenter/armdevcenter/networkconnections_client.go b/sdk/resourcemanager/devcenter/armdevcenter/networkconnections_client.go index 41986189a136..763842655e79 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/networkconnections_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/networkconnections_client.go @@ -47,7 +47,7 @@ func NewNetworkConnectionsClient(subscriptionID string, credential azcore.TokenC // BeginCreateOrUpdate - Creates or updates a Network Connections resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - networkConnectionName - Name of the Network Connection that can be applied to a Pool. // - body - Represents network connection @@ -74,7 +74,7 @@ func (client *NetworkConnectionsClient) BeginCreateOrUpdate(ctx context.Context, // CreateOrUpdate - Creates or updates a Network Connections resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *NetworkConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, networkConnectionName string, body NetworkConnection, options *NetworkConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "NetworkConnectionsClient.BeginCreateOrUpdate" @@ -116,7 +116,7 @@ func (client *NetworkConnectionsClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -128,7 +128,7 @@ func (client *NetworkConnectionsClient) createOrUpdateCreateRequest(ctx context. // BeginDelete - Deletes a Network Connections resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - networkConnectionName - Name of the Network Connection that can be applied to a Pool. // - options - NetworkConnectionsClientBeginDeleteOptions contains the optional parameters for the NetworkConnectionsClient.BeginDelete @@ -154,7 +154,7 @@ func (client *NetworkConnectionsClient) BeginDelete(ctx context.Context, resourc // Delete - Deletes a Network Connections resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *NetworkConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, networkConnectionName string, options *NetworkConnectionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "NetworkConnectionsClient.BeginDelete" @@ -196,7 +196,7 @@ func (client *NetworkConnectionsClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -205,7 +205,7 @@ func (client *NetworkConnectionsClient) deleteCreateRequest(ctx context.Context, // Get - Gets a network connection resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - networkConnectionName - Name of the Network Connection that can be applied to a Pool. // - options - NetworkConnectionsClientGetOptions contains the optional parameters for the NetworkConnectionsClient.Get method. @@ -251,7 +251,7 @@ func (client *NetworkConnectionsClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -269,7 +269,7 @@ func (client *NetworkConnectionsClient) getHandleResponse(resp *http.Response) ( // GetHealthDetails - Gets health check status details. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - networkConnectionName - Name of the Network Connection that can be applied to a Pool. // - options - NetworkConnectionsClientGetHealthDetailsOptions contains the optional parameters for the NetworkConnectionsClient.GetHealthDetails @@ -316,7 +316,7 @@ func (client *NetworkConnectionsClient) getHealthDetailsCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -333,7 +333,7 @@ func (client *NetworkConnectionsClient) getHealthDetailsHandleResponse(resp *htt // NewListByResourceGroupPager - Lists network connections in a resource group // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - NetworkConnectionsClientListByResourceGroupOptions contains the optional parameters for the NetworkConnectionsClient.NewListByResourceGroupPager // method. @@ -379,7 +379,7 @@ func (client *NetworkConnectionsClient) listByResourceGroupCreateRequest(ctx con if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -396,7 +396,7 @@ func (client *NetworkConnectionsClient) listByResourceGroupHandleResponse(resp * // NewListBySubscriptionPager - Lists network connections in a subscription // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - options - NetworkConnectionsClientListBySubscriptionOptions contains the optional parameters for the NetworkConnectionsClient.NewListBySubscriptionPager // method. func (client *NetworkConnectionsClient) NewListBySubscriptionPager(options *NetworkConnectionsClientListBySubscriptionOptions) *runtime.Pager[NetworkConnectionsClientListBySubscriptionResponse] { @@ -437,7 +437,7 @@ func (client *NetworkConnectionsClient) listBySubscriptionCreateRequest(ctx cont if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -454,7 +454,7 @@ func (client *NetworkConnectionsClient) listBySubscriptionHandleResponse(resp *h // NewListHealthDetailsPager - Lists health check status details // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - networkConnectionName - Name of the Network Connection that can be applied to a Pool. // - options - NetworkConnectionsClientListHealthDetailsOptions contains the optional parameters for the NetworkConnectionsClient.NewListHealthDetailsPager @@ -506,7 +506,7 @@ func (client *NetworkConnectionsClient) listHealthDetailsCreateRequest(ctx conte if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -524,7 +524,7 @@ func (client *NetworkConnectionsClient) listHealthDetailsHandleResponse(resp *ht // NewListOutboundNetworkDependenciesEndpointsPager - Lists the endpoints that agents may call as part of Dev Box service // administration. These FQDNs should be allowed for outbound access in order for the Dev Box service to function. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - networkConnectionName - Name of the Network Connection that can be applied to a Pool. // - options - NetworkConnectionsClientListOutboundNetworkDependenciesEndpointsOptions contains the optional parameters for @@ -575,7 +575,7 @@ func (client *NetworkConnectionsClient) listOutboundNetworkDependenciesEndpoints if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -594,7 +594,7 @@ func (client *NetworkConnectionsClient) listOutboundNetworkDependenciesEndpoints // Connection health check details // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - networkConnectionName - Name of the Network Connection that can be applied to a Pool. // - options - NetworkConnectionsClientBeginRunHealthChecksOptions contains the optional parameters for the NetworkConnectionsClient.BeginRunHealthChecks @@ -621,7 +621,7 @@ func (client *NetworkConnectionsClient) BeginRunHealthChecks(ctx context.Context // Connection health check details // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *NetworkConnectionsClient) runHealthChecks(ctx context.Context, resourceGroupName string, networkConnectionName string, options *NetworkConnectionsClientBeginRunHealthChecksOptions) (*http.Response, error) { var err error const operationName = "NetworkConnectionsClient.BeginRunHealthChecks" @@ -663,7 +663,7 @@ func (client *NetworkConnectionsClient) runHealthChecksCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -672,7 +672,7 @@ func (client *NetworkConnectionsClient) runHealthChecksCreateRequest(ctx context // BeginUpdate - Partially updates a Network Connection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - networkConnectionName - Name of the Network Connection that can be applied to a Pool. // - body - Represents network connection @@ -699,7 +699,7 @@ func (client *NetworkConnectionsClient) BeginUpdate(ctx context.Context, resourc // Update - Partially updates a Network Connection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *NetworkConnectionsClient) update(ctx context.Context, resourceGroupName string, networkConnectionName string, body NetworkConnectionUpdate, options *NetworkConnectionsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "NetworkConnectionsClient.BeginUpdate" @@ -741,7 +741,7 @@ func (client *NetworkConnectionsClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { diff --git a/sdk/resourcemanager/devcenter/armdevcenter/networkconnections_client_example_test.go b/sdk/resourcemanager/devcenter/armdevcenter/networkconnections_client_example_test.go deleted file mode 100644 index 234db29e4057..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/networkconnections_client_example_test.go +++ /dev/null @@ -1,467 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdevcenter_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/NetworkConnections_ListBySubscription.json -func ExampleNetworkConnectionsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewNetworkConnectionsClient().NewListBySubscriptionPager(&armdevcenter.NetworkConnectionsClientListBySubscriptionOptions{Top: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.NetworkConnectionListResult = armdevcenter.NetworkConnectionListResult{ - // Value: []*armdevcenter.NetworkConnection{ - // { - // Name: to.Ptr("uswest3network"), - // Type: to.Ptr("Microsoft.DevCenter/networkconnection"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/networkconnections/uswest3network"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Location: to.Ptr("centralus"), - // Properties: &armdevcenter.NetworkProperties{ - // DomainName: to.Ptr("mydomaincontroller.local"), - // DomainUsername: to.Ptr("testuser@mydomaincontroller.local"), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ExampleRG/providers/Microsoft.Network/virtualNetworks/ExampleVNet/subnets/default"), - // DomainJoinType: to.Ptr(armdevcenter.DomainJoinTypeHybridAzureADJoin), - // NetworkingResourceGroupName: to.Ptr("NetworkInterfaces"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/NetworkConnections_ListByResourceGroup.json -func ExampleNetworkConnectionsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewNetworkConnectionsClient().NewListByResourceGroupPager("rg1", &armdevcenter.NetworkConnectionsClientListByResourceGroupOptions{Top: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.NetworkConnectionListResult = armdevcenter.NetworkConnectionListResult{ - // Value: []*armdevcenter.NetworkConnection{ - // { - // Name: to.Ptr("uswest3network"), - // Type: to.Ptr("Microsoft.DevCenter/networkconnections"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/networkconnections/uswest3network"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Location: to.Ptr("centralus"), - // Properties: &armdevcenter.NetworkProperties{ - // DomainName: to.Ptr("mydomaincontroller.local"), - // DomainUsername: to.Ptr("testuser@mydomaincontroller.local"), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ExampleRG/providers/Microsoft.Network/virtualNetworks/ExampleVNet/subnets/default"), - // DomainJoinType: to.Ptr(armdevcenter.DomainJoinTypeHybridAzureADJoin), - // NetworkingResourceGroupName: to.Ptr("NetworkInterfaces"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/NetworkConnections_Get.json -func ExampleNetworkConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNetworkConnectionsClient().Get(ctx, "rg1", "uswest3network", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.NetworkConnection = armdevcenter.NetworkConnection{ - // Name: to.Ptr("uswest3network"), - // Type: to.Ptr("Microsoft.DevCenter/networkconnections"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/networkconnections/uswest3network"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Location: to.Ptr("centralus"), - // Properties: &armdevcenter.NetworkProperties{ - // DomainName: to.Ptr("mydomaincontroller.local"), - // DomainUsername: to.Ptr("testuser@mydomaincontroller.local"), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ExampleRG/providers/Microsoft.Network/virtualNetworks/ExampleVNet/subnets/default"), - // DomainJoinType: to.Ptr(armdevcenter.DomainJoinTypeHybridAzureADJoin), - // HealthCheckStatus: to.Ptr(armdevcenter.HealthCheckStatusPassed), - // NetworkingResourceGroupName: to.Ptr("NetworkInterfaces"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/NetworkConnections_Put.json -func ExampleNetworkConnectionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNetworkConnectionsClient().BeginCreateOrUpdate(ctx, "rg1", "uswest3network", armdevcenter.NetworkConnection{ - Location: to.Ptr("centralus"), - Properties: &armdevcenter.NetworkProperties{ - DomainName: to.Ptr("mydomaincontroller.local"), - DomainPassword: to.Ptr("Password value for user"), - DomainUsername: to.Ptr("testuser@mydomaincontroller.local"), - SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ExampleRG/providers/Microsoft.Network/virtualNetworks/ExampleVNet/subnets/default"), - DomainJoinType: to.Ptr(armdevcenter.DomainJoinTypeHybridAzureADJoin), - NetworkingResourceGroupName: to.Ptr("NetworkInterfaces"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.NetworkConnection = armdevcenter.NetworkConnection{ - // Name: to.Ptr("uswest3network"), - // Type: to.Ptr("Microsoft.DevCenter/networkconnections"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/networkconnections/uswest3network"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Location: to.Ptr("centralus"), - // Properties: &armdevcenter.NetworkProperties{ - // DomainName: to.Ptr("mydomaincontroller.local"), - // DomainUsername: to.Ptr("testuser@mydomaincontroller.local"), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ExampleRG/providers/Microsoft.Network/virtualNetworks/ExampleVNet/subnets/default"), - // DomainJoinType: to.Ptr(armdevcenter.DomainJoinTypeHybridAzureADJoin), - // NetworkingResourceGroupName: to.Ptr("NetworkInterfaces"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/NetworkConnections_Patch.json -func ExampleNetworkConnectionsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNetworkConnectionsClient().BeginUpdate(ctx, "rg1", "uswest3network", armdevcenter.NetworkConnectionUpdate{ - Properties: &armdevcenter.NetworkConnectionUpdateProperties{ - DomainPassword: to.Ptr("New Password value for user"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.NetworkConnection = armdevcenter.NetworkConnection{ - // Name: to.Ptr("uswest3network"), - // Type: to.Ptr("Microsoft.DevCenter/networkconnections"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/networkconnections/uswest3network"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Location: to.Ptr("centralus"), - // Properties: &armdevcenter.NetworkProperties{ - // DomainName: to.Ptr("mydomaincontroller.local"), - // DomainUsername: to.Ptr("testuser@mydomaincontroller.local"), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ExampleRG/providers/Microsoft.Network/virtualNetworks/ExampleVNet/subnets/default"), - // DomainJoinType: to.Ptr(armdevcenter.DomainJoinTypeHybridAzureADJoin), - // NetworkingResourceGroupName: to.Ptr("NetworkInterfaces"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/NetworkConnections_Delete.json -func ExampleNetworkConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNetworkConnectionsClient().BeginDelete(ctx, "rg1", "eastusnetwork", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/NetworkConnections_ListHealthDetails.json -func ExampleNetworkConnectionsClient_NewListHealthDetailsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewNetworkConnectionsClient().NewListHealthDetailsPager("rg1", "uswest3network", &armdevcenter.NetworkConnectionsClientListHealthDetailsOptions{Top: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.HealthCheckStatusDetailsListResult = armdevcenter.HealthCheckStatusDetailsListResult{ - // Value: []*armdevcenter.HealthCheckStatusDetails{ - // { - // Name: to.Ptr("latest"), - // Type: to.Ptr("Microsoft.DevCenter/networkconnections/healthchecks"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/networkconnections/uswest3network/healthchecks/latest"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("System"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("System"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeApplication), - // }, - // Properties: &armdevcenter.HealthCheckStatusDetailsProperties{ - // EndDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-03T12:43:15.000Z"); return t}()), - // HealthChecks: []*armdevcenter.HealthCheck{ - // { - // DisplayName: to.Ptr("Azure AD device sync"), - // EndDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-03T12:43:14.000Z"); return t}()), - // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-03T12:43:15.000Z"); return t}()), - // Status: to.Ptr(armdevcenter.HealthCheckStatusPassed), - // }}, - // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-03T12:43:14.000Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/NetworkConnections_GetHealthDetails.json -func ExampleNetworkConnectionsClient_GetHealthDetails() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNetworkConnectionsClient().GetHealthDetails(ctx, "rg1", "eastusnetwork", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.HealthCheckStatusDetails = armdevcenter.HealthCheckStatusDetails{ - // Name: to.Ptr("latest"), - // Type: to.Ptr("Microsoft.DevCenter/networkconnections/healthchecks"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/networkconnections/eastusnetwork/healthchecks/latest"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("System"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("System"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeApplication), - // }, - // Properties: &armdevcenter.HealthCheckStatusDetailsProperties{ - // EndDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-03T12:43:15.000Z"); return t}()), - // HealthChecks: []*armdevcenter.HealthCheck{ - // { - // DisplayName: to.Ptr("Azure AD device sync"), - // EndDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-03T12:43:14.000Z"); return t}()), - // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-03T12:43:15.000Z"); return t}()), - // Status: to.Ptr(armdevcenter.HealthCheckStatusPassed), - // }}, - // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-03T12:43:14.000Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/NetworkConnections_RunHealthChecks.json -func ExampleNetworkConnectionsClient_BeginRunHealthChecks() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNetworkConnectionsClient().BeginRunHealthChecks(ctx, "rg1", "uswest3network", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/NetworkConnections_ListOutboundNetworkDependenciesEndpoints.json -func ExampleNetworkConnectionsClient_NewListOutboundNetworkDependenciesEndpointsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewNetworkConnectionsClient().NewListOutboundNetworkDependenciesEndpointsPager("rg1", "uswest3network", &armdevcenter.NetworkConnectionsClientListOutboundNetworkDependenciesEndpointsOptions{Top: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OutboundEnvironmentEndpointCollection = armdevcenter.OutboundEnvironmentEndpointCollection{ - // Value: []*armdevcenter.OutboundEnvironmentEndpoint{ - // { - // Category: to.Ptr("Dev Box Service"), - // Endpoints: []*armdevcenter.EndpointDependency{ - // { - // DomainName: to.Ptr("devbox.azure.com"), - // EndpointDetails: []*armdevcenter.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // }}, - // }}, - // }, - // { - // Category: to.Ptr("Intune"), - // Endpoints: []*armdevcenter.EndpointDependency{ - // { - // DomainName: to.Ptr("login.microsoftonline.com"), - // EndpointDetails: []*armdevcenter.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // }}, - // }}, - // }, - // { - // Category: to.Ptr("Cloud PC"), - // Endpoints: []*armdevcenter.EndpointDependency{ - // { - // DomainName: to.Ptr("rdweb.wvd.microsoft.com"), - // EndpointDetails: []*armdevcenter.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // }}, - // }}, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/operations_client.go b/sdk/resourcemanager/devcenter/armdevcenter/operations_client.go index 017798a39af4..33aa9cd88318 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/operations_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/operations_client.go @@ -39,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available resource provider operations. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -72,7 +72,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/devcenter/armdevcenter/operations_client_example_test.go b/sdk/resourcemanager/devcenter/armdevcenter/operations_client_example_test.go deleted file mode 100644 index 277763ad12e7..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/operations_client_example_test.go +++ /dev/null @@ -1,54 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdevcenter_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Operations_Get.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armdevcenter.OperationListResult{ - // Value: []*armdevcenter.Operation{ - // { - // Name: to.Ptr("Microsoft.DevCenter/devcenters/write"), - // Display: &armdevcenter.OperationDisplay{ - // Operation: to.Ptr("write"), - // Provider: to.Ptr("Microsoft DevTest Center"), - // Resource: to.Ptr("Microsoft DevTest Center devcenter resource"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/operationstatuses_client.go b/sdk/resourcemanager/devcenter/armdevcenter/operationstatuses_client.go index d3da5f6c5832..fa218797ff3b 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/operationstatuses_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/operationstatuses_client.go @@ -46,7 +46,7 @@ func NewOperationStatusesClient(subscriptionID string, credential azcore.TokenCr // Get - Gets the current status of an async operation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - location - The Azure region // - operationID - The ID of an ongoing async operation // - options - OperationStatusesClientGetOptions contains the optional parameters for the OperationStatusesClient.Get method. @@ -92,7 +92,7 @@ func (client *OperationStatusesClient) getCreateRequest(ctx context.Context, loc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/devcenter/armdevcenter/operationstatuses_client_example_test.go b/sdk/resourcemanager/devcenter/armdevcenter/operationstatuses_client_example_test.go deleted file mode 100644 index 3b88ee410449..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/operationstatuses_client_example_test.go +++ /dev/null @@ -1,46 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdevcenter_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/OperationStatus_Get.json -func ExampleOperationStatusesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOperationStatusesClient().Get(ctx, "westus3", "3fa1a29d-e807-488d-81d1-f1c5456a08cd", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationStatus = armdevcenter.OperationStatus{ - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-01T15:16:55.100Z"); return t}()), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/providers/Microsoft.DevCenter/locations/CENTRALUS/operationStatuses/722e7bc4-60fa-4e6b-864f-d5bf12b9adc4"), - // PercentComplete: to.Ptr[float32](100), - // ResourceID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-01T15:16:29.500Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/options.go b/sdk/resourcemanager/devcenter/armdevcenter/options.go index 2a6631dc5e71..3dd04cf86879 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/options.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/options.go @@ -105,6 +105,55 @@ type CheckScopedNameAvailabilityClientExecuteOptions struct { // placeholder for future optional parameters } +// CurationProfilesClientBeginCreateOrUpdateOptions contains the optional parameters for the CurationProfilesClient.BeginCreateOrUpdate +// method. +type CurationProfilesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CurationProfilesClientBeginDeleteOptions contains the optional parameters for the CurationProfilesClient.BeginDelete method. +type CurationProfilesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CurationProfilesClientBeginUpdateOptions contains the optional parameters for the CurationProfilesClient.BeginUpdate method. +type CurationProfilesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CurationProfilesClientGetOptions contains the optional parameters for the CurationProfilesClient.Get method. +type CurationProfilesClientGetOptions struct { + // placeholder for future optional parameters +} + +// CurationProfilesClientListByDevCenterOptions contains the optional parameters for the CurationProfilesClient.NewListByDevCenterPager +// method. +type CurationProfilesClientListByDevCenterOptions struct { + // The maximum number of resources to return from the operation. Example: '$top=10'. + Top *int32 +} + +// CustomizationTasksClientGetErrorDetailsOptions contains the optional parameters for the CustomizationTasksClient.GetErrorDetails +// method. +type CustomizationTasksClientGetErrorDetailsOptions struct { + // placeholder for future optional parameters +} + +// CustomizationTasksClientGetOptions contains the optional parameters for the CustomizationTasksClient.Get method. +type CustomizationTasksClientGetOptions struct { + // placeholder for future optional parameters +} + +// CustomizationTasksClientListByCatalogOptions contains the optional parameters for the CustomizationTasksClient.NewListByCatalogPager +// method. +type CustomizationTasksClientListByCatalogOptions struct { + // The maximum number of resources to return from the operation. Example: '$top=10'. + Top *int32 +} + // DevBoxDefinitionsClientBeginCreateOrUpdateOptions contains the optional parameters for the DevBoxDefinitionsClient.BeginCreateOrUpdate // method. type DevBoxDefinitionsClientBeginCreateOrUpdateOptions struct { @@ -189,6 +238,36 @@ type DevCentersClientListBySubscriptionOptions struct { Top *int32 } +// EncryptionSetsClientBeginCreateOrUpdateOptions contains the optional parameters for the EncryptionSetsClient.BeginCreateOrUpdate +// method. +type EncryptionSetsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// EncryptionSetsClientBeginDeleteOptions contains the optional parameters for the EncryptionSetsClient.BeginDelete method. +type EncryptionSetsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// EncryptionSetsClientBeginUpdateOptions contains the optional parameters for the EncryptionSetsClient.BeginUpdate method. +type EncryptionSetsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// EncryptionSetsClientGetOptions contains the optional parameters for the EncryptionSetsClient.Get method. +type EncryptionSetsClientGetOptions struct { + // placeholder for future optional parameters +} + +// EncryptionSetsClientListOptions contains the optional parameters for the EncryptionSetsClient.NewListPager method. +type EncryptionSetsClientListOptions struct { + // The maximum number of resources to return from the operation. Example: '$top=10'. + Top *int32 +} + // EnvironmentDefinitionsClientGetByProjectCatalogOptions contains the optional parameters for the EnvironmentDefinitionsClient.GetByProjectCatalog // method. type EnvironmentDefinitionsClientGetByProjectCatalogOptions struct { @@ -272,6 +351,11 @@ type GalleriesClientListByDevCenterOptions struct { Top *int32 } +// ImageVersionsClientGetByProjectOptions contains the optional parameters for the ImageVersionsClient.GetByProject method. +type ImageVersionsClientGetByProjectOptions struct { + // placeholder for future optional parameters +} + // ImageVersionsClientGetOptions contains the optional parameters for the ImageVersionsClient.Get method. type ImageVersionsClientGetOptions struct { // placeholder for future optional parameters @@ -283,6 +367,17 @@ type ImageVersionsClientListByImageOptions struct { // placeholder for future optional parameters } +// ImageVersionsClientListByProjectOptions contains the optional parameters for the ImageVersionsClient.NewListByProjectPager +// method. +type ImageVersionsClientListByProjectOptions struct { + // placeholder for future optional parameters +} + +// ImagesClientGetByProjectOptions contains the optional parameters for the ImagesClient.GetByProject method. +type ImagesClientGetByProjectOptions struct { + // placeholder for future optional parameters +} + // ImagesClientGetOptions contains the optional parameters for the ImagesClient.Get method. type ImagesClientGetOptions struct { // placeholder for future optional parameters @@ -300,6 +395,11 @@ type ImagesClientListByGalleryOptions struct { Top *int32 } +// ImagesClientListByProjectOptions contains the optional parameters for the ImagesClient.NewListByProjectPager method. +type ImagesClientListByProjectOptions struct { + // placeholder for future optional parameters +} + // NetworkConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the NetworkConnectionsClient.BeginCreateOrUpdate // method. type NetworkConnectionsClientBeginCreateOrUpdateOptions struct { @@ -377,6 +477,72 @@ type OperationsClientListOptions struct { // placeholder for future optional parameters } +// PlanMembersClientBeginCreateOrUpdateOptions contains the optional parameters for the PlanMembersClient.BeginCreateOrUpdate +// method. +type PlanMembersClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PlanMembersClientBeginDeleteOptions contains the optional parameters for the PlanMembersClient.BeginDelete method. +type PlanMembersClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PlanMembersClientBeginUpdateOptions contains the optional parameters for the PlanMembersClient.BeginUpdate method. +type PlanMembersClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PlanMembersClientGetOptions contains the optional parameters for the PlanMembersClient.Get method. +type PlanMembersClientGetOptions struct { + // placeholder for future optional parameters +} + +// PlanMembersClientListOptions contains the optional parameters for the PlanMembersClient.NewListPager method. +type PlanMembersClientListOptions struct { + // The maximum number of resources to return from the operation. Example: '$top=10'. + Top *int32 +} + +// PlansClientBeginCreateOrUpdateOptions contains the optional parameters for the PlansClient.BeginCreateOrUpdate method. +type PlansClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PlansClientBeginDeleteOptions contains the optional parameters for the PlansClient.BeginDelete method. +type PlansClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PlansClientBeginUpdateOptions contains the optional parameters for the PlansClient.BeginUpdate method. +type PlansClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PlansClientGetOptions contains the optional parameters for the PlansClient.Get method. +type PlansClientGetOptions struct { + // placeholder for future optional parameters +} + +// PlansClientListByResourceGroupOptions contains the optional parameters for the PlansClient.NewListByResourceGroupPager +// method. +type PlansClientListByResourceGroupOptions struct { + // The maximum number of resources to return from the operation. Example: '$top=10'. + Top *int32 +} + +// PlansClientListBySubscriptionOptions contains the optional parameters for the PlansClient.NewListBySubscriptionPager method. +type PlansClientListBySubscriptionOptions struct { + // The maximum number of resources to return from the operation. Example: '$top=10'. + Top *int32 +} + // PoolsClientBeginCreateOrUpdateOptions contains the optional parameters for the PoolsClient.BeginCreateOrUpdate method. type PoolsClientBeginCreateOrUpdateOptions struct { // Resumes the LRO from the provided token. @@ -431,6 +597,51 @@ type ProjectCatalogEnvironmentDefinitionsClientGetErrorDetailsOptions struct { // placeholder for future optional parameters } +// ProjectCatalogImageDefinitionBuildClientBeginCancelOptions contains the optional parameters for the ProjectCatalogImageDefinitionBuildClient.BeginCancel +// method. +type ProjectCatalogImageDefinitionBuildClientBeginCancelOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ProjectCatalogImageDefinitionBuildClientGetBuildDetailsOptions contains the optional parameters for the ProjectCatalogImageDefinitionBuildClient.GetBuildDetails +// method. +type ProjectCatalogImageDefinitionBuildClientGetBuildDetailsOptions struct { + // placeholder for future optional parameters +} + +// ProjectCatalogImageDefinitionBuildClientGetOptions contains the optional parameters for the ProjectCatalogImageDefinitionBuildClient.Get +// method. +type ProjectCatalogImageDefinitionBuildClientGetOptions struct { + // placeholder for future optional parameters +} + +// ProjectCatalogImageDefinitionBuildsClientListByImageDefinitionOptions contains the optional parameters for the ProjectCatalogImageDefinitionBuildsClient.NewListByImageDefinitionPager +// method. +type ProjectCatalogImageDefinitionBuildsClientListByImageDefinitionOptions struct { + // placeholder for future optional parameters +} + +// ProjectCatalogImageDefinitionsClientBeginBuildImageOptions contains the optional parameters for the ProjectCatalogImageDefinitionsClient.BeginBuildImage +// method. +type ProjectCatalogImageDefinitionsClientBeginBuildImageOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ProjectCatalogImageDefinitionsClientGetByProjectCatalogOptions contains the optional parameters for the ProjectCatalogImageDefinitionsClient.GetByProjectCatalog +// method. +type ProjectCatalogImageDefinitionsClientGetByProjectCatalogOptions struct { + // placeholder for future optional parameters +} + +// ProjectCatalogImageDefinitionsClientListByProjectCatalogOptions contains the optional parameters for the ProjectCatalogImageDefinitionsClient.NewListByProjectCatalogPager +// method. +type ProjectCatalogImageDefinitionsClientListByProjectCatalogOptions struct { + // The maximum number of resources to return from the operation. Example: '$top=10'. + Top *int32 +} + // ProjectCatalogsClientBeginConnectOptions contains the optional parameters for the ProjectCatalogsClient.BeginConnect method. type ProjectCatalogsClientBeginConnectOptions struct { // Resumes the LRO from the provided token. @@ -509,6 +720,37 @@ type ProjectEnvironmentTypesClientUpdateOptions struct { // placeholder for future optional parameters } +// ProjectPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the ProjectPoliciesClient.BeginCreateOrUpdate +// method. +type ProjectPoliciesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ProjectPoliciesClientBeginDeleteOptions contains the optional parameters for the ProjectPoliciesClient.BeginDelete method. +type ProjectPoliciesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ProjectPoliciesClientBeginUpdateOptions contains the optional parameters for the ProjectPoliciesClient.BeginUpdate method. +type ProjectPoliciesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ProjectPoliciesClientGetOptions contains the optional parameters for the ProjectPoliciesClient.Get method. +type ProjectPoliciesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ProjectPoliciesClientListByDevCenterOptions contains the optional parameters for the ProjectPoliciesClient.NewListByDevCenterPager +// method. +type ProjectPoliciesClientListByDevCenterOptions struct { + // The maximum number of resources to return from the operation. Example: '$top=10'. + Top *int32 +} + // ProjectsClientBeginCreateOrUpdateOptions contains the optional parameters for the ProjectsClient.BeginCreateOrUpdate method. type ProjectsClientBeginCreateOrUpdateOptions struct { // Resumes the LRO from the provided token. @@ -527,6 +769,12 @@ type ProjectsClientBeginUpdateOptions struct { ResumeToken string } +// ProjectsClientGetInheritedSettingsOptions contains the optional parameters for the ProjectsClient.GetInheritedSettings +// method. +type ProjectsClientGetInheritedSettingsOptions struct { + // placeholder for future optional parameters +} + // ProjectsClientGetOptions contains the optional parameters for the ProjectsClient.Get method. type ProjectsClientGetOptions struct { // placeholder for future optional parameters @@ -546,6 +794,11 @@ type ProjectsClientListBySubscriptionOptions struct { Top *int32 } +// SKUsClientListByProjectOptions contains the optional parameters for the SKUsClient.NewListByProjectPager method. +type SKUsClientListByProjectOptions struct { + // placeholder for future optional parameters +} + // SKUsClientListBySubscriptionOptions contains the optional parameters for the SKUsClient.NewListBySubscriptionPager method. type SKUsClientListBySubscriptionOptions struct { // The maximum number of resources to return from the operation. Example: '$top=10'. diff --git a/sdk/resourcemanager/devcenter/armdevcenter/planmembers_client.go b/sdk/resourcemanager/devcenter/armdevcenter/planmembers_client.go new file mode 100644 index 000000000000..b783e7642b09 --- /dev/null +++ b/sdk/resourcemanager/devcenter/armdevcenter/planmembers_client.go @@ -0,0 +1,433 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdevcenter + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// PlanMembersClient contains the methods for the PlanMembers group. +// Don't use this type directly, use NewPlanMembersClient() instead. +type PlanMembersClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPlanMembersClient creates a new instance of PlanMembersClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewPlanMembersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PlanMembersClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PlanMembersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a devcenter plan member resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - planName - The name of the devcenter plan. +// - memberName - The name of a devcenter plan member. +// - body - Represents a devcenter plan. +// - options - PlanMembersClientBeginCreateOrUpdateOptions contains the optional parameters for the PlanMembersClient.BeginCreateOrUpdate +// method. +func (client *PlanMembersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, planName string, memberName string, body PlanMember, options *PlanMembersClientBeginCreateOrUpdateOptions) (*runtime.Poller[PlanMembersClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, planName, memberName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PlanMembersClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PlanMembersClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates or updates a devcenter plan member resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +func (client *PlanMembersClient) createOrUpdate(ctx context.Context, resourceGroupName string, planName string, memberName string, body PlanMember, options *PlanMembersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "PlanMembersClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, planName, memberName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *PlanMembersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, planName string, memberName string, body PlanMember, options *PlanMembersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/plans/{planName}/members/{memberName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if planName == "" { + return nil, errors.New("parameter planName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{planName}", url.PathEscape(planName)) + if memberName == "" { + return nil, errors.New("parameter memberName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{memberName}", url.PathEscape(memberName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a devcenter plan member +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - planName - The name of the devcenter plan. +// - memberName - The name of a devcenter plan member. +// - options - PlanMembersClientBeginDeleteOptions contains the optional parameters for the PlanMembersClient.BeginDelete method. +func (client *PlanMembersClient) BeginDelete(ctx context.Context, resourceGroupName string, planName string, memberName string, options *PlanMembersClientBeginDeleteOptions) (*runtime.Poller[PlanMembersClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, planName, memberName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PlanMembersClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PlanMembersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a devcenter plan member +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +func (client *PlanMembersClient) deleteOperation(ctx context.Context, resourceGroupName string, planName string, memberName string, options *PlanMembersClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "PlanMembersClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, planName, memberName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PlanMembersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, planName string, memberName string, options *PlanMembersClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/plans/{planName}/members/{memberName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if planName == "" { + return nil, errors.New("parameter planName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{planName}", url.PathEscape(planName)) + if memberName == "" { + return nil, errors.New("parameter memberName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{memberName}", url.PathEscape(memberName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a devcenter plan member. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - planName - The name of the devcenter plan. +// - memberName - The name of a devcenter plan member. +// - options - PlanMembersClientGetOptions contains the optional parameters for the PlanMembersClient.Get method. +func (client *PlanMembersClient) Get(ctx context.Context, resourceGroupName string, planName string, memberName string, options *PlanMembersClientGetOptions) (PlanMembersClientGetResponse, error) { + var err error + const operationName = "PlanMembersClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, planName, memberName, options) + if err != nil { + return PlanMembersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PlanMembersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PlanMembersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *PlanMembersClient) getCreateRequest(ctx context.Context, resourceGroupName string, planName string, memberName string, options *PlanMembersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/plans/{planName}/members/{memberName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if planName == "" { + return nil, errors.New("parameter planName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{planName}", url.PathEscape(planName)) + if memberName == "" { + return nil, errors.New("parameter memberName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{memberName}", url.PathEscape(memberName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PlanMembersClient) getHandleResponse(resp *http.Response) (PlanMembersClientGetResponse, error) { + result := PlanMembersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PlanMember); err != nil { + return PlanMembersClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all of the members assigned to a devcenter plan. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - planName - The name of the devcenter plan. +// - options - PlanMembersClientListOptions contains the optional parameters for the PlanMembersClient.NewListPager method. +func (client *PlanMembersClient) NewListPager(resourceGroupName string, planName string, options *PlanMembersClientListOptions) *runtime.Pager[PlanMembersClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[PlanMembersClientListResponse]{ + More: func(page PlanMembersClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PlanMembersClientListResponse) (PlanMembersClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PlanMembersClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, planName, options) + }, nil) + if err != nil { + return PlanMembersClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *PlanMembersClient) listCreateRequest(ctx context.Context, resourceGroupName string, planName string, options *PlanMembersClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/plans/{planName}/members" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if planName == "" { + return nil, errors.New("parameter planName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{planName}", url.PathEscape(planName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PlanMembersClient) listHandleResponse(resp *http.Response) (PlanMembersClientListResponse, error) { + result := PlanMembersClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PlanMembersListResult); err != nil { + return PlanMembersClientListResponse{}, err + } + return result, nil +} + +// BeginUpdate - Partially updates a devcenter plan member. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - planName - The name of the devcenter plan. +// - memberName - The name of a devcenter plan member. +// - body - Updatable devcenter plan properties. +// - options - PlanMembersClientBeginUpdateOptions contains the optional parameters for the PlanMembersClient.BeginUpdate method. +func (client *PlanMembersClient) BeginUpdate(ctx context.Context, resourceGroupName string, planName string, memberName string, body PlanMemberUpdate, options *PlanMembersClientBeginUpdateOptions) (*runtime.Poller[PlanMembersClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, planName, memberName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PlanMembersClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PlanMembersClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Partially updates a devcenter plan member. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +func (client *PlanMembersClient) update(ctx context.Context, resourceGroupName string, planName string, memberName string, body PlanMemberUpdate, options *PlanMembersClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "PlanMembersClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, planName, memberName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *PlanMembersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, planName string, memberName string, body PlanMemberUpdate, options *PlanMembersClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/plans/{planName}/members/{memberName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if planName == "" { + return nil, errors.New("parameter planName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{planName}", url.PathEscape(planName)) + if memberName == "" { + return nil, errors.New("parameter memberName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{memberName}", url.PathEscape(memberName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/plans_client.go b/sdk/resourcemanager/devcenter/armdevcenter/plans_client.go new file mode 100644 index 000000000000..139a8213f4ee --- /dev/null +++ b/sdk/resourcemanager/devcenter/armdevcenter/plans_client.go @@ -0,0 +1,467 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdevcenter + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// PlansClient contains the methods for the Plans group. +// Don't use this type directly, use NewPlansClient() instead. +type PlansClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPlansClient creates a new instance of PlansClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewPlansClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PlansClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PlansClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a devcenter plan resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - planName - The name of the devcenter plan. +// - body - Represents a devcenter plan. +// - options - PlansClientBeginCreateOrUpdateOptions contains the optional parameters for the PlansClient.BeginCreateOrUpdate +// method. +func (client *PlansClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, planName string, body Plan, options *PlansClientBeginCreateOrUpdateOptions) (*runtime.Poller[PlansClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, planName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PlansClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PlansClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates or updates a devcenter plan resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +func (client *PlansClient) createOrUpdate(ctx context.Context, resourceGroupName string, planName string, body Plan, options *PlansClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "PlansClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, planName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *PlansClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, planName string, body Plan, options *PlansClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/plans/{planName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if planName == "" { + return nil, errors.New("parameter planName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{planName}", url.PathEscape(planName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a devcenter plan +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - planName - The name of the devcenter plan. +// - options - PlansClientBeginDeleteOptions contains the optional parameters for the PlansClient.BeginDelete method. +func (client *PlansClient) BeginDelete(ctx context.Context, resourceGroupName string, planName string, options *PlansClientBeginDeleteOptions) (*runtime.Poller[PlansClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, planName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PlansClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PlansClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a devcenter plan +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +func (client *PlansClient) deleteOperation(ctx context.Context, resourceGroupName string, planName string, options *PlansClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "PlansClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, planName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PlansClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, planName string, options *PlansClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/plans/{planName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if planName == "" { + return nil, errors.New("parameter planName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{planName}", url.PathEscape(planName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a devcenter plan. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - planName - The name of the devcenter plan. +// - options - PlansClientGetOptions contains the optional parameters for the PlansClient.Get method. +func (client *PlansClient) Get(ctx context.Context, resourceGroupName string, planName string, options *PlansClientGetOptions) (PlansClientGetResponse, error) { + var err error + const operationName = "PlansClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, planName, options) + if err != nil { + return PlansClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PlansClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PlansClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *PlansClient) getCreateRequest(ctx context.Context, resourceGroupName string, planName string, options *PlansClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/plans/{planName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if planName == "" { + return nil, errors.New("parameter planName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{planName}", url.PathEscape(planName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PlansClient) getHandleResponse(resp *http.Response) (PlansClientGetResponse, error) { + result := PlansClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Plan); err != nil { + return PlansClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists all devcenter plans in a resource group. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - PlansClientListByResourceGroupOptions contains the optional parameters for the PlansClient.NewListByResourceGroupPager +// method. +func (client *PlansClient) NewListByResourceGroupPager(resourceGroupName string, options *PlansClientListByResourceGroupOptions) *runtime.Pager[PlansClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[PlansClientListByResourceGroupResponse]{ + More: func(page PlansClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PlansClientListByResourceGroupResponse) (PlansClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PlansClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return PlansClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *PlansClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *PlansClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/plans" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *PlansClient) listByResourceGroupHandleResponse(resp *http.Response) (PlansClientListByResourceGroupResponse, error) { + result := PlansClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PlanListResult); err != nil { + return PlansClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Lists all devcenter plans in a subscription. +// +// Generated from API version 2024-10-01-preview +// - options - PlansClientListBySubscriptionOptions contains the optional parameters for the PlansClient.NewListBySubscriptionPager +// method. +func (client *PlansClient) NewListBySubscriptionPager(options *PlansClientListBySubscriptionOptions) *runtime.Pager[PlansClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[PlansClientListBySubscriptionResponse]{ + More: func(page PlansClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PlansClientListBySubscriptionResponse) (PlansClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PlansClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return PlansClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *PlansClient) listBySubscriptionCreateRequest(ctx context.Context, options *PlansClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/plans" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *PlansClient) listBySubscriptionHandleResponse(resp *http.Response) (PlansClientListBySubscriptionResponse, error) { + result := PlansClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PlanListResult); err != nil { + return PlansClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginUpdate - Partially updates a devcenter plan. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - planName - The name of the devcenter plan. +// - body - Updatable devcenter plan properties. +// - options - PlansClientBeginUpdateOptions contains the optional parameters for the PlansClient.BeginUpdate method. +func (client *PlansClient) BeginUpdate(ctx context.Context, resourceGroupName string, planName string, body PlanUpdate, options *PlansClientBeginUpdateOptions) (*runtime.Poller[PlansClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, planName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PlansClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PlansClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Partially updates a devcenter plan. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +func (client *PlansClient) update(ctx context.Context, resourceGroupName string, planName string, body PlanUpdate, options *PlansClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "PlansClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, planName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *PlansClient) updateCreateRequest(ctx context.Context, resourceGroupName string, planName string, body PlanUpdate, options *PlansClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/plans/{planName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if planName == "" { + return nil, errors.New("parameter planName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{planName}", url.PathEscape(planName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/pools_client.go b/sdk/resourcemanager/devcenter/armdevcenter/pools_client.go index b2e7ad0f1588..b620bbf427cc 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/pools_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/pools_client.go @@ -47,7 +47,7 @@ func NewPoolsClient(subscriptionID string, credential azcore.TokenCredential, op // BeginCreateOrUpdate - Creates or updates a machine pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - poolName - Name of the pool. @@ -75,7 +75,7 @@ func (client *PoolsClient) BeginCreateOrUpdate(ctx context.Context, resourceGrou // CreateOrUpdate - Creates or updates a machine pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *PoolsClient) createOrUpdate(ctx context.Context, resourceGroupName string, projectName string, poolName string, body Pool, options *PoolsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "PoolsClient.BeginCreateOrUpdate" @@ -121,7 +121,7 @@ func (client *PoolsClient) createOrUpdateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -133,7 +133,7 @@ func (client *PoolsClient) createOrUpdateCreateRequest(ctx context.Context, reso // BeginDelete - Deletes a machine pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - poolName - Name of the pool. @@ -159,7 +159,7 @@ func (client *PoolsClient) BeginDelete(ctx context.Context, resourceGroupName st // Delete - Deletes a machine pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *PoolsClient) deleteOperation(ctx context.Context, resourceGroupName string, projectName string, poolName string, options *PoolsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "PoolsClient.BeginDelete" @@ -205,7 +205,7 @@ func (client *PoolsClient) deleteCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -214,7 +214,7 @@ func (client *PoolsClient) deleteCreateRequest(ctx context.Context, resourceGrou // Get - Gets a machine pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - poolName - Name of the pool. @@ -265,7 +265,7 @@ func (client *PoolsClient) getCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -282,7 +282,7 @@ func (client *PoolsClient) getHandleResponse(resp *http.Response) (PoolsClientGe // NewListByProjectPager - Lists pools for a project // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - options - PoolsClientListByProjectOptions contains the optional parameters for the PoolsClient.NewListByProjectPager method. @@ -332,7 +332,7 @@ func (client *PoolsClient) listByProjectCreateRequest(ctx context.Context, resou if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -350,7 +350,7 @@ func (client *PoolsClient) listByProjectHandleResponse(resp *http.Response) (Poo // BeginRunHealthChecks - Triggers a refresh of the pool status. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - poolName - Name of the pool. @@ -377,7 +377,7 @@ func (client *PoolsClient) BeginRunHealthChecks(ctx context.Context, resourceGro // RunHealthChecks - Triggers a refresh of the pool status. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *PoolsClient) runHealthChecks(ctx context.Context, resourceGroupName string, projectName string, poolName string, options *PoolsClientBeginRunHealthChecksOptions) (*http.Response, error) { var err error const operationName = "PoolsClient.BeginRunHealthChecks" @@ -423,7 +423,7 @@ func (client *PoolsClient) runHealthChecksCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -432,7 +432,7 @@ func (client *PoolsClient) runHealthChecksCreateRequest(ctx context.Context, res // BeginUpdate - Partially updates a machine pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - poolName - Name of the pool. @@ -459,7 +459,7 @@ func (client *PoolsClient) BeginUpdate(ctx context.Context, resourceGroupName st // Update - Partially updates a machine pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *PoolsClient) update(ctx context.Context, resourceGroupName string, projectName string, poolName string, body PoolUpdate, options *PoolsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "PoolsClient.BeginUpdate" @@ -505,7 +505,7 @@ func (client *PoolsClient) updateCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { diff --git a/sdk/resourcemanager/devcenter/armdevcenter/pools_client_example_test.go b/sdk/resourcemanager/devcenter/armdevcenter/pools_client_example_test.go deleted file mode 100644 index df5e4362da70..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/pools_client_example_test.go +++ /dev/null @@ -1,442 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdevcenter_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Pools_List.json -func ExamplePoolsClient_NewListByProjectPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPoolsClient().NewListByProjectPager("rg1", "DevProject", &armdevcenter.PoolsClientListByProjectOptions{Top: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PoolListResult = armdevcenter.PoolListResult{ - // Value: []*armdevcenter.Pool{ - // { - // Name: to.Ptr("DevPool"), - // Type: to.Ptr("Microsoft.DevCenter/pools"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/DevProject/pools/DevPool"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Location: to.Ptr("centralus"), - // Properties: &armdevcenter.PoolProperties{ - // DevBoxDefinitionName: to.Ptr("WebDevBox"), - // DisplayName: to.Ptr("Developer Pool"), - // LicenseType: to.Ptr(armdevcenter.LicenseTypeWindowsClient), - // LocalAdministrator: to.Ptr(armdevcenter.LocalAdminStatusEnabled), - // ManagedVirtualNetworkRegions: []*string{ - // to.Ptr("centralus")}, - // NetworkConnectionName: to.Ptr("Network1-westus2"), - // SingleSignOnStatus: to.Ptr(armdevcenter.SingleSignOnStatusDisabled), - // StopOnDisconnect: &armdevcenter.StopOnDisconnectConfiguration{ - // GracePeriodMinutes: to.Ptr[int32](60), - // Status: to.Ptr(armdevcenter.StopOnDisconnectEnableStatusEnabled), - // }, - // VirtualNetworkType: to.Ptr(armdevcenter.VirtualNetworkTypeManaged), - // DevBoxCount: to.Ptr[int32](1), - // HealthStatus: to.Ptr(armdevcenter.HealthStatusHealthy), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Pools_Get.json -func ExamplePoolsClient_Get_poolsGet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPoolsClient().Get(ctx, "rg1", "DevProject", "DevPool", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Pool = armdevcenter.Pool{ - // Name: to.Ptr("DevPool"), - // Type: to.Ptr("Microsoft.DevCenter/pools"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/DevProject/pools/DevPool"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Location: to.Ptr("centralus"), - // Properties: &armdevcenter.PoolProperties{ - // DevBoxDefinitionName: to.Ptr("WebDevBox"), - // DisplayName: to.Ptr("Developer Pool"), - // LicenseType: to.Ptr(armdevcenter.LicenseTypeWindowsClient), - // LocalAdministrator: to.Ptr(armdevcenter.LocalAdminStatusEnabled), - // ManagedVirtualNetworkRegions: []*string{ - // to.Ptr("centralus")}, - // NetworkConnectionName: to.Ptr("Network1-westus2"), - // SingleSignOnStatus: to.Ptr(armdevcenter.SingleSignOnStatusDisabled), - // StopOnDisconnect: &armdevcenter.StopOnDisconnectConfiguration{ - // GracePeriodMinutes: to.Ptr[int32](60), - // Status: to.Ptr(armdevcenter.StopOnDisconnectEnableStatusEnabled), - // }, - // VirtualNetworkType: to.Ptr(armdevcenter.VirtualNetworkTypeManaged), - // DevBoxCount: to.Ptr[int32](1), - // HealthStatus: to.Ptr(armdevcenter.HealthStatusHealthy), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Pools_GetUnhealthyStatus.json -func ExamplePoolsClient_Get_poolsGetUnhealthyStatus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPoolsClient().Get(ctx, "rg1", "DevProject", "DevPool", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Pool = armdevcenter.Pool{ - // Name: to.Ptr("DevPool"), - // Type: to.Ptr("Microsoft.DevCenter/pools"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/DevProject/pools/DevPool"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Location: to.Ptr("centralus"), - // Properties: &armdevcenter.PoolProperties{ - // DevBoxDefinitionName: to.Ptr("WebDevBox"), - // DisplayName: to.Ptr("Developer Pool"), - // LicenseType: to.Ptr(armdevcenter.LicenseTypeWindowsClient), - // LocalAdministrator: to.Ptr(armdevcenter.LocalAdminStatusEnabled), - // ManagedVirtualNetworkRegions: []*string{ - // to.Ptr("centralus")}, - // NetworkConnectionName: to.Ptr("Network1-westus2"), - // SingleSignOnStatus: to.Ptr(armdevcenter.SingleSignOnStatusDisabled), - // StopOnDisconnect: &armdevcenter.StopOnDisconnectConfiguration{ - // GracePeriodMinutes: to.Ptr[int32](60), - // Status: to.Ptr(armdevcenter.StopOnDisconnectEnableStatusEnabled), - // }, - // VirtualNetworkType: to.Ptr(armdevcenter.VirtualNetworkTypeManaged), - // DevBoxCount: to.Ptr[int32](1), - // HealthStatus: to.Ptr(armdevcenter.HealthStatusUnhealthy), - // HealthStatusDetails: []*armdevcenter.HealthStatusDetail{ - // { - // Code: to.Ptr("NetworkConnectionUnhealthy"), - // Message: to.Ptr("The Pool's Network Connection is in an unhealthy state. Check the Network Connection's health status for more details."), - // }, - // { - // Code: to.Ptr("ImageValidationFailed"), - // Message: to.Ptr("Image validation has failed. Check the Dev Box Definition's image validation status for more details."), - // }, - // { - // Code: to.Ptr("IntuneValidationFailed"), - // Message: to.Ptr("Intune license validation has failed. The tenant does not have a valid Intune license."), - // }}, - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Pools_Put.json -func ExamplePoolsClient_BeginCreateOrUpdate_poolsCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "DevProject", "DevPool", armdevcenter.Pool{ - Location: to.Ptr("centralus"), - Properties: &armdevcenter.PoolProperties{ - DevBoxDefinitionName: to.Ptr("WebDevBox"), - DisplayName: to.Ptr("Developer Pool"), - LicenseType: to.Ptr(armdevcenter.LicenseTypeWindowsClient), - LocalAdministrator: to.Ptr(armdevcenter.LocalAdminStatusEnabled), - NetworkConnectionName: to.Ptr("Network1-westus2"), - SingleSignOnStatus: to.Ptr(armdevcenter.SingleSignOnStatusDisabled), - StopOnDisconnect: &armdevcenter.StopOnDisconnectConfiguration{ - GracePeriodMinutes: to.Ptr[int32](60), - Status: to.Ptr(armdevcenter.StopOnDisconnectEnableStatusEnabled), - }, - VirtualNetworkType: to.Ptr(armdevcenter.VirtualNetworkTypeUnmanaged), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Pool = armdevcenter.Pool{ - // Name: to.Ptr("DevPool"), - // Type: to.Ptr("Microsoft.DevCenter/pools"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/DevProject/pools/DevPool"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Location: to.Ptr("centralus"), - // Properties: &armdevcenter.PoolProperties{ - // DevBoxDefinitionName: to.Ptr("WebDevBox"), - // DisplayName: to.Ptr("Developer Pool"), - // LicenseType: to.Ptr(armdevcenter.LicenseTypeWindowsClient), - // LocalAdministrator: to.Ptr(armdevcenter.LocalAdminStatusEnabled), - // ManagedVirtualNetworkRegions: []*string{ - // }, - // NetworkConnectionName: to.Ptr("Network1-westus2"), - // SingleSignOnStatus: to.Ptr(armdevcenter.SingleSignOnStatusDisabled), - // StopOnDisconnect: &armdevcenter.StopOnDisconnectConfiguration{ - // GracePeriodMinutes: to.Ptr[int32](60), - // Status: to.Ptr(armdevcenter.StopOnDisconnectEnableStatusEnabled), - // }, - // VirtualNetworkType: to.Ptr(armdevcenter.VirtualNetworkTypeUnmanaged), - // DevBoxCount: to.Ptr[int32](1), - // HealthStatus: to.Ptr(armdevcenter.HealthStatusHealthy), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Pools_PutWithManagedNetwork.json -func ExamplePoolsClient_BeginCreateOrUpdate_poolsCreateOrUpdateWithManagedNetwork() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPoolsClient().BeginCreateOrUpdate(ctx, "rg1", "DevProject", "DevPool", armdevcenter.Pool{ - Location: to.Ptr("centralus"), - Properties: &armdevcenter.PoolProperties{ - DevBoxDefinitionName: to.Ptr("WebDevBox"), - DisplayName: to.Ptr("Developer Pool"), - LicenseType: to.Ptr(armdevcenter.LicenseTypeWindowsClient), - LocalAdministrator: to.Ptr(armdevcenter.LocalAdminStatusEnabled), - ManagedVirtualNetworkRegions: []*string{ - to.Ptr("centralus")}, - NetworkConnectionName: to.Ptr("managedNetwork"), - SingleSignOnStatus: to.Ptr(armdevcenter.SingleSignOnStatusDisabled), - StopOnDisconnect: &armdevcenter.StopOnDisconnectConfiguration{ - GracePeriodMinutes: to.Ptr[int32](60), - Status: to.Ptr(armdevcenter.StopOnDisconnectEnableStatusEnabled), - }, - VirtualNetworkType: to.Ptr(armdevcenter.VirtualNetworkTypeManaged), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Pool = armdevcenter.Pool{ - // Name: to.Ptr("DevPool"), - // Type: to.Ptr("Microsoft.DevCenter/pools"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/DevProject/pools/DevPool"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Location: to.Ptr("centralus"), - // Properties: &armdevcenter.PoolProperties{ - // DevBoxDefinitionName: to.Ptr("WebDevBox"), - // DisplayName: to.Ptr("Developer Pool"), - // LicenseType: to.Ptr(armdevcenter.LicenseTypeWindowsClient), - // LocalAdministrator: to.Ptr(armdevcenter.LocalAdminStatusEnabled), - // ManagedVirtualNetworkRegions: []*string{ - // to.Ptr("centralus")}, - // NetworkConnectionName: to.Ptr("managedNetwork"), - // SingleSignOnStatus: to.Ptr(armdevcenter.SingleSignOnStatusDisabled), - // StopOnDisconnect: &armdevcenter.StopOnDisconnectConfiguration{ - // GracePeriodMinutes: to.Ptr[int32](60), - // Status: to.Ptr(armdevcenter.StopOnDisconnectEnableStatusEnabled), - // }, - // VirtualNetworkType: to.Ptr(armdevcenter.VirtualNetworkTypeManaged), - // DevBoxCount: to.Ptr[int32](1), - // HealthStatus: to.Ptr(armdevcenter.HealthStatusHealthy), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Pools_Patch.json -func ExamplePoolsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPoolsClient().BeginUpdate(ctx, "rg1", "DevProject", "DevPool", armdevcenter.PoolUpdate{ - Properties: &armdevcenter.PoolUpdateProperties{ - DevBoxDefinitionName: to.Ptr("WebDevBox2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Pool = armdevcenter.Pool{ - // Name: to.Ptr("DevPool"), - // Type: to.Ptr("Microsoft.DevCenter/pools"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/DevProject/pools/DevPool"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Location: to.Ptr("centralus"), - // Properties: &armdevcenter.PoolProperties{ - // DevBoxDefinitionName: to.Ptr("WebDevBox2"), - // DisplayName: to.Ptr("Developer Pool"), - // LicenseType: to.Ptr(armdevcenter.LicenseTypeWindowsClient), - // LocalAdministrator: to.Ptr(armdevcenter.LocalAdminStatusEnabled), - // ManagedVirtualNetworkRegions: []*string{ - // to.Ptr("centralus")}, - // NetworkConnectionName: to.Ptr("Network1-westus2"), - // SingleSignOnStatus: to.Ptr(armdevcenter.SingleSignOnStatusDisabled), - // StopOnDisconnect: &armdevcenter.StopOnDisconnectConfiguration{ - // GracePeriodMinutes: to.Ptr[int32](60), - // Status: to.Ptr(armdevcenter.StopOnDisconnectEnableStatusEnabled), - // }, - // VirtualNetworkType: to.Ptr(armdevcenter.VirtualNetworkTypeManaged), - // DevBoxCount: to.Ptr[int32](1), - // HealthStatus: to.Ptr(armdevcenter.HealthStatusHealthy), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Pools_Delete.json -func ExamplePoolsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPoolsClient().BeginDelete(ctx, "rg1", "DevProject", "poolName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Pools_RunHealthChecks.json -func ExamplePoolsClient_BeginRunHealthChecks() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPoolsClient().BeginRunHealthChecks(ctx, "rg1", "DevProject", "DevPool", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/projectallowedenvironmenttypes_client.go b/sdk/resourcemanager/devcenter/armdevcenter/projectallowedenvironmenttypes_client.go index cd25da433bce..60b500b2ccd9 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/projectallowedenvironmenttypes_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/projectallowedenvironmenttypes_client.go @@ -47,7 +47,7 @@ func NewProjectAllowedEnvironmentTypesClient(subscriptionID string, credential a // Get - Gets an allowed environment type. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - environmentTypeName - The name of the environment type. @@ -99,7 +99,7 @@ func (client *ProjectAllowedEnvironmentTypesClient) getCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -116,7 +116,7 @@ func (client *ProjectAllowedEnvironmentTypesClient) getHandleResponse(resp *http // NewListPager - Lists allowed environment types for a project. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - options - ProjectAllowedEnvironmentTypesClientListOptions contains the optional parameters for the ProjectAllowedEnvironmentTypesClient.NewListPager @@ -167,7 +167,7 @@ func (client *ProjectAllowedEnvironmentTypesClient) listCreateRequest(ctx contex if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/devcenter/armdevcenter/projectallowedenvironmenttypes_client_example_test.go b/sdk/resourcemanager/devcenter/armdevcenter/projectallowedenvironmenttypes_client_example_test.go deleted file mode 100644 index bed021c1a96f..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/projectallowedenvironmenttypes_client_example_test.go +++ /dev/null @@ -1,92 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdevcenter_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/ProjectAllowedEnvironmentTypes_List.json -func ExampleProjectAllowedEnvironmentTypesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProjectAllowedEnvironmentTypesClient().NewListPager("rg1", "Contoso", &armdevcenter.ProjectAllowedEnvironmentTypesClientListOptions{Top: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AllowedEnvironmentTypeListResult = armdevcenter.AllowedEnvironmentTypeListResult{ - // Value: []*armdevcenter.AllowedEnvironmentType{ - // { - // Name: to.Ptr("DevTest"), - // Type: to.Ptr("Microsoft.DevCenter/projects/allowedenvironmenttypes"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/Contoso/allowedEnvironmentTypes/DevTest"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // CreatedBy: to.Ptr("User1@contoso.com"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // LastModifiedBy: to.Ptr("User1@contoso.com"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/ProjectAllowedEnvironmentTypes_Get.json -func ExampleProjectAllowedEnvironmentTypesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProjectAllowedEnvironmentTypesClient().Get(ctx, "rg1", "Contoso", "DevTest", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AllowedEnvironmentType = armdevcenter.AllowedEnvironmentType{ - // Name: to.Ptr("DevTest"), - // Type: to.Ptr("Microsoft.DevCenter/projects/allowedenvironmenttypes"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/Contoso/allowedEnvironmentTypes/DevTest"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // CreatedBy: to.Ptr("User1@contoso.com"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // LastModifiedBy: to.Ptr("User1@contoso.com"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // } -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/projectcatalogenvironmentdefinitions_client.go b/sdk/resourcemanager/devcenter/armdevcenter/projectcatalogenvironmentdefinitions_client.go index f8657098678f..82a94c8d14f6 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/projectcatalogenvironmentdefinitions_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/projectcatalogenvironmentdefinitions_client.go @@ -46,7 +46,7 @@ func NewProjectCatalogEnvironmentDefinitionsClient(subscriptionID string, creden // GetErrorDetails - Gets Environment Definition error details // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - catalogName - The name of the Catalog. @@ -103,7 +103,7 @@ func (client *ProjectCatalogEnvironmentDefinitionsClient) getErrorDetailsCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/devcenter/armdevcenter/projectcatalogenvironmentdefinitions_client_example_test.go b/sdk/resourcemanager/devcenter/armdevcenter/projectcatalogenvironmentdefinitions_client_example_test.go deleted file mode 100644 index c73c9a058c81..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/projectcatalogenvironmentdefinitions_client_example_test.go +++ /dev/null @@ -1,45 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdevcenter_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/ProjectCatalogEnvironmentDefinitions_GetErrorDetails.json -func ExampleProjectCatalogEnvironmentDefinitionsClient_GetErrorDetails() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProjectCatalogEnvironmentDefinitionsClient().GetErrorDetails(ctx, "rg1", "DevProject", "myCatalog", "myEnvironmentDefinition", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CatalogResourceValidationErrorDetails = armdevcenter.CatalogResourceValidationErrorDetails{ - // Errors: []*armdevcenter.CatalogErrorDetails{ - // { - // Code: to.Ptr("ParameterValueInvalid"), - // Message: to.Ptr("Expected parameter value for 'InstanceCount' to be integer but found the string 'test'."), - // }}, - // } -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/projectcatalogimagedefinitionbuild_client.go b/sdk/resourcemanager/devcenter/armdevcenter/projectcatalogimagedefinitionbuild_client.go new file mode 100644 index 000000000000..0c5cc329230d --- /dev/null +++ b/sdk/resourcemanager/devcenter/armdevcenter/projectcatalogimagedefinitionbuild_client.go @@ -0,0 +1,296 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdevcenter + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ProjectCatalogImageDefinitionBuildClient contains the methods for the ProjectCatalogImageDefinitionBuild group. +// Don't use this type directly, use NewProjectCatalogImageDefinitionBuildClient() instead. +type ProjectCatalogImageDefinitionBuildClient struct { + internal *arm.Client + subscriptionID string +} + +// NewProjectCatalogImageDefinitionBuildClient creates a new instance of ProjectCatalogImageDefinitionBuildClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewProjectCatalogImageDefinitionBuildClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProjectCatalogImageDefinitionBuildClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ProjectCatalogImageDefinitionBuildClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCancel - Cancels the specified build for an image definition. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - projectName - The name of the project. +// - catalogName - The name of the Catalog. +// - imageDefinitionName - The name of the Image Definition. +// - buildName - The ID of the Image Definition Build. +// - options - ProjectCatalogImageDefinitionBuildClientBeginCancelOptions contains the optional parameters for the ProjectCatalogImageDefinitionBuildClient.BeginCancel +// method. +func (client *ProjectCatalogImageDefinitionBuildClient) BeginCancel(ctx context.Context, resourceGroupName string, projectName string, catalogName string, imageDefinitionName string, buildName string, options *ProjectCatalogImageDefinitionBuildClientBeginCancelOptions) (*runtime.Poller[ProjectCatalogImageDefinitionBuildClientCancelResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.cancel(ctx, resourceGroupName, projectName, catalogName, imageDefinitionName, buildName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProjectCatalogImageDefinitionBuildClientCancelResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ProjectCatalogImageDefinitionBuildClientCancelResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Cancel - Cancels the specified build for an image definition. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +func (client *ProjectCatalogImageDefinitionBuildClient) cancel(ctx context.Context, resourceGroupName string, projectName string, catalogName string, imageDefinitionName string, buildName string, options *ProjectCatalogImageDefinitionBuildClientBeginCancelOptions) (*http.Response, error) { + var err error + const operationName = "ProjectCatalogImageDefinitionBuildClient.BeginCancel" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.cancelCreateRequest(ctx, resourceGroupName, projectName, catalogName, imageDefinitionName, buildName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// cancelCreateRequest creates the Cancel request. +func (client *ProjectCatalogImageDefinitionBuildClient) cancelCreateRequest(ctx context.Context, resourceGroupName string, projectName string, catalogName string, imageDefinitionName string, buildName string, options *ProjectCatalogImageDefinitionBuildClientBeginCancelOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects/{projectName}/catalogs/{catalogName}/imageDefinitions/{imageDefinitionName}/builds/{buildName}/cancel" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if catalogName == "" { + return nil, errors.New("parameter catalogName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{catalogName}", url.PathEscape(catalogName)) + if imageDefinitionName == "" { + return nil, errors.New("parameter imageDefinitionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{imageDefinitionName}", url.PathEscape(imageDefinitionName)) + if buildName == "" { + return nil, errors.New("parameter buildName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{buildName}", url.PathEscape(buildName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a build for a specified image definition. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - projectName - The name of the project. +// - catalogName - The name of the Catalog. +// - imageDefinitionName - The name of the Image Definition. +// - buildName - The ID of the Image Definition Build. +// - options - ProjectCatalogImageDefinitionBuildClientGetOptions contains the optional parameters for the ProjectCatalogImageDefinitionBuildClient.Get +// method. +func (client *ProjectCatalogImageDefinitionBuildClient) Get(ctx context.Context, resourceGroupName string, projectName string, catalogName string, imageDefinitionName string, buildName string, options *ProjectCatalogImageDefinitionBuildClientGetOptions) (ProjectCatalogImageDefinitionBuildClientGetResponse, error) { + var err error + const operationName = "ProjectCatalogImageDefinitionBuildClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, catalogName, imageDefinitionName, buildName, options) + if err != nil { + return ProjectCatalogImageDefinitionBuildClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProjectCatalogImageDefinitionBuildClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProjectCatalogImageDefinitionBuildClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ProjectCatalogImageDefinitionBuildClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, catalogName string, imageDefinitionName string, buildName string, options *ProjectCatalogImageDefinitionBuildClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects/{projectName}/catalogs/{catalogName}/imageDefinitions/{imageDefinitionName}/builds/{buildName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if catalogName == "" { + return nil, errors.New("parameter catalogName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{catalogName}", url.PathEscape(catalogName)) + if imageDefinitionName == "" { + return nil, errors.New("parameter imageDefinitionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{imageDefinitionName}", url.PathEscape(imageDefinitionName)) + if buildName == "" { + return nil, errors.New("parameter buildName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{buildName}", url.PathEscape(buildName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ProjectCatalogImageDefinitionBuildClient) getHandleResponse(resp *http.Response) (ProjectCatalogImageDefinitionBuildClientGetResponse, error) { + result := ProjectCatalogImageDefinitionBuildClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ImageDefinitionBuild); err != nil { + return ProjectCatalogImageDefinitionBuildClientGetResponse{}, err + } + return result, nil +} + +// GetBuildDetails - Gets Build details +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - projectName - The name of the project. +// - catalogName - The name of the Catalog. +// - imageDefinitionName - The name of the Image Definition. +// - buildName - The ID of the Image Definition Build. +// - options - ProjectCatalogImageDefinitionBuildClientGetBuildDetailsOptions contains the optional parameters for the ProjectCatalogImageDefinitionBuildClient.GetBuildDetails +// method. +func (client *ProjectCatalogImageDefinitionBuildClient) GetBuildDetails(ctx context.Context, resourceGroupName string, projectName string, catalogName string, imageDefinitionName string, buildName string, options *ProjectCatalogImageDefinitionBuildClientGetBuildDetailsOptions) (ProjectCatalogImageDefinitionBuildClientGetBuildDetailsResponse, error) { + var err error + const operationName = "ProjectCatalogImageDefinitionBuildClient.GetBuildDetails" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getBuildDetailsCreateRequest(ctx, resourceGroupName, projectName, catalogName, imageDefinitionName, buildName, options) + if err != nil { + return ProjectCatalogImageDefinitionBuildClientGetBuildDetailsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProjectCatalogImageDefinitionBuildClientGetBuildDetailsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProjectCatalogImageDefinitionBuildClientGetBuildDetailsResponse{}, err + } + resp, err := client.getBuildDetailsHandleResponse(httpResp) + return resp, err +} + +// getBuildDetailsCreateRequest creates the GetBuildDetails request. +func (client *ProjectCatalogImageDefinitionBuildClient) getBuildDetailsCreateRequest(ctx context.Context, resourceGroupName string, projectName string, catalogName string, imageDefinitionName string, buildName string, options *ProjectCatalogImageDefinitionBuildClientGetBuildDetailsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects/{projectName}/catalogs/{catalogName}/imageDefinitions/{imageDefinitionName}/builds/{buildName}/getBuildDetails" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if catalogName == "" { + return nil, errors.New("parameter catalogName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{catalogName}", url.PathEscape(catalogName)) + if imageDefinitionName == "" { + return nil, errors.New("parameter imageDefinitionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{imageDefinitionName}", url.PathEscape(imageDefinitionName)) + if buildName == "" { + return nil, errors.New("parameter buildName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{buildName}", url.PathEscape(buildName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getBuildDetailsHandleResponse handles the GetBuildDetails response. +func (client *ProjectCatalogImageDefinitionBuildClient) getBuildDetailsHandleResponse(resp *http.Response) (ProjectCatalogImageDefinitionBuildClientGetBuildDetailsResponse, error) { + result := ProjectCatalogImageDefinitionBuildClientGetBuildDetailsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ImageDefinitionBuildDetails); err != nil { + return ProjectCatalogImageDefinitionBuildClientGetBuildDetailsResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/projectcatalogimagedefinitionbuilds_client.go b/sdk/resourcemanager/devcenter/armdevcenter/projectcatalogimagedefinitionbuilds_client.go new file mode 100644 index 000000000000..a7e1a7f73c3c --- /dev/null +++ b/sdk/resourcemanager/devcenter/armdevcenter/projectcatalogimagedefinitionbuilds_client.go @@ -0,0 +1,119 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdevcenter + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ProjectCatalogImageDefinitionBuildsClient contains the methods for the ProjectCatalogImageDefinitionBuilds group. +// Don't use this type directly, use NewProjectCatalogImageDefinitionBuildsClient() instead. +type ProjectCatalogImageDefinitionBuildsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewProjectCatalogImageDefinitionBuildsClient creates a new instance of ProjectCatalogImageDefinitionBuildsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewProjectCatalogImageDefinitionBuildsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProjectCatalogImageDefinitionBuildsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ProjectCatalogImageDefinitionBuildsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListByImageDefinitionPager - Lists builds for a specified image definition. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - projectName - The name of the project. +// - catalogName - The name of the Catalog. +// - imageDefinitionName - The name of the Image Definition. +// - options - ProjectCatalogImageDefinitionBuildsClientListByImageDefinitionOptions contains the optional parameters for the +// ProjectCatalogImageDefinitionBuildsClient.NewListByImageDefinitionPager method. +func (client *ProjectCatalogImageDefinitionBuildsClient) NewListByImageDefinitionPager(resourceGroupName string, projectName string, catalogName string, imageDefinitionName string, options *ProjectCatalogImageDefinitionBuildsClientListByImageDefinitionOptions) *runtime.Pager[ProjectCatalogImageDefinitionBuildsClientListByImageDefinitionResponse] { + return runtime.NewPager(runtime.PagingHandler[ProjectCatalogImageDefinitionBuildsClientListByImageDefinitionResponse]{ + More: func(page ProjectCatalogImageDefinitionBuildsClientListByImageDefinitionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ProjectCatalogImageDefinitionBuildsClientListByImageDefinitionResponse) (ProjectCatalogImageDefinitionBuildsClientListByImageDefinitionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ProjectCatalogImageDefinitionBuildsClient.NewListByImageDefinitionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByImageDefinitionCreateRequest(ctx, resourceGroupName, projectName, catalogName, imageDefinitionName, options) + }, nil) + if err != nil { + return ProjectCatalogImageDefinitionBuildsClientListByImageDefinitionResponse{}, err + } + return client.listByImageDefinitionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByImageDefinitionCreateRequest creates the ListByImageDefinition request. +func (client *ProjectCatalogImageDefinitionBuildsClient) listByImageDefinitionCreateRequest(ctx context.Context, resourceGroupName string, projectName string, catalogName string, imageDefinitionName string, options *ProjectCatalogImageDefinitionBuildsClientListByImageDefinitionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects/{projectName}/catalogs/{catalogName}/imageDefinitions/{imageDefinitionName}/builds" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if catalogName == "" { + return nil, errors.New("parameter catalogName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{catalogName}", url.PathEscape(catalogName)) + if imageDefinitionName == "" { + return nil, errors.New("parameter imageDefinitionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{imageDefinitionName}", url.PathEscape(imageDefinitionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByImageDefinitionHandleResponse handles the ListByImageDefinition response. +func (client *ProjectCatalogImageDefinitionBuildsClient) listByImageDefinitionHandleResponse(resp *http.Response) (ProjectCatalogImageDefinitionBuildsClientListByImageDefinitionResponse, error) { + result := ProjectCatalogImageDefinitionBuildsClientListByImageDefinitionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ImageDefinitionBuildListResult); err != nil { + return ProjectCatalogImageDefinitionBuildsClientListByImageDefinitionResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/projectcatalogimagedefinitions_client.go b/sdk/resourcemanager/devcenter/armdevcenter/projectcatalogimagedefinitions_client.go new file mode 100644 index 000000000000..a9d316cb883d --- /dev/null +++ b/sdk/resourcemanager/devcenter/armdevcenter/projectcatalogimagedefinitions_client.go @@ -0,0 +1,280 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdevcenter + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// ProjectCatalogImageDefinitionsClient contains the methods for the ProjectCatalogImageDefinitions group. +// Don't use this type directly, use NewProjectCatalogImageDefinitionsClient() instead. +type ProjectCatalogImageDefinitionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewProjectCatalogImageDefinitionsClient creates a new instance of ProjectCatalogImageDefinitionsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewProjectCatalogImageDefinitionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProjectCatalogImageDefinitionsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ProjectCatalogImageDefinitionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginBuildImage - Builds an image for the specified Image Definition. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - projectName - The name of the project. +// - catalogName - The name of the Catalog. +// - imageDefinitionName - The name of the Image Definition. +// - options - ProjectCatalogImageDefinitionsClientBeginBuildImageOptions contains the optional parameters for the ProjectCatalogImageDefinitionsClient.BeginBuildImage +// method. +func (client *ProjectCatalogImageDefinitionsClient) BeginBuildImage(ctx context.Context, resourceGroupName string, projectName string, catalogName string, imageDefinitionName string, options *ProjectCatalogImageDefinitionsClientBeginBuildImageOptions) (*runtime.Poller[ProjectCatalogImageDefinitionsClientBuildImageResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.buildImage(ctx, resourceGroupName, projectName, catalogName, imageDefinitionName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProjectCatalogImageDefinitionsClientBuildImageResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ProjectCatalogImageDefinitionsClientBuildImageResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// BuildImage - Builds an image for the specified Image Definition. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +func (client *ProjectCatalogImageDefinitionsClient) buildImage(ctx context.Context, resourceGroupName string, projectName string, catalogName string, imageDefinitionName string, options *ProjectCatalogImageDefinitionsClientBeginBuildImageOptions) (*http.Response, error) { + var err error + const operationName = "ProjectCatalogImageDefinitionsClient.BeginBuildImage" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.buildImageCreateRequest(ctx, resourceGroupName, projectName, catalogName, imageDefinitionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// buildImageCreateRequest creates the BuildImage request. +func (client *ProjectCatalogImageDefinitionsClient) buildImageCreateRequest(ctx context.Context, resourceGroupName string, projectName string, catalogName string, imageDefinitionName string, options *ProjectCatalogImageDefinitionsClientBeginBuildImageOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects/{projectName}/catalogs/{catalogName}/imageDefinitions/{imageDefinitionName}/buildImage" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if catalogName == "" { + return nil, errors.New("parameter catalogName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{catalogName}", url.PathEscape(catalogName)) + if imageDefinitionName == "" { + return nil, errors.New("parameter imageDefinitionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{imageDefinitionName}", url.PathEscape(imageDefinitionName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// GetByProjectCatalog - Gets an Image Definition from the catalog +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - projectName - The name of the project. +// - catalogName - The name of the Catalog. +// - imageDefinitionName - The name of the Image Definition. +// - options - ProjectCatalogImageDefinitionsClientGetByProjectCatalogOptions contains the optional parameters for the ProjectCatalogImageDefinitionsClient.GetByProjectCatalog +// method. +func (client *ProjectCatalogImageDefinitionsClient) GetByProjectCatalog(ctx context.Context, resourceGroupName string, projectName string, catalogName string, imageDefinitionName string, options *ProjectCatalogImageDefinitionsClientGetByProjectCatalogOptions) (ProjectCatalogImageDefinitionsClientGetByProjectCatalogResponse, error) { + var err error + const operationName = "ProjectCatalogImageDefinitionsClient.GetByProjectCatalog" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getByProjectCatalogCreateRequest(ctx, resourceGroupName, projectName, catalogName, imageDefinitionName, options) + if err != nil { + return ProjectCatalogImageDefinitionsClientGetByProjectCatalogResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProjectCatalogImageDefinitionsClientGetByProjectCatalogResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProjectCatalogImageDefinitionsClientGetByProjectCatalogResponse{}, err + } + resp, err := client.getByProjectCatalogHandleResponse(httpResp) + return resp, err +} + +// getByProjectCatalogCreateRequest creates the GetByProjectCatalog request. +func (client *ProjectCatalogImageDefinitionsClient) getByProjectCatalogCreateRequest(ctx context.Context, resourceGroupName string, projectName string, catalogName string, imageDefinitionName string, options *ProjectCatalogImageDefinitionsClientGetByProjectCatalogOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects/{projectName}/catalogs/{catalogName}/imageDefinitions/{imageDefinitionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if catalogName == "" { + return nil, errors.New("parameter catalogName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{catalogName}", url.PathEscape(catalogName)) + if imageDefinitionName == "" { + return nil, errors.New("parameter imageDefinitionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{imageDefinitionName}", url.PathEscape(imageDefinitionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getByProjectCatalogHandleResponse handles the GetByProjectCatalog response. +func (client *ProjectCatalogImageDefinitionsClient) getByProjectCatalogHandleResponse(resp *http.Response) (ProjectCatalogImageDefinitionsClientGetByProjectCatalogResponse, error) { + result := ProjectCatalogImageDefinitionsClientGetByProjectCatalogResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ImageDefinition); err != nil { + return ProjectCatalogImageDefinitionsClientGetByProjectCatalogResponse{}, err + } + return result, nil +} + +// NewListByProjectCatalogPager - List Image Definitions in the catalog. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - projectName - The name of the project. +// - catalogName - The name of the Catalog. +// - options - ProjectCatalogImageDefinitionsClientListByProjectCatalogOptions contains the optional parameters for the ProjectCatalogImageDefinitionsClient.NewListByProjectCatalogPager +// method. +func (client *ProjectCatalogImageDefinitionsClient) NewListByProjectCatalogPager(resourceGroupName string, projectName string, catalogName string, options *ProjectCatalogImageDefinitionsClientListByProjectCatalogOptions) *runtime.Pager[ProjectCatalogImageDefinitionsClientListByProjectCatalogResponse] { + return runtime.NewPager(runtime.PagingHandler[ProjectCatalogImageDefinitionsClientListByProjectCatalogResponse]{ + More: func(page ProjectCatalogImageDefinitionsClientListByProjectCatalogResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ProjectCatalogImageDefinitionsClientListByProjectCatalogResponse) (ProjectCatalogImageDefinitionsClientListByProjectCatalogResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ProjectCatalogImageDefinitionsClient.NewListByProjectCatalogPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByProjectCatalogCreateRequest(ctx, resourceGroupName, projectName, catalogName, options) + }, nil) + if err != nil { + return ProjectCatalogImageDefinitionsClientListByProjectCatalogResponse{}, err + } + return client.listByProjectCatalogHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByProjectCatalogCreateRequest creates the ListByProjectCatalog request. +func (client *ProjectCatalogImageDefinitionsClient) listByProjectCatalogCreateRequest(ctx context.Context, resourceGroupName string, projectName string, catalogName string, options *ProjectCatalogImageDefinitionsClientListByProjectCatalogOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects/{projectName}/catalogs/{catalogName}/imageDefinitions" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if catalogName == "" { + return nil, errors.New("parameter catalogName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{catalogName}", url.PathEscape(catalogName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByProjectCatalogHandleResponse handles the ListByProjectCatalog response. +func (client *ProjectCatalogImageDefinitionsClient) listByProjectCatalogHandleResponse(resp *http.Response) (ProjectCatalogImageDefinitionsClientListByProjectCatalogResponse, error) { + result := ProjectCatalogImageDefinitionsClientListByProjectCatalogResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ImageDefinitionListResult); err != nil { + return ProjectCatalogImageDefinitionsClientListByProjectCatalogResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/projectcatalogs_client.go b/sdk/resourcemanager/devcenter/armdevcenter/projectcatalogs_client.go index d6eaf9fe5189..edc1f220de9a 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/projectcatalogs_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/projectcatalogs_client.go @@ -47,7 +47,7 @@ func NewProjectCatalogsClient(subscriptionID string, credential azcore.TokenCred // BeginConnect - Connects a project catalog to enable syncing. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - catalogName - The name of the Catalog. @@ -74,7 +74,7 @@ func (client *ProjectCatalogsClient) BeginConnect(ctx context.Context, resourceG // Connect - Connects a project catalog to enable syncing. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *ProjectCatalogsClient) connect(ctx context.Context, resourceGroupName string, projectName string, catalogName string, options *ProjectCatalogsClientBeginConnectOptions) (*http.Response, error) { var err error const operationName = "ProjectCatalogsClient.BeginConnect" @@ -120,7 +120,7 @@ func (client *ProjectCatalogsClient) connectCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -129,7 +129,7 @@ func (client *ProjectCatalogsClient) connectCreateRequest(ctx context.Context, r // BeginCreateOrUpdate - Creates or updates a project catalog. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - catalogName - The name of the Catalog. @@ -157,7 +157,7 @@ func (client *ProjectCatalogsClient) BeginCreateOrUpdate(ctx context.Context, re // CreateOrUpdate - Creates or updates a project catalog. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *ProjectCatalogsClient) createOrUpdate(ctx context.Context, resourceGroupName string, projectName string, catalogName string, body Catalog, options *ProjectCatalogsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "ProjectCatalogsClient.BeginCreateOrUpdate" @@ -203,7 +203,7 @@ func (client *ProjectCatalogsClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -215,7 +215,7 @@ func (client *ProjectCatalogsClient) createOrUpdateCreateRequest(ctx context.Con // BeginDelete - Deletes a project catalog resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - catalogName - The name of the Catalog. @@ -242,7 +242,7 @@ func (client *ProjectCatalogsClient) BeginDelete(ctx context.Context, resourceGr // Delete - Deletes a project catalog resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *ProjectCatalogsClient) deleteOperation(ctx context.Context, resourceGroupName string, projectName string, catalogName string, options *ProjectCatalogsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ProjectCatalogsClient.BeginDelete" @@ -288,7 +288,7 @@ func (client *ProjectCatalogsClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -297,7 +297,7 @@ func (client *ProjectCatalogsClient) deleteCreateRequest(ctx context.Context, re // Get - Gets an associated project catalog. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - catalogName - The name of the Catalog. @@ -348,7 +348,7 @@ func (client *ProjectCatalogsClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -366,7 +366,7 @@ func (client *ProjectCatalogsClient) getHandleResponse(resp *http.Response) (Pro // GetSyncErrorDetails - Gets project catalog synchronization error details // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - catalogName - The name of the Catalog. @@ -418,7 +418,7 @@ func (client *ProjectCatalogsClient) getSyncErrorDetailsCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -435,7 +435,7 @@ func (client *ProjectCatalogsClient) getSyncErrorDetailsHandleResponse(resp *htt // NewListPager - Lists the catalogs associated with a project. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - options - ProjectCatalogsClientListOptions contains the optional parameters for the ProjectCatalogsClient.NewListPager @@ -486,7 +486,7 @@ func (client *ProjectCatalogsClient) listCreateRequest(ctx context.Context, reso if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -504,7 +504,7 @@ func (client *ProjectCatalogsClient) listHandleResponse(resp *http.Response) (Pr // BeginPatch - Partially updates a project catalog. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - catalogName - The name of the Catalog. @@ -532,7 +532,7 @@ func (client *ProjectCatalogsClient) BeginPatch(ctx context.Context, resourceGro // Patch - Partially updates a project catalog. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *ProjectCatalogsClient) patch(ctx context.Context, resourceGroupName string, projectName string, catalogName string, body CatalogUpdate, options *ProjectCatalogsClientBeginPatchOptions) (*http.Response, error) { var err error const operationName = "ProjectCatalogsClient.BeginPatch" @@ -578,7 +578,7 @@ func (client *ProjectCatalogsClient) patchCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -590,7 +590,7 @@ func (client *ProjectCatalogsClient) patchCreateRequest(ctx context.Context, res // BeginSync - Syncs templates for a template source. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - catalogName - The name of the Catalog. @@ -617,7 +617,7 @@ func (client *ProjectCatalogsClient) BeginSync(ctx context.Context, resourceGrou // Sync - Syncs templates for a template source. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *ProjectCatalogsClient) syncOperation(ctx context.Context, resourceGroupName string, projectName string, catalogName string, options *ProjectCatalogsClientBeginSyncOptions) (*http.Response, error) { var err error const operationName = "ProjectCatalogsClient.BeginSync" @@ -663,7 +663,7 @@ func (client *ProjectCatalogsClient) syncCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/devcenter/armdevcenter/projectcatalogs_client_example_test.go b/sdk/resourcemanager/devcenter/armdevcenter/projectcatalogs_client_example_test.go deleted file mode 100644 index 198f589a02c4..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/projectcatalogs_client_example_test.go +++ /dev/null @@ -1,438 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdevcenter_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/ProjectCatalogs_List.json -func ExampleProjectCatalogsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProjectCatalogsClient().NewListPager("rg1", "DevProject", &armdevcenter.ProjectCatalogsClientListOptions{Top: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CatalogListResult = armdevcenter.CatalogListResult{ - // Value: []*armdevcenter.Catalog{ - // { - // Name: to.Ptr("CentralCatalog"), - // Type: to.Ptr("Microsoft.DevCenter/projects/catalogs"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/DevProject/Contoso/catalogs"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // CreatedBy: to.Ptr("User1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // LastModifiedBy: to.Ptr("User1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.CatalogProperties{ - // GitHub: &armdevcenter.GitCatalog{ - // Path: to.Ptr("/templates"), - // Branch: to.Ptr("main"), - // SecretIdentifier: to.Ptr("https://contosokv.vault.azure.net/secrets/CentralRepoPat"), - // URI: to.Ptr("https://github.com/Contoso/centralrepo-fake.git"), - // }, - // ConnectionState: to.Ptr(armdevcenter.CatalogConnectionStateConnected), - // LastConnectionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:28:00.314Z"); return t}()), - // LastSyncStats: &armdevcenter.SyncStats{ - // Added: to.Ptr[int32](1), - // Removed: to.Ptr[int32](1), - // SynchronizationErrors: to.Ptr[int32](1), - // Unchanged: to.Ptr[int32](1), - // Updated: to.Ptr[int32](1), - // ValidationErrors: to.Ptr[int32](1), - // }, - // LastSyncTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:28:00.314Z"); return t}()), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // SyncState: to.Ptr(armdevcenter.CatalogSyncStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/ProjectCatalogs_Get.json -func ExampleProjectCatalogsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProjectCatalogsClient().Get(ctx, "rg1", "DevProject", "CentralCatalog", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Catalog = armdevcenter.Catalog{ - // Name: to.Ptr("CentralCatalog"), - // Type: to.Ptr("Microsoft.DevCenter/projects/catalogs"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/DevProject/catalogs/CentralCatalog"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // CreatedBy: to.Ptr("User1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // LastModifiedBy: to.Ptr("User1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.CatalogProperties{ - // GitHub: &armdevcenter.GitCatalog{ - // Path: to.Ptr("/templates"), - // Branch: to.Ptr("main"), - // SecretIdentifier: to.Ptr("https://contosokv.vault.azure.net/secrets/CentralRepoPat"), - // URI: to.Ptr("https://github.com/Contoso/centralrepo-fake.git"), - // }, - // ConnectionState: to.Ptr(armdevcenter.CatalogConnectionStateConnected), - // LastConnectionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:28:00.314Z"); return t}()), - // LastSyncStats: &armdevcenter.SyncStats{ - // Added: to.Ptr[int32](1), - // Removed: to.Ptr[int32](1), - // SyncedCatalogItemTypes: []*armdevcenter.CatalogItemType{ - // to.Ptr(armdevcenter.CatalogItemTypeEnvironmentDefinition)}, - // SynchronizationErrors: to.Ptr[int32](1), - // Unchanged: to.Ptr[int32](1), - // Updated: to.Ptr[int32](1), - // ValidationErrors: to.Ptr[int32](1), - // }, - // LastSyncTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:28:00.314Z"); return t}()), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // SyncState: to.Ptr(armdevcenter.CatalogSyncStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/ProjectCatalogs_CreateAdo.json -func ExampleProjectCatalogsClient_BeginCreateOrUpdate_projectCatalogsCreateOrUpdateAdo() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProjectCatalogsClient().BeginCreateOrUpdate(ctx, "rg1", "DevProject", "CentralCatalog", armdevcenter.Catalog{ - Properties: &armdevcenter.CatalogProperties{ - AdoGit: &armdevcenter.GitCatalog{ - Path: to.Ptr("/templates"), - Branch: to.Ptr("main"), - SecretIdentifier: to.Ptr("https://contosokv.vault.azure.net/secrets/CentralRepoPat"), - URI: to.Ptr("https://contoso@dev.azure.com/contoso/contosoOrg/_git/centralrepo-fakecontoso"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Catalog = armdevcenter.Catalog{ - // Name: to.Ptr("CentralCatalog"), - // Type: to.Ptr("Microsoft.DevCenter/projects/catalogs"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/DevProject/catalogs/CentralCatalog"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // CreatedBy: to.Ptr("User1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // LastModifiedBy: to.Ptr("User1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.CatalogProperties{ - // AdoGit: &armdevcenter.GitCatalog{ - // Path: to.Ptr("/templates"), - // Branch: to.Ptr("main"), - // SecretIdentifier: to.Ptr("https://contosokv.vault.azure.net/secrets/CentralRepoPat"), - // URI: to.Ptr("https://contoso@dev.azure.com/contoso/contosoOrg/_git/centralrepo-fakecontoso"), - // }, - // ConnectionState: to.Ptr(armdevcenter.CatalogConnectionStateConnected), - // LastSyncStats: &armdevcenter.SyncStats{ - // Added: to.Ptr[int32](0), - // Removed: to.Ptr[int32](0), - // SyncedCatalogItemTypes: []*armdevcenter.CatalogItemType{ - // to.Ptr(armdevcenter.CatalogItemTypeEnvironmentDefinition)}, - // SynchronizationErrors: to.Ptr[int32](0), - // Unchanged: to.Ptr[int32](0), - // Updated: to.Ptr[int32](0), - // ValidationErrors: to.Ptr[int32](0), - // }, - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // SyncState: to.Ptr(armdevcenter.CatalogSyncStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/ProjectCatalogs_CreateGitHub.json -func ExampleProjectCatalogsClient_BeginCreateOrUpdate_projectCatalogsCreateOrUpdateGitHub() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProjectCatalogsClient().BeginCreateOrUpdate(ctx, "rg1", "DevProject", "CentralCatalog", armdevcenter.Catalog{ - Properties: &armdevcenter.CatalogProperties{ - GitHub: &armdevcenter.GitCatalog{ - Path: to.Ptr("/templates"), - Branch: to.Ptr("main"), - SecretIdentifier: to.Ptr("https://contosokv.vault.azure.net/secrets/CentralRepoPat"), - URI: to.Ptr("https://github.com/Contoso/centralrepo-fake.git"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Catalog = armdevcenter.Catalog{ - // Name: to.Ptr("CentralCatalog"), - // Type: to.Ptr("Microsoft.DevCenter/projects/catalogs"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/DevProject/catalogs/CentralCatalog"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // CreatedBy: to.Ptr("User1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // LastModifiedBy: to.Ptr("User1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.CatalogProperties{ - // GitHub: &armdevcenter.GitCatalog{ - // Path: to.Ptr("/templates"), - // Branch: to.Ptr("main"), - // SecretIdentifier: to.Ptr("https://contosokv.vault.azure.net/secrets/CentralRepoPat"), - // URI: to.Ptr("https://github.com/Contoso/centralrepo-fake.git"), - // }, - // ConnectionState: to.Ptr(armdevcenter.CatalogConnectionStateConnected), - // LastSyncStats: &armdevcenter.SyncStats{ - // Added: to.Ptr[int32](0), - // Removed: to.Ptr[int32](0), - // SyncedCatalogItemTypes: []*armdevcenter.CatalogItemType{ - // to.Ptr(armdevcenter.CatalogItemTypeEnvironmentDefinition)}, - // SynchronizationErrors: to.Ptr[int32](0), - // Unchanged: to.Ptr[int32](0), - // Updated: to.Ptr[int32](0), - // ValidationErrors: to.Ptr[int32](0), - // }, - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // SyncState: to.Ptr(armdevcenter.CatalogSyncStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/ProjectCatalogs_Patch.json -func ExampleProjectCatalogsClient_BeginPatch() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProjectCatalogsClient().BeginPatch(ctx, "rg1", "DevProject", "CentralCatalog", armdevcenter.CatalogUpdate{ - Properties: &armdevcenter.CatalogUpdateProperties{ - GitHub: &armdevcenter.GitCatalog{ - Path: to.Ptr("/environments"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Catalog = armdevcenter.Catalog{ - // Name: to.Ptr("CentralCatalog"), - // Type: to.Ptr("Microsoft.DevCenter/projects/catalogs"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/DevProject/catalogs/CentralCatalog"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // CreatedBy: to.Ptr("User1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // LastModifiedBy: to.Ptr("User1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.CatalogProperties{ - // GitHub: &armdevcenter.GitCatalog{ - // Path: to.Ptr("/environments"), - // Branch: to.Ptr("main"), - // SecretIdentifier: to.Ptr("https://contosokv.vault.azure.net/secrets/CentralRepoPat"), - // URI: to.Ptr("https://github.com/Contoso/centralrepo-fake.git"), - // }, - // ConnectionState: to.Ptr(armdevcenter.CatalogConnectionStateConnected), - // LastConnectionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:28:00.314Z"); return t}()), - // LastSyncStats: &armdevcenter.SyncStats{ - // Added: to.Ptr[int32](1), - // Removed: to.Ptr[int32](1), - // SynchronizationErrors: to.Ptr[int32](1), - // Unchanged: to.Ptr[int32](1), - // Updated: to.Ptr[int32](1), - // ValidationErrors: to.Ptr[int32](1), - // }, - // LastSyncTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:28:00.314Z"); return t}()), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // SyncState: to.Ptr(armdevcenter.CatalogSyncStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/ProjectCatalogs_Delete.json -func ExampleProjectCatalogsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProjectCatalogsClient().BeginDelete(ctx, "rg1", "DevProject", "CentralCatalog", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/ProjectCatalogs_GetSyncErrorDetails.json -func ExampleProjectCatalogsClient_GetSyncErrorDetails() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProjectCatalogsClient().GetSyncErrorDetails(ctx, "rg1", "DevProject", "CentralCatalog", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SyncErrorDetails = armdevcenter.SyncErrorDetails{ - // Conflicts: []*armdevcenter.CatalogConflictError{ - // { - // Name: to.Ptr("DuplicateEnvironmentName"), - // Path: to.Ptr("/Environments/Duplicate/manifest.yaml"), - // }}, - // Errors: []*armdevcenter.CatalogSyncError{ - // { - // Path: to.Ptr("/Environments/Invalid/manifest.yaml"), - // ErrorDetails: []*armdevcenter.CatalogErrorDetails{ - // { - // Code: to.Ptr("ParseError"), - // Message: to.Ptr("Schema Error Within Catalog Item: Missing Name"), - // }}, - // }}, - // OperationError: &armdevcenter.CatalogErrorDetails{ - // Code: to.Ptr("Conflict"), - // Message: to.Ptr("The source control credentials could not be validated successfully."), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/ProjectCatalogs_Sync.json -func ExampleProjectCatalogsClient_BeginSync() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProjectCatalogsClient().BeginSync(ctx, "rg1", "DevProject", "CentralCatalog", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/ProjectCatalogs_Connect.json -func ExampleProjectCatalogsClient_BeginConnect() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProjectCatalogsClient().BeginConnect(ctx, "rg1", "DevProject", "CentralCatalog", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/projectenvironmenttypes_client.go b/sdk/resourcemanager/devcenter/armdevcenter/projectenvironmenttypes_client.go index 29d961d6ca20..e43092188d04 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/projectenvironmenttypes_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/projectenvironmenttypes_client.go @@ -47,7 +47,7 @@ func NewProjectEnvironmentTypesClient(subscriptionID string, credential azcore.T // CreateOrUpdate - Creates or updates a project environment type. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - environmentTypeName - The name of the environment type. @@ -100,7 +100,7 @@ func (client *ProjectEnvironmentTypesClient) createOrUpdateCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -121,7 +121,7 @@ func (client *ProjectEnvironmentTypesClient) createOrUpdateHandleResponse(resp * // Delete - Deletes a project environment type. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - environmentTypeName - The name of the environment type. @@ -172,7 +172,7 @@ func (client *ProjectEnvironmentTypesClient) deleteCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -181,7 +181,7 @@ func (client *ProjectEnvironmentTypesClient) deleteCreateRequest(ctx context.Con // Get - Gets a project environment type. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - environmentTypeName - The name of the environment type. @@ -233,7 +233,7 @@ func (client *ProjectEnvironmentTypesClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -250,7 +250,7 @@ func (client *ProjectEnvironmentTypesClient) getHandleResponse(resp *http.Respon // NewListPager - Lists environment types for a project. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - options - ProjectEnvironmentTypesClientListOptions contains the optional parameters for the ProjectEnvironmentTypesClient.NewListPager @@ -301,7 +301,7 @@ func (client *ProjectEnvironmentTypesClient) listCreateRequest(ctx context.Conte if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -319,7 +319,7 @@ func (client *ProjectEnvironmentTypesClient) listHandleResponse(resp *http.Respo // Update - Partially updates a project environment type. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - environmentTypeName - The name of the environment type. @@ -372,7 +372,7 @@ func (client *ProjectEnvironmentTypesClient) updateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { diff --git a/sdk/resourcemanager/devcenter/armdevcenter/projectenvironmenttypes_client_example_test.go b/sdk/resourcemanager/devcenter/armdevcenter/projectenvironmenttypes_client_example_test.go deleted file mode 100644 index a0d8c76ec651..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/projectenvironmenttypes_client_example_test.go +++ /dev/null @@ -1,372 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdevcenter_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/ProjectEnvironmentTypes_List.json -func ExampleProjectEnvironmentTypesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProjectEnvironmentTypesClient().NewListPager("rg1", "ContosoProj", &armdevcenter.ProjectEnvironmentTypesClientListOptions{Top: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProjectEnvironmentTypeListResult = armdevcenter.ProjectEnvironmentTypeListResult{ - // Value: []*armdevcenter.ProjectEnvironmentType{ - // { - // Name: to.Ptr("DevTest"), - // Type: to.Ptr("Microsoft.DevCenter/projects/environmentTypes"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/ContosoProj/environmentTypes/DevTest"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // CreatedBy: to.Ptr("User1@contoso.com"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // LastModifiedBy: to.Ptr("User1@contoso.com"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Identity: &armdevcenter.ManagedServiceIdentity{ - // Type: to.Ptr(armdevcenter.ManagedServiceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armdevcenter.UserAssignedIdentity{ - // "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/identityGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testidentity1": &armdevcenter.UserAssignedIdentity{ - // ClientID: to.Ptr("e35621a5-f615-4a20-940e-de8a84b15abc"), - // PrincipalID: to.Ptr("2111b8fc-e123-485a-b408-bf1153189494"), - // }, - // }, - // }, - // Location: to.Ptr("centralus"), - // Properties: &armdevcenter.ProjectEnvironmentTypeProperties{ - // CreatorRoleAssignment: &armdevcenter.ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment{ - // Roles: map[string]*armdevcenter.EnvironmentRole{ - // "4cbf0b6c-e750-441c-98a7-10da8387e4d6": &armdevcenter.EnvironmentRole{ - // Description: to.Ptr("Allows Developer access to project virtual machine resources."), - // RoleName: to.Ptr("Developer"), - // }, - // }, - // }, - // DeploymentTargetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000"), - // Status: to.Ptr(armdevcenter.EnvironmentTypeEnableStatusEnabled), - // UserRoleAssignments: map[string]*armdevcenter.UserRoleAssignmentValue{ - // "e45e3m7c-176e-416a-b466-0c5ec8298f8a": &armdevcenter.UserRoleAssignmentValue{ - // Roles: map[string]*armdevcenter.EnvironmentRole{ - // "4cbf0b6c-e750-441c-98a7-10da8387e4d6": &armdevcenter.EnvironmentRole{ - // Description: to.Ptr("Allows Developer access to project virtual machine resources."), - // RoleName: to.Ptr("Developer"), - // }, - // }, - // }, - // }, - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // Tags: map[string]*string{ - // "CostCenter": to.Ptr("RnD"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/ProjectEnvironmentTypes_Get.json -func ExampleProjectEnvironmentTypesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProjectEnvironmentTypesClient().Get(ctx, "rg1", "ContosoProj", "DevTest", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProjectEnvironmentType = armdevcenter.ProjectEnvironmentType{ - // Name: to.Ptr("DevTest"), - // Type: to.Ptr("Microsoft.DevCenter/projects/environmentTypes"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/ContosoProj/environmentTypes/DevTest"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // CreatedBy: to.Ptr("User1@contoso.com"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // LastModifiedBy: to.Ptr("User1@contoso.com"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Identity: &armdevcenter.ManagedServiceIdentity{ - // Type: to.Ptr(armdevcenter.ManagedServiceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armdevcenter.UserAssignedIdentity{ - // "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/identityGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testidentity1": &armdevcenter.UserAssignedIdentity{ - // ClientID: to.Ptr("e35621a5-f615-4a20-940e-de8a84b15abc"), - // PrincipalID: to.Ptr("2111b8fc-e123-485a-b408-bf1153189494"), - // }, - // }, - // }, - // Location: to.Ptr("centralus"), - // Properties: &armdevcenter.ProjectEnvironmentTypeProperties{ - // CreatorRoleAssignment: &armdevcenter.ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment{ - // Roles: map[string]*armdevcenter.EnvironmentRole{ - // "4cbf0b6c-e750-441c-98a7-10da8387e4d6": &armdevcenter.EnvironmentRole{ - // Description: to.Ptr("Allows Developer access to project virtual machine resources."), - // RoleName: to.Ptr("Developer"), - // }, - // }, - // }, - // DeploymentTargetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000"), - // Status: to.Ptr(armdevcenter.EnvironmentTypeEnableStatusEnabled), - // UserRoleAssignments: map[string]*armdevcenter.UserRoleAssignmentValue{ - // "e45e3m7c-176e-416a-b466-0c5ec8298f8a": &armdevcenter.UserRoleAssignmentValue{ - // Roles: map[string]*armdevcenter.EnvironmentRole{ - // "4cbf0b6c-e750-441c-98a7-10da8387e4d6": &armdevcenter.EnvironmentRole{ - // Description: to.Ptr("Allows Developer access to project virtual machine resources."), - // RoleName: to.Ptr("Developer"), - // }, - // }, - // }, - // }, - // EnvironmentCount: to.Ptr[int32](1), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // Tags: map[string]*string{ - // "CostCenter": to.Ptr("RnD"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/ProjectEnvironmentTypes_Put.json -func ExampleProjectEnvironmentTypesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProjectEnvironmentTypesClient().CreateOrUpdate(ctx, "rg1", "ContosoProj", "DevTest", armdevcenter.ProjectEnvironmentType{ - Identity: &armdevcenter.ManagedServiceIdentity{ - Type: to.Ptr(armdevcenter.ManagedServiceIdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armdevcenter.UserAssignedIdentity{ - "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/identityGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testidentity1": {}, - }, - }, - Properties: &armdevcenter.ProjectEnvironmentTypeProperties{ - CreatorRoleAssignment: &armdevcenter.ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment{ - Roles: map[string]*armdevcenter.EnvironmentRole{ - "4cbf0b6c-e750-441c-98a7-10da8387e4d6": {}, - }, - }, - DeploymentTargetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000"), - Status: to.Ptr(armdevcenter.EnvironmentTypeEnableStatusEnabled), - UserRoleAssignments: map[string]*armdevcenter.UserRoleAssignmentValue{ - "e45e3m7c-176e-416a-b466-0c5ec8298f8a": { - Roles: map[string]*armdevcenter.EnvironmentRole{ - "4cbf0b6c-e750-441c-98a7-10da8387e4d6": {}, - }, - }, - }, - }, - Tags: map[string]*string{ - "CostCenter": to.Ptr("RnD"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProjectEnvironmentType = armdevcenter.ProjectEnvironmentType{ - // Name: to.Ptr("DevTest"), - // Type: to.Ptr("Microsoft.DevCenter/projects/environmentTypes"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/ContosoProj/environmentTypes/DevTest"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // CreatedBy: to.Ptr("User1@contoso.com"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // LastModifiedBy: to.Ptr("User1@contoso.com"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Identity: &armdevcenter.ManagedServiceIdentity{ - // Type: to.Ptr(armdevcenter.ManagedServiceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armdevcenter.UserAssignedIdentity{ - // "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/identityGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testidentity1": &armdevcenter.UserAssignedIdentity{ - // ClientID: to.Ptr("e35621a5-f615-4a20-940e-de8a84b15abc"), - // PrincipalID: to.Ptr("2111b8fc-e123-485a-b408-bf1153189494"), - // }, - // }, - // }, - // Location: to.Ptr("centralus"), - // Properties: &armdevcenter.ProjectEnvironmentTypeProperties{ - // CreatorRoleAssignment: &armdevcenter.ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment{ - // Roles: map[string]*armdevcenter.EnvironmentRole{ - // "4cbf0b6c-e750-441c-98a7-10da8387e4d6": &armdevcenter.EnvironmentRole{ - // Description: to.Ptr("Allows Developer access to project virtual machine resources."), - // RoleName: to.Ptr("Developer"), - // }, - // }, - // }, - // DeploymentTargetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000"), - // DisplayName: to.Ptr("DevTest"), - // Status: to.Ptr(armdevcenter.EnvironmentTypeEnableStatusEnabled), - // UserRoleAssignments: map[string]*armdevcenter.UserRoleAssignmentValue{ - // "e45e3m7c-176e-416a-b466-0c5ec8298f8a": &armdevcenter.UserRoleAssignmentValue{ - // Roles: map[string]*armdevcenter.EnvironmentRole{ - // "4cbf0b6c-e750-441c-98a7-10da8387e4d6": &armdevcenter.EnvironmentRole{ - // Description: to.Ptr("Allows Developer access to project virtual machine resources."), - // RoleName: to.Ptr("Developer"), - // }, - // }, - // }, - // }, - // EnvironmentCount: to.Ptr[int32](0), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // Tags: map[string]*string{ - // "CostCenter": to.Ptr("RnD"), - // "hidden-title": to.Ptr("Dev"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/ProjectEnvironmentTypes_Patch.json -func ExampleProjectEnvironmentTypesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProjectEnvironmentTypesClient().Update(ctx, "rg1", "ContosoProj", "DevTest", armdevcenter.ProjectEnvironmentTypeUpdate{ - Identity: &armdevcenter.ManagedServiceIdentity{ - Type: to.Ptr(armdevcenter.ManagedServiceIdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armdevcenter.UserAssignedIdentity{ - "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/identityGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testidentity1": {}, - }, - }, - Properties: &armdevcenter.ProjectEnvironmentTypeUpdateProperties{ - DeploymentTargetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000"), - Status: to.Ptr(armdevcenter.EnvironmentTypeEnableStatusEnabled), - UserRoleAssignments: map[string]*armdevcenter.UserRoleAssignmentValue{ - "e45e3m7c-176e-416a-b466-0c5ec8298f8a": { - Roles: map[string]*armdevcenter.EnvironmentRole{ - "4cbf0b6c-e750-441c-98a7-10da8387e4d6": {}, - }, - }, - }, - }, - Tags: map[string]*string{ - "CostCenter": to.Ptr("RnD"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProjectEnvironmentType = armdevcenter.ProjectEnvironmentType{ - // Name: to.Ptr("DevTest"), - // Type: to.Ptr("Microsoft.DevCenter/projects/environmentTypes"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/ContosoProj/environmentTypes/DevTest"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // CreatedBy: to.Ptr("User1@contoso.com"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:24:24.818Z"); return t}()), - // LastModifiedBy: to.Ptr("User1@contoso.com"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Identity: &armdevcenter.ManagedServiceIdentity{ - // Type: to.Ptr(armdevcenter.ManagedServiceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armdevcenter.UserAssignedIdentity{ - // "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/identityGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testidentity1": &armdevcenter.UserAssignedIdentity{ - // ClientID: to.Ptr("e35621a5-f615-4a20-940e-de8a84b15abc"), - // PrincipalID: to.Ptr("2111b8fc-e123-485a-b408-bf1153189494"), - // }, - // }, - // }, - // Location: to.Ptr("centralus"), - // Properties: &armdevcenter.ProjectEnvironmentTypeProperties{ - // CreatorRoleAssignment: &armdevcenter.ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment{ - // Roles: map[string]*armdevcenter.EnvironmentRole{ - // "4cbf0b6c-e750-441c-98a7-10da8387e4d6": &armdevcenter.EnvironmentRole{ - // Description: to.Ptr("Allows Developer access to project virtual machine resources."), - // RoleName: to.Ptr("Developer"), - // }, - // }, - // }, - // DeploymentTargetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000"), - // Status: to.Ptr(armdevcenter.EnvironmentTypeEnableStatusEnabled), - // UserRoleAssignments: map[string]*armdevcenter.UserRoleAssignmentValue{ - // "e45e3m7c-176e-416a-b466-0c5ec8298f8a": &armdevcenter.UserRoleAssignmentValue{ - // Roles: map[string]*armdevcenter.EnvironmentRole{ - // "4cbf0b6c-e750-441c-98a7-10da8387e4d6": &armdevcenter.EnvironmentRole{ - // Description: to.Ptr("Allows Developer access to project virtual machine resources."), - // RoleName: to.Ptr("Developer"), - // }, - // }, - // }, - // }, - // EnvironmentCount: to.Ptr[int32](1), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // Tags: map[string]*string{ - // "CostCenter": to.Ptr("RnD"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/ProjectEnvironmentTypes_Delete.json -func ExampleProjectEnvironmentTypesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewProjectEnvironmentTypesClient().Delete(ctx, "rg1", "ContosoProj", "DevTest", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/projectpolicies_client.go b/sdk/resourcemanager/devcenter/armdevcenter/projectpolicies_client.go new file mode 100644 index 000000000000..181b0ab8ec26 --- /dev/null +++ b/sdk/resourcemanager/devcenter/armdevcenter/projectpolicies_client.go @@ -0,0 +1,436 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdevcenter + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// ProjectPoliciesClient contains the methods for the ProjectPolicies group. +// Don't use this type directly, use NewProjectPoliciesClient() instead. +type ProjectPoliciesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewProjectPoliciesClient creates a new instance of ProjectPoliciesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewProjectPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProjectPoliciesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ProjectPoliciesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates an project policy. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - devCenterName - The name of the devcenter. +// - projectPolicyName - The name of the project policy. +// - body - Represents an project policy. +// - options - ProjectPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the ProjectPoliciesClient.BeginCreateOrUpdate +// method. +func (client *ProjectPoliciesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, devCenterName string, projectPolicyName string, body ProjectPolicy, options *ProjectPoliciesClientBeginCreateOrUpdateOptions) (*runtime.Poller[ProjectPoliciesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, devCenterName, projectPolicyName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProjectPoliciesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ProjectPoliciesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates or updates an project policy. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +func (client *ProjectPoliciesClient) createOrUpdate(ctx context.Context, resourceGroupName string, devCenterName string, projectPolicyName string, body ProjectPolicy, options *ProjectPoliciesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ProjectPoliciesClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, devCenterName, projectPolicyName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ProjectPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, devCenterName string, projectPolicyName string, body ProjectPolicy, options *ProjectPoliciesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}/projectPolicies/{projectPolicyName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if devCenterName == "" { + return nil, errors.New("parameter devCenterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{devCenterName}", url.PathEscape(devCenterName)) + if projectPolicyName == "" { + return nil, errors.New("parameter projectPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectPolicyName}", url.PathEscape(projectPolicyName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes an project policy. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - devCenterName - The name of the devcenter. +// - projectPolicyName - The name of the project policy. +// - options - ProjectPoliciesClientBeginDeleteOptions contains the optional parameters for the ProjectPoliciesClient.BeginDelete +// method. +func (client *ProjectPoliciesClient) BeginDelete(ctx context.Context, resourceGroupName string, devCenterName string, projectPolicyName string, options *ProjectPoliciesClientBeginDeleteOptions) (*runtime.Poller[ProjectPoliciesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, devCenterName, projectPolicyName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProjectPoliciesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ProjectPoliciesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes an project policy. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +func (client *ProjectPoliciesClient) deleteOperation(ctx context.Context, resourceGroupName string, devCenterName string, projectPolicyName string, options *ProjectPoliciesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "ProjectPoliciesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, devCenterName, projectPolicyName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ProjectPoliciesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, devCenterName string, projectPolicyName string, options *ProjectPoliciesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}/projectPolicies/{projectPolicyName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if devCenterName == "" { + return nil, errors.New("parameter devCenterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{devCenterName}", url.PathEscape(devCenterName)) + if projectPolicyName == "" { + return nil, errors.New("parameter projectPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectPolicyName}", url.PathEscape(projectPolicyName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a specific project policy. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - devCenterName - The name of the devcenter. +// - projectPolicyName - The name of the project policy. +// - options - ProjectPoliciesClientGetOptions contains the optional parameters for the ProjectPoliciesClient.Get method. +func (client *ProjectPoliciesClient) Get(ctx context.Context, resourceGroupName string, devCenterName string, projectPolicyName string, options *ProjectPoliciesClientGetOptions) (ProjectPoliciesClientGetResponse, error) { + var err error + const operationName = "ProjectPoliciesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, devCenterName, projectPolicyName, options) + if err != nil { + return ProjectPoliciesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProjectPoliciesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProjectPoliciesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ProjectPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, devCenterName string, projectPolicyName string, options *ProjectPoliciesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}/projectPolicies/{projectPolicyName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if devCenterName == "" { + return nil, errors.New("parameter devCenterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{devCenterName}", url.PathEscape(devCenterName)) + if projectPolicyName == "" { + return nil, errors.New("parameter projectPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectPolicyName}", url.PathEscape(projectPolicyName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ProjectPoliciesClient) getHandleResponse(resp *http.Response) (ProjectPoliciesClientGetResponse, error) { + result := ProjectPoliciesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProjectPolicy); err != nil { + return ProjectPoliciesClientGetResponse{}, err + } + return result, nil +} + +// NewListByDevCenterPager - Lists all project policies in the dev center +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - devCenterName - The name of the devcenter. +// - options - ProjectPoliciesClientListByDevCenterOptions contains the optional parameters for the ProjectPoliciesClient.NewListByDevCenterPager +// method. +func (client *ProjectPoliciesClient) NewListByDevCenterPager(resourceGroupName string, devCenterName string, options *ProjectPoliciesClientListByDevCenterOptions) *runtime.Pager[ProjectPoliciesClientListByDevCenterResponse] { + return runtime.NewPager(runtime.PagingHandler[ProjectPoliciesClientListByDevCenterResponse]{ + More: func(page ProjectPoliciesClientListByDevCenterResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ProjectPoliciesClientListByDevCenterResponse) (ProjectPoliciesClientListByDevCenterResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ProjectPoliciesClient.NewListByDevCenterPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByDevCenterCreateRequest(ctx, resourceGroupName, devCenterName, options) + }, nil) + if err != nil { + return ProjectPoliciesClientListByDevCenterResponse{}, err + } + return client.listByDevCenterHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByDevCenterCreateRequest creates the ListByDevCenter request. +func (client *ProjectPoliciesClient) listByDevCenterCreateRequest(ctx context.Context, resourceGroupName string, devCenterName string, options *ProjectPoliciesClientListByDevCenterOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}/projectPolicies" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if devCenterName == "" { + return nil, errors.New("parameter devCenterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{devCenterName}", url.PathEscape(devCenterName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByDevCenterHandleResponse handles the ListByDevCenter response. +func (client *ProjectPoliciesClient) listByDevCenterHandleResponse(resp *http.Response) (ProjectPoliciesClientListByDevCenterResponse, error) { + result := ProjectPoliciesClientListByDevCenterResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProjectPolicyListResult); err != nil { + return ProjectPoliciesClientListByDevCenterResponse{}, err + } + return result, nil +} + +// BeginUpdate - Partially updates an project policy. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - devCenterName - The name of the devcenter. +// - projectPolicyName - The name of the project policy. +// - body - Updatable project policy properties. +// - options - ProjectPoliciesClientBeginUpdateOptions contains the optional parameters for the ProjectPoliciesClient.BeginUpdate +// method. +func (client *ProjectPoliciesClient) BeginUpdate(ctx context.Context, resourceGroupName string, devCenterName string, projectPolicyName string, body ProjectPolicyUpdate, options *ProjectPoliciesClientBeginUpdateOptions) (*runtime.Poller[ProjectPoliciesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, devCenterName, projectPolicyName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProjectPoliciesClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ProjectPoliciesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Partially updates an project policy. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +func (client *ProjectPoliciesClient) update(ctx context.Context, resourceGroupName string, devCenterName string, projectPolicyName string, body ProjectPolicyUpdate, options *ProjectPoliciesClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ProjectPoliciesClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, devCenterName, projectPolicyName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *ProjectPoliciesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, devCenterName string, projectPolicyName string, body ProjectPolicyUpdate, options *ProjectPoliciesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/devcenters/{devCenterName}/projectPolicies/{projectPolicyName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if devCenterName == "" { + return nil, errors.New("parameter devCenterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{devCenterName}", url.PathEscape(devCenterName)) + if projectPolicyName == "" { + return nil, errors.New("parameter projectPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectPolicyName}", url.PathEscape(projectPolicyName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/projects_client.go b/sdk/resourcemanager/devcenter/armdevcenter/projects_client.go index 5048ed7e96c3..fc73128d71da 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/projects_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/projects_client.go @@ -47,7 +47,7 @@ func NewProjectsClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreateOrUpdate - Creates or updates a project. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - body - Represents a project. @@ -74,7 +74,7 @@ func (client *ProjectsClient) BeginCreateOrUpdate(ctx context.Context, resourceG // CreateOrUpdate - Creates or updates a project. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *ProjectsClient) createOrUpdate(ctx context.Context, resourceGroupName string, projectName string, body Project, options *ProjectsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "ProjectsClient.BeginCreateOrUpdate" @@ -116,7 +116,7 @@ func (client *ProjectsClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -128,7 +128,7 @@ func (client *ProjectsClient) createOrUpdateCreateRequest(ctx context.Context, r // BeginDelete - Deletes a project resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - options - ProjectsClientBeginDeleteOptions contains the optional parameters for the ProjectsClient.BeginDelete method. @@ -153,7 +153,7 @@ func (client *ProjectsClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Deletes a project resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *ProjectsClient) deleteOperation(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ProjectsClient.BeginDelete" @@ -195,7 +195,7 @@ func (client *ProjectsClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -204,7 +204,7 @@ func (client *ProjectsClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Gets a specific project. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - options - ProjectsClientGetOptions contains the optional parameters for the ProjectsClient.Get method. @@ -250,7 +250,7 @@ func (client *ProjectsClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -265,9 +265,74 @@ func (client *ProjectsClient) getHandleResponse(resp *http.Response) (ProjectsCl return result, nil } +// GetInheritedSettings - Gets applicable inherited settings for this project. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - projectName - The name of the project. +// - options - ProjectsClientGetInheritedSettingsOptions contains the optional parameters for the ProjectsClient.GetInheritedSettings +// method. +func (client *ProjectsClient) GetInheritedSettings(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientGetInheritedSettingsOptions) (ProjectsClientGetInheritedSettingsResponse, error) { + var err error + const operationName = "ProjectsClient.GetInheritedSettings" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getInheritedSettingsCreateRequest(ctx, resourceGroupName, projectName, options) + if err != nil { + return ProjectsClientGetInheritedSettingsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProjectsClientGetInheritedSettingsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProjectsClientGetInheritedSettingsResponse{}, err + } + resp, err := client.getInheritedSettingsHandleResponse(httpResp) + return resp, err +} + +// getInheritedSettingsCreateRequest creates the GetInheritedSettings request. +func (client *ProjectsClient) getInheritedSettingsCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientGetInheritedSettingsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects/{projectName}/getInheritedSettings" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getInheritedSettingsHandleResponse handles the GetInheritedSettings response. +func (client *ProjectsClient) getInheritedSettingsHandleResponse(resp *http.Response) (ProjectsClientGetInheritedSettingsResponse, error) { + result := ProjectsClientGetInheritedSettingsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.InheritedSettingsForProject); err != nil { + return ProjectsClientGetInheritedSettingsResponse{}, err + } + return result, nil +} + // NewListByResourceGroupPager - Lists all projects in the resource group. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ProjectsClientListByResourceGroupOptions contains the optional parameters for the ProjectsClient.NewListByResourceGroupPager // method. @@ -313,7 +378,7 @@ func (client *ProjectsClient) listByResourceGroupCreateRequest(ctx context.Conte if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -330,7 +395,7 @@ func (client *ProjectsClient) listByResourceGroupHandleResponse(resp *http.Respo // NewListBySubscriptionPager - Lists all projects in the subscription. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - options - ProjectsClientListBySubscriptionOptions contains the optional parameters for the ProjectsClient.NewListBySubscriptionPager // method. func (client *ProjectsClient) NewListBySubscriptionPager(options *ProjectsClientListBySubscriptionOptions) *runtime.Pager[ProjectsClientListBySubscriptionResponse] { @@ -371,7 +436,7 @@ func (client *ProjectsClient) listBySubscriptionCreateRequest(ctx context.Contex if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -389,7 +454,7 @@ func (client *ProjectsClient) listBySubscriptionHandleResponse(resp *http.Respon // BeginUpdate - Partially updates a project. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - body - Updatable project properties. @@ -415,7 +480,7 @@ func (client *ProjectsClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Partially updates a project. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *ProjectsClient) update(ctx context.Context, resourceGroupName string, projectName string, body ProjectUpdate, options *ProjectsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "ProjectsClient.BeginUpdate" @@ -457,7 +522,7 @@ func (client *ProjectsClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { diff --git a/sdk/resourcemanager/devcenter/armdevcenter/projects_client_example_test.go b/sdk/resourcemanager/devcenter/armdevcenter/projects_client_example_test.go deleted file mode 100644 index 537a57824ab7..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/projects_client_example_test.go +++ /dev/null @@ -1,371 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdevcenter_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Projects_ListBySubscription.json -func ExampleProjectsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProjectsClient().NewListBySubscriptionPager(&armdevcenter.ProjectsClientListBySubscriptionOptions{Top: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProjectListResult = armdevcenter.ProjectListResult{ - // Value: []*armdevcenter.Project{ - // { - // Name: to.Ptr("myproject"), - // Type: to.Ptr("Microsoft.DevCenter/projects"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/myproject"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "CostCenter": to.Ptr("R&D"), - // }, - // Properties: &armdevcenter.ProjectProperties{ - // Description: to.Ptr("This is my first project."), - // DevCenterID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso"), - // DevCenterURI: to.Ptr("https://4c7c8922-78e9-4928-aa6f-75ba59355371-contoso.centralus.devcenter.azure.com"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Projects_ListByResourceGroup.json -func ExampleProjectsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProjectsClient().NewListByResourceGroupPager("rg1", &armdevcenter.ProjectsClientListByResourceGroupOptions{Top: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProjectListResult = armdevcenter.ProjectListResult{ - // Value: []*armdevcenter.Project{ - // { - // Name: to.Ptr("myproject"), - // Type: to.Ptr("Microsoft.DevCenter/projects"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/myproject"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "CostCenter": to.Ptr("R&D"), - // }, - // Properties: &armdevcenter.ProjectProperties{ - // Description: to.Ptr("This is my first project."), - // DevCenterID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso"), - // DevCenterURI: to.Ptr("https://4c7c8922-78e9-4928-aa6f-75ba59355371-contoso.centralus.devcenter.azure.com"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Projects_Get.json -func ExampleProjectsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProjectsClient().Get(ctx, "rg1", "DevProject", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Project = armdevcenter.Project{ - // Name: to.Ptr("DevProject"), - // Type: to.Ptr("Microsoft.DevCenter/projects"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/DevProject"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "CostCenter": to.Ptr("R&D"), - // "hidden-title": to.Ptr("Dev"), - // }, - // Properties: &armdevcenter.ProjectProperties{ - // Description: to.Ptr("This is my first project."), - // CatalogSettings: &armdevcenter.ProjectCatalogSettings{ - // CatalogItemSyncTypes: []*armdevcenter.CatalogItemType{ - // to.Ptr(armdevcenter.CatalogItemTypeEnvironmentDefinition)}, - // }, - // DevCenterID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso"), - // DisplayName: to.Ptr("Dev"), - // DevCenterURI: to.Ptr("https://4c7c8922-78e9-4928-aa6f-75ba59355371-contoso.centralus.devcenter.azure.com"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Projects_Put.json -func ExampleProjectsClient_BeginCreateOrUpdate_projectsCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProjectsClient().BeginCreateOrUpdate(ctx, "rg1", "DevProject", armdevcenter.Project{ - Location: to.Ptr("centralus"), - Tags: map[string]*string{ - "CostCenter": to.Ptr("R&D"), - }, - Properties: &armdevcenter.ProjectProperties{ - Description: to.Ptr("This is my first project."), - DevCenterID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso"), - DisplayName: to.Ptr("Dev"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Project = armdevcenter.Project{ - // Name: to.Ptr("DevProject"), - // Type: to.Ptr("Microsoft.DevCenter/projects"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/DevProject"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "CostCenter": to.Ptr("R&D"), - // "hidden-title": to.Ptr("Dev"), - // }, - // Properties: &armdevcenter.ProjectProperties{ - // Description: to.Ptr("This is my first project."), - // DevCenterID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso"), - // DevCenterURI: to.Ptr("https://4c7c8922-78e9-4928-aa6f-75ba59355371-contoso.centralus.devcenter.azure.com"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Projects_PutWithMaxDevBoxPerUser.json -func ExampleProjectsClient_BeginCreateOrUpdate_projectsCreateOrUpdateWithLimitsPerDev() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProjectsClient().BeginCreateOrUpdate(ctx, "rg1", "DevProject", armdevcenter.Project{ - Location: to.Ptr("centralus"), - Tags: map[string]*string{ - "CostCenter": to.Ptr("R&D"), - }, - Properties: &armdevcenter.ProjectProperties{ - Description: to.Ptr("This is my first project."), - DevCenterID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso"), - MaxDevBoxesPerUser: to.Ptr[int32](3), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Project = armdevcenter.Project{ - // Name: to.Ptr("DevProject"), - // Type: to.Ptr("Microsoft.DevCenter/projects"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/DevProject"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "CostCenter": to.Ptr("R&D"), - // }, - // Properties: &armdevcenter.ProjectProperties{ - // Description: to.Ptr("This is my first project."), - // DevCenterID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso"), - // MaxDevBoxesPerUser: to.Ptr[int32](3), - // DevCenterURI: to.Ptr("https://4c7c8922-78e9-4928-aa6f-75ba59355371-contoso.centralus.devcenter.azure.com"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Projects_Patch.json -func ExampleProjectsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProjectsClient().BeginUpdate(ctx, "rg1", "DevProject", armdevcenter.ProjectUpdate{ - Tags: map[string]*string{ - "CostCenter": to.Ptr("R&D"), - }, - Properties: &armdevcenter.ProjectUpdateProperties{ - Description: to.Ptr("This is my first project."), - CatalogSettings: &armdevcenter.ProjectCatalogSettings{ - CatalogItemSyncTypes: []*armdevcenter.CatalogItemType{ - to.Ptr(armdevcenter.CatalogItemTypeEnvironmentDefinition)}, - }, - DisplayName: to.Ptr("Dev"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Project = armdevcenter.Project{ - // Name: to.Ptr("myproject"), - // Type: to.Ptr("Microsoft.DevCenter/projects"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/DevProject"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Location: to.Ptr("centralus"), - // Tags: map[string]*string{ - // "CostCenter": to.Ptr("R&D"), - // "displayName": to.Ptr("Dev"), - // }, - // Properties: &armdevcenter.ProjectProperties{ - // Description: to.Ptr("This is my first project. Very exciting."), - // CatalogSettings: &armdevcenter.ProjectCatalogSettings{ - // CatalogItemSyncTypes: []*armdevcenter.CatalogItemType{ - // to.Ptr(armdevcenter.CatalogItemTypeEnvironmentDefinition)}, - // }, - // DevCenterID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/devcenters/Contoso"), - // DisplayName: to.Ptr("Dev"), - // DevCenterURI: to.Ptr("https://4c7c8922-78e9-4928-aa6f-75ba59355371-contoso.centralus.devcenter.azure.com"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Projects_Delete.json -func ExampleProjectsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProjectsClient().BeginDelete(ctx, "rg1", "DevProject", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/responses.go b/sdk/resourcemanager/devcenter/armdevcenter/responses.go index d24b9fe55a83..cd9a6660e164 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/responses.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/responses.go @@ -100,6 +100,54 @@ type CheckScopedNameAvailabilityClientExecuteResponse struct { CheckNameAvailabilityResponse } +// CurationProfilesClientCreateOrUpdateResponse contains the response from method CurationProfilesClient.BeginCreateOrUpdate. +type CurationProfilesClientCreateOrUpdateResponse struct { + // Represents an curation profile resource. + CurationProfile +} + +// CurationProfilesClientDeleteResponse contains the response from method CurationProfilesClient.BeginDelete. +type CurationProfilesClientDeleteResponse struct { + // placeholder for future response values +} + +// CurationProfilesClientGetResponse contains the response from method CurationProfilesClient.Get. +type CurationProfilesClientGetResponse struct { + // Represents an curation profile resource. + CurationProfile +} + +// CurationProfilesClientListByDevCenterResponse contains the response from method CurationProfilesClient.NewListByDevCenterPager. +type CurationProfilesClientListByDevCenterResponse struct { + // Results of the curation profile list operation. + CurationProfileListResult +} + +// CurationProfilesClientUpdateResponse contains the response from method CurationProfilesClient.BeginUpdate. +type CurationProfilesClientUpdateResponse struct { + // Represents an curation profile resource. + CurationProfile +} + +// CustomizationTasksClientGetErrorDetailsResponse contains the response from method CustomizationTasksClient.GetErrorDetails. +type CustomizationTasksClientGetErrorDetailsResponse struct { + // List of validator error details. Populated when changes are made to the resource or its dependent resources that impact + // the validity of the Catalog resource. + CatalogResourceValidationErrorDetails +} + +// CustomizationTasksClientGetResponse contains the response from method CustomizationTasksClient.Get. +type CustomizationTasksClientGetResponse struct { + // Represents a Task to be used in customizing a Dev Box. + CustomizationTask +} + +// CustomizationTasksClientListByCatalogResponse contains the response from method CustomizationTasksClient.NewListByCatalogPager. +type CustomizationTasksClientListByCatalogResponse struct { + // Results of the Task list operation. + CustomizationTaskListResult +} + // DevBoxDefinitionsClientCreateOrUpdateResponse contains the response from method DevBoxDefinitionsClient.BeginCreateOrUpdate. type DevBoxDefinitionsClientCreateOrUpdateResponse struct { // Represents a definition for a Developer Machine. @@ -176,6 +224,35 @@ type DevCentersClientUpdateResponse struct { DevCenter } +// EncryptionSetsClientCreateOrUpdateResponse contains the response from method EncryptionSetsClient.BeginCreateOrUpdate. +type EncryptionSetsClientCreateOrUpdateResponse struct { + // Represents a devcenter encryption set resource. + EncryptionSet +} + +// EncryptionSetsClientDeleteResponse contains the response from method EncryptionSetsClient.BeginDelete. +type EncryptionSetsClientDeleteResponse struct { + // placeholder for future response values +} + +// EncryptionSetsClientGetResponse contains the response from method EncryptionSetsClient.Get. +type EncryptionSetsClientGetResponse struct { + // Represents a devcenter encryption set resource. + EncryptionSet +} + +// EncryptionSetsClientListResponse contains the response from method EncryptionSetsClient.NewListPager. +type EncryptionSetsClientListResponse struct { + // Result of the list devcenter encryption set operation + EncryptionSetListResult +} + +// EncryptionSetsClientUpdateResponse contains the response from method EncryptionSetsClient.BeginUpdate. +type EncryptionSetsClientUpdateResponse struct { + // Represents a devcenter encryption set resource. + EncryptionSet +} + // EnvironmentDefinitionsClientGetByProjectCatalogResponse contains the response from method EnvironmentDefinitionsClient.GetByProjectCatalog. type EnvironmentDefinitionsClientGetByProjectCatalogResponse struct { // Represents an environment definition catalog item. @@ -259,6 +336,12 @@ type GalleriesClientListByDevCenterResponse struct { GalleryListResult } +// ImageVersionsClientGetByProjectResponse contains the response from method ImageVersionsClient.GetByProject. +type ImageVersionsClientGetByProjectResponse struct { + // Represents an image version. + ImageVersion +} + // ImageVersionsClientGetResponse contains the response from method ImageVersionsClient.Get. type ImageVersionsClientGetResponse struct { // Represents an image version. @@ -271,6 +354,18 @@ type ImageVersionsClientListByImageResponse struct { ImageVersionListResult } +// ImageVersionsClientListByProjectResponse contains the response from method ImageVersionsClient.NewListByProjectPager. +type ImageVersionsClientListByProjectResponse struct { + // Results of the image version list operation. + ImageVersionListResult +} + +// ImagesClientGetByProjectResponse contains the response from method ImagesClient.GetByProject. +type ImagesClientGetByProjectResponse struct { + // Represents an image. + Image +} + // ImagesClientGetResponse contains the response from method ImagesClient.Get. type ImagesClientGetResponse struct { // Represents an image. @@ -289,6 +384,12 @@ type ImagesClientListByGalleryResponse struct { ImageListResult } +// ImagesClientListByProjectResponse contains the response from method ImagesClient.NewListByProjectPager. +type ImagesClientListByProjectResponse struct { + // Results of the image list operation. + ImageListResult +} + // NetworkConnectionsClientCreateOrUpdateResponse contains the response from method NetworkConnectionsClient.BeginCreateOrUpdate. type NetworkConnectionsClientCreateOrUpdateResponse struct { // Network related settings @@ -362,6 +463,70 @@ type OperationsClientListResponse struct { OperationListResult } +// PlanMembersClientCreateOrUpdateResponse contains the response from method PlanMembersClient.BeginCreateOrUpdate. +type PlanMembersClientCreateOrUpdateResponse struct { + // Represents a devcenter plan member resource. + PlanMember +} + +// PlanMembersClientDeleteResponse contains the response from method PlanMembersClient.BeginDelete. +type PlanMembersClientDeleteResponse struct { + // placeholder for future response values +} + +// PlanMembersClientGetResponse contains the response from method PlanMembersClient.Get. +type PlanMembersClientGetResponse struct { + // Represents a devcenter plan member resource. + PlanMember +} + +// PlanMembersClientListResponse contains the response from method PlanMembersClient.NewListPager. +type PlanMembersClientListResponse struct { + // Result of the list devcenter plan members operation + PlanMembersListResult +} + +// PlanMembersClientUpdateResponse contains the response from method PlanMembersClient.BeginUpdate. +type PlanMembersClientUpdateResponse struct { + // Represents a devcenter plan member resource. + PlanMember +} + +// PlansClientCreateOrUpdateResponse contains the response from method PlansClient.BeginCreateOrUpdate. +type PlansClientCreateOrUpdateResponse struct { + // Represents a devcenter plan resource. + Plan +} + +// PlansClientDeleteResponse contains the response from method PlansClient.BeginDelete. +type PlansClientDeleteResponse struct { + // placeholder for future response values +} + +// PlansClientGetResponse contains the response from method PlansClient.Get. +type PlansClientGetResponse struct { + // Represents a devcenter plan resource. + Plan +} + +// PlansClientListByResourceGroupResponse contains the response from method PlansClient.NewListByResourceGroupPager. +type PlansClientListByResourceGroupResponse struct { + // Result of the list devcenter plans operation + PlanListResult +} + +// PlansClientListBySubscriptionResponse contains the response from method PlansClient.NewListBySubscriptionPager. +type PlansClientListBySubscriptionResponse struct { + // Result of the list devcenter plans operation + PlanListResult +} + +// PlansClientUpdateResponse contains the response from method PlansClient.BeginUpdate. +type PlansClientUpdateResponse struct { + // Represents a devcenter plan resource. + Plan +} + // PoolsClientCreateOrUpdateResponse contains the response from method PoolsClient.BeginCreateOrUpdate. type PoolsClientCreateOrUpdateResponse struct { // A pool of Virtual Machines. @@ -415,6 +580,46 @@ type ProjectCatalogEnvironmentDefinitionsClientGetErrorDetailsResponse struct { CatalogResourceValidationErrorDetails } +// ProjectCatalogImageDefinitionBuildClientCancelResponse contains the response from method ProjectCatalogImageDefinitionBuildClient.BeginCancel. +type ProjectCatalogImageDefinitionBuildClientCancelResponse struct { + // placeholder for future response values +} + +// ProjectCatalogImageDefinitionBuildClientGetBuildDetailsResponse contains the response from method ProjectCatalogImageDefinitionBuildClient.GetBuildDetails. +type ProjectCatalogImageDefinitionBuildClientGetBuildDetailsResponse struct { + // Represents a specific build of an Image Definition. + ImageDefinitionBuildDetails +} + +// ProjectCatalogImageDefinitionBuildClientGetResponse contains the response from method ProjectCatalogImageDefinitionBuildClient.Get. +type ProjectCatalogImageDefinitionBuildClientGetResponse struct { + // Represents a specific build of an Image Definition. + ImageDefinitionBuild +} + +// ProjectCatalogImageDefinitionBuildsClientListByImageDefinitionResponse contains the response from method ProjectCatalogImageDefinitionBuildsClient.NewListByImageDefinitionPager. +type ProjectCatalogImageDefinitionBuildsClientListByImageDefinitionResponse struct { + // Results of the Image Definition Build list operation. + ImageDefinitionBuildListResult +} + +// ProjectCatalogImageDefinitionsClientBuildImageResponse contains the response from method ProjectCatalogImageDefinitionsClient.BeginBuildImage. +type ProjectCatalogImageDefinitionsClientBuildImageResponse struct { + // placeholder for future response values +} + +// ProjectCatalogImageDefinitionsClientGetByProjectCatalogResponse contains the response from method ProjectCatalogImageDefinitionsClient.GetByProjectCatalog. +type ProjectCatalogImageDefinitionsClientGetByProjectCatalogResponse struct { + // Represents a definition for an Image. + ImageDefinition +} + +// ProjectCatalogImageDefinitionsClientListByProjectCatalogResponse contains the response from method ProjectCatalogImageDefinitionsClient.NewListByProjectCatalogPager. +type ProjectCatalogImageDefinitionsClientListByProjectCatalogResponse struct { + // Results of the Image Definition list operation. + ImageDefinitionListResult +} + // ProjectCatalogsClientConnectResponse contains the response from method ProjectCatalogsClient.BeginConnect. type ProjectCatalogsClientConnectResponse struct { // placeholder for future response values @@ -489,6 +694,35 @@ type ProjectEnvironmentTypesClientUpdateResponse struct { ProjectEnvironmentType } +// ProjectPoliciesClientCreateOrUpdateResponse contains the response from method ProjectPoliciesClient.BeginCreateOrUpdate. +type ProjectPoliciesClientCreateOrUpdateResponse struct { + // Represents an project policy resource. + ProjectPolicy +} + +// ProjectPoliciesClientDeleteResponse contains the response from method ProjectPoliciesClient.BeginDelete. +type ProjectPoliciesClientDeleteResponse struct { + // placeholder for future response values +} + +// ProjectPoliciesClientGetResponse contains the response from method ProjectPoliciesClient.Get. +type ProjectPoliciesClientGetResponse struct { + // Represents an project policy resource. + ProjectPolicy +} + +// ProjectPoliciesClientListByDevCenterResponse contains the response from method ProjectPoliciesClient.NewListByDevCenterPager. +type ProjectPoliciesClientListByDevCenterResponse struct { + // Results of the project policy list operation. + ProjectPolicyListResult +} + +// ProjectPoliciesClientUpdateResponse contains the response from method ProjectPoliciesClient.BeginUpdate. +type ProjectPoliciesClientUpdateResponse struct { + // Represents an project policy resource. + ProjectPolicy +} + // ProjectsClientCreateOrUpdateResponse contains the response from method ProjectsClient.BeginCreateOrUpdate. type ProjectsClientCreateOrUpdateResponse struct { // Represents a project resource. @@ -500,6 +734,12 @@ type ProjectsClientDeleteResponse struct { // placeholder for future response values } +// ProjectsClientGetInheritedSettingsResponse contains the response from method ProjectsClient.GetInheritedSettings. +type ProjectsClientGetInheritedSettingsResponse struct { + // Applicable inherited settings for a project. + InheritedSettingsForProject +} + // ProjectsClientGetResponse contains the response from method ProjectsClient.Get. type ProjectsClientGetResponse struct { // Represents a project resource. @@ -524,6 +764,12 @@ type ProjectsClientUpdateResponse struct { Project } +// SKUsClientListByProjectResponse contains the response from method SKUsClient.NewListByProjectPager. +type SKUsClientListByProjectResponse struct { + // Results of the Microsoft.DevCenter SKU list operation. + SKUListResult +} + // SKUsClientListBySubscriptionResponse contains the response from method SKUsClient.NewListBySubscriptionPager. type SKUsClientListBySubscriptionResponse struct { // Results of the Microsoft.DevCenter SKU list operation. diff --git a/sdk/resourcemanager/devcenter/armdevcenter/schedules_client.go b/sdk/resourcemanager/devcenter/armdevcenter/schedules_client.go index 675b2b9784ba..ea44a676e348 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/schedules_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/schedules_client.go @@ -47,7 +47,7 @@ func NewSchedulesClient(subscriptionID string, credential azcore.TokenCredential // BeginCreateOrUpdate - Creates or updates a Schedule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - poolName - Name of the pool. @@ -76,7 +76,7 @@ func (client *SchedulesClient) BeginCreateOrUpdate(ctx context.Context, resource // CreateOrUpdate - Creates or updates a Schedule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *SchedulesClient) createOrUpdate(ctx context.Context, resourceGroupName string, projectName string, poolName string, scheduleName string, body Schedule, options *SchedulesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "SchedulesClient.BeginCreateOrUpdate" @@ -129,7 +129,7 @@ func (client *SchedulesClient) createOrUpdateCreateRequest(ctx context.Context, if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -141,7 +141,7 @@ func (client *SchedulesClient) createOrUpdateCreateRequest(ctx context.Context, // BeginDelete - Deletes a Scheduled. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - poolName - Name of the pool. @@ -168,7 +168,7 @@ func (client *SchedulesClient) BeginDelete(ctx context.Context, resourceGroupNam // Delete - Deletes a Scheduled. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *SchedulesClient) deleteOperation(ctx context.Context, resourceGroupName string, projectName string, poolName string, scheduleName string, options *SchedulesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "SchedulesClient.BeginDelete" @@ -221,7 +221,7 @@ func (client *SchedulesClient) deleteCreateRequest(ctx context.Context, resource if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -230,7 +230,7 @@ func (client *SchedulesClient) deleteCreateRequest(ctx context.Context, resource // Get - Gets a schedule resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - poolName - Name of the pool. @@ -289,7 +289,7 @@ func (client *SchedulesClient) getCreateRequest(ctx context.Context, resourceGro if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -306,7 +306,7 @@ func (client *SchedulesClient) getHandleResponse(resp *http.Response) (Schedules // NewListByPoolPager - Lists schedules for a pool // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - poolName - Name of the pool. @@ -362,7 +362,7 @@ func (client *SchedulesClient) listByPoolCreateRequest(ctx context.Context, reso if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -380,7 +380,7 @@ func (client *SchedulesClient) listByPoolHandleResponse(resp *http.Response) (Sc // BeginUpdate - Partially updates a Scheduled. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - projectName - The name of the project. // - poolName - Name of the pool. @@ -408,7 +408,7 @@ func (client *SchedulesClient) BeginUpdate(ctx context.Context, resourceGroupNam // Update - Partially updates a Scheduled. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview func (client *SchedulesClient) update(ctx context.Context, resourceGroupName string, projectName string, poolName string, scheduleName string, body ScheduleUpdate, options *SchedulesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "SchedulesClient.BeginUpdate" @@ -461,7 +461,7 @@ func (client *SchedulesClient) updateCreateRequest(ctx context.Context, resource if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { diff --git a/sdk/resourcemanager/devcenter/armdevcenter/schedules_client_example_test.go b/sdk/resourcemanager/devcenter/armdevcenter/schedules_client_example_test.go deleted file mode 100644 index d104789efc80..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/schedules_client_example_test.go +++ /dev/null @@ -1,232 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdevcenter_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Schedules_ListByPool.json -func ExampleSchedulesClient_NewListByPoolPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSchedulesClient().NewListByPoolPager("rg1", "TestProject", "DevPool", &armdevcenter.SchedulesClientListByPoolOptions{Top: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ScheduleListResult = armdevcenter.ScheduleListResult{ - // Value: []*armdevcenter.Schedule{ - // { - // Name: to.Ptr("autoShutdown"), - // Type: to.Ptr("Microsoft.DevCenter/pools/schedules"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/TestProject/pools/DevPool/schedules/autoShutdown"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.ScheduleProperties{ - // Type: to.Ptr(armdevcenter.ScheduledTypeStopDevBox), - // Frequency: to.Ptr(armdevcenter.ScheduledFrequencyDaily), - // State: to.Ptr(armdevcenter.ScheduleEnableStatusEnabled), - // Time: to.Ptr("17:30"), - // TimeZone: to.Ptr("America/Los_Angeles"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Schedules_Get.json -func ExampleSchedulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSchedulesClient().Get(ctx, "rg1", "TestProject", "DevPool", "autoShutdown", &armdevcenter.SchedulesClientGetOptions{Top: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Schedule = armdevcenter.Schedule{ - // Name: to.Ptr("autoShutdown"), - // Type: to.Ptr("Microsoft.DevCenter/pools/schedules"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/TestProject/pools/DevPool/schedules/autoShutdown"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.ScheduleProperties{ - // Type: to.Ptr(armdevcenter.ScheduledTypeStopDevBox), - // Frequency: to.Ptr(armdevcenter.ScheduledFrequencyDaily), - // State: to.Ptr(armdevcenter.ScheduleEnableStatusEnabled), - // Time: to.Ptr("17:30"), - // TimeZone: to.Ptr("America/Los_Angeles"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Schedules_CreateDailyShutdownPoolSchedule.json -func ExampleSchedulesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSchedulesClient().BeginCreateOrUpdate(ctx, "rg1", "DevProject", "DevPool", "autoShutdown", armdevcenter.Schedule{ - Properties: &armdevcenter.ScheduleProperties{ - Type: to.Ptr(armdevcenter.ScheduledTypeStopDevBox), - Frequency: to.Ptr(armdevcenter.ScheduledFrequencyDaily), - State: to.Ptr(armdevcenter.ScheduleEnableStatusEnabled), - Time: to.Ptr("17:30"), - TimeZone: to.Ptr("America/Los_Angeles"), - }, - }, &armdevcenter.SchedulesClientBeginCreateOrUpdateOptions{Top: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Schedule = armdevcenter.Schedule{ - // Name: to.Ptr("autoShutdown"), - // Type: to.Ptr("Microsoft.DevCenter/pools/schedules"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/TestProject/pools/DevPool/schedules/autoShutdown"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.ScheduleProperties{ - // Type: to.Ptr(armdevcenter.ScheduledTypeStopDevBox), - // Frequency: to.Ptr(armdevcenter.ScheduledFrequencyDaily), - // State: to.Ptr(armdevcenter.ScheduleEnableStatusEnabled), - // Time: to.Ptr("17:30"), - // TimeZone: to.Ptr("America/Los_Angeles"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Schedules_Patch.json -func ExampleSchedulesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSchedulesClient().BeginUpdate(ctx, "rg1", "TestProject", "DevPool", "autoShutdown", armdevcenter.ScheduleUpdate{ - Properties: &armdevcenter.ScheduleUpdateProperties{ - Time: to.Ptr("18:00"), - }, - }, &armdevcenter.SchedulesClientBeginUpdateOptions{Top: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Schedule = armdevcenter.Schedule{ - // Name: to.Ptr("autoShutdown"), - // Type: to.Ptr("Microsoft.DevCenter/pools/schedules"), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/resourceGroups/rg1/providers/Microsoft.DevCenter/projects/TestProject/pools/DevPool/schedules/autoShutdown"), - // SystemData: &armdevcenter.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:00:36.993Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-18T18:30:36.993Z"); return t}()), - // LastModifiedBy: to.Ptr("user1"), - // LastModifiedByType: to.Ptr(armdevcenter.CreatedByTypeUser), - // }, - // Properties: &armdevcenter.ScheduleProperties{ - // Type: to.Ptr(armdevcenter.ScheduledTypeStopDevBox), - // Frequency: to.Ptr(armdevcenter.ScheduledFrequencyDaily), - // State: to.Ptr(armdevcenter.ScheduleEnableStatusEnabled), - // Time: to.Ptr("17:30"), - // TimeZone: to.Ptr("America/Los_Angeles"), - // ProvisioningState: to.Ptr(armdevcenter.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Schedules_Delete.json -func ExampleSchedulesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSchedulesClient().BeginDelete(ctx, "rg1", "TestProject", "DevPool", "autoShutdown", &armdevcenter.SchedulesClientBeginDeleteOptions{Top: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/skus_client.go b/sdk/resourcemanager/devcenter/armdevcenter/skus_client.go index 78f0b95d3475..88b1c15ff036 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/skus_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/skus_client.go @@ -44,9 +44,73 @@ func NewSKUsClient(subscriptionID string, credential azcore.TokenCredential, opt return client, nil } +// NewListByProjectPager - Lists SKUs available to the project +// +// Generated from API version 2024-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - projectName - The name of the project. +// - options - SKUsClientListByProjectOptions contains the optional parameters for the SKUsClient.NewListByProjectPager method. +func (client *SKUsClient) NewListByProjectPager(resourceGroupName string, projectName string, options *SKUsClientListByProjectOptions) *runtime.Pager[SKUsClientListByProjectResponse] { + return runtime.NewPager(runtime.PagingHandler[SKUsClientListByProjectResponse]{ + More: func(page SKUsClientListByProjectResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SKUsClientListByProjectResponse) (SKUsClientListByProjectResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SKUsClient.NewListByProjectPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByProjectCreateRequest(ctx, resourceGroupName, projectName, options) + }, nil) + if err != nil { + return SKUsClientListByProjectResponse{}, err + } + return client.listByProjectHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByProjectCreateRequest creates the ListByProject request. +func (client *SKUsClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *SKUsClientListByProjectOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects/{projectName}/listSkus" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByProjectHandleResponse handles the ListByProject response. +func (client *SKUsClient) listByProjectHandleResponse(resp *http.Response) (SKUsClientListByProjectResponse, error) { + result := SKUsClientListByProjectResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SKUListResult); err != nil { + return SKUsClientListByProjectResponse{}, err + } + return result, nil +} + // NewListBySubscriptionPager - Lists the Microsoft.DevCenter SKUs available in a subscription // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - options - SKUsClientListBySubscriptionOptions contains the optional parameters for the SKUsClient.NewListBySubscriptionPager // method. func (client *SKUsClient) NewListBySubscriptionPager(options *SKUsClientListBySubscriptionOptions) *runtime.Pager[SKUsClientListBySubscriptionResponse] { @@ -87,7 +151,7 @@ func (client *SKUsClient) listBySubscriptionCreateRequest(ctx context.Context, o if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/devcenter/armdevcenter/skus_client_example_test.go b/sdk/resourcemanager/devcenter/armdevcenter/skus_client_example_test.go deleted file mode 100644 index 34250f73604c..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/skus_client_example_test.go +++ /dev/null @@ -1,60 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdevcenter_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Skus_ListBySubscription.json -func ExampleSKUsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSKUsClient().NewListBySubscriptionPager(&armdevcenter.SKUsClientListBySubscriptionOptions{Top: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SKUListResult = armdevcenter.SKUListResult{ - // Value: []*armdevcenter.SKUInfo{ - // { - // Name: to.Ptr("Large"), - // Tier: to.Ptr(armdevcenter.SKUTierPremium), - // Locations: []*string{ - // to.Ptr("CentralUS")}, - // ResourceType: to.Ptr("projects/pools"), - // }, - // { - // Name: to.Ptr("Medium"), - // Tier: to.Ptr(armdevcenter.SKUTierStandard), - // Locations: []*string{ - // to.Ptr("CentralUS")}, - // ResourceType: to.Ptr("projects/pools"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/usages_client.go b/sdk/resourcemanager/devcenter/armdevcenter/usages_client.go index 313073ffb84c..777aacb13727 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/usages_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/usages_client.go @@ -45,7 +45,7 @@ func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, o // NewListByLocationPager - Lists the current usages and limits in this location for the provided subscription. // -// Generated from API version 2024-02-01 +// Generated from API version 2024-10-01-preview // - location - The Azure region // - options - UsagesClientListByLocationOptions contains the optional parameters for the UsagesClient.NewListByLocationPager // method. @@ -88,7 +88,7 @@ func (client *UsagesClient) listByLocationCreateRequest(ctx context.Context, loc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-02-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/devcenter/armdevcenter/usages_client_example_test.go b/sdk/resourcemanager/devcenter/armdevcenter/usages_client_example_test.go deleted file mode 100644 index 8ac36082c6cd..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/usages_client_example_test.go +++ /dev/null @@ -1,64 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdevcenter_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcenter/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/devcenter/resource-manager/Microsoft.DevCenter/stable/2024-02-01/examples/Usages_ListByLocation.json -func ExampleUsagesClient_NewListByLocationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdevcenter.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsagesClient().NewListByLocationPager("westus", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListUsagesResult = armdevcenter.ListUsagesResult{ - // Value: []*armdevcenter.Usage{ - // { - // Name: &armdevcenter.UsageName{ - // Value: to.Ptr("devcenters"), - // }, - // CurrentValue: to.Ptr[int64](2), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/Microsoft.DevCenter/locations/westus/quotas/devcenters"), - // Limit: to.Ptr[int64](8), - // Unit: to.Ptr(armdevcenter.UsageUnitCount), - // }, - // { - // Name: &armdevcenter.UsageName{ - // Value: to.Ptr("projects"), - // }, - // CurrentValue: to.Ptr[int64](5), - // ID: to.Ptr("/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c58ffff/Microsoft.DevCenter/locations/westus/quotas/projects"), - // Limit: to.Ptr[int64](30), - // Unit: to.Ptr(armdevcenter.UsageUnitCount), - // }}, - // } - } -}