diff --git a/sdk/resourcemanager/devcenter/armdevcenter/CHANGELOG.md b/sdk/resourcemanager/devcenter/armdevcenter/CHANGELOG.md index 707a8fd07d34..7a5d090b9c98 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/CHANGELOG.md +++ b/sdk/resourcemanager/devcenter/armdevcenter/CHANGELOG.md @@ -1,5 +1,67 @@ # Release History +## 0.5.0 (2023-03-21) +### Breaking Changes + +- Type of `ProjectEnvironmentTypeProperties.Status` has been changed from `*EnableStatus` to `*EnvironmentTypeEnableStatus` +- Type of `ProjectEnvironmentTypeUpdateProperties.Status` has been changed from `*EnableStatus` to `*EnvironmentTypeEnableStatus` +- Type of `ScheduleProperties.State` has been changed from `*EnableStatus` to `*ScheduleEnableStatus` +- Type of `ScheduleUpdateProperties.State` has been changed from `*EnableStatus` to `*ScheduleEnableStatus` +- Type alias `EnableStatus` has been removed +- Type alias `UsageUnit` has been removed +- Function `NewUsagesClient` has been removed +- Function `*UsagesClient.NewListByLocationPager` has been removed +- Struct `ListUsagesResult` has been removed +- Struct `Usage` has been removed +- Struct `UsageName` has been removed +- Struct `UsagesClient` has been removed +- Field `Offer` of struct `ImageReference` has been removed +- Field `Publisher` of struct `ImageReference` has been removed +- Field `SKU` of struct `ImageReference` has been removed + +### Features Added + +- New enum type `EnvironmentTypeEnableStatus` with values `EnvironmentTypeEnableStatusDisabled`, `EnvironmentTypeEnableStatusEnabled` +- New enum type `HealthStatus` with values `HealthStatusHealthy`, `HealthStatusPending`, `HealthStatusUnhealthy`, `HealthStatusUnknown`, `HealthStatusWarning` +- New enum type `ScheduleEnableStatus` with values `ScheduleEnableStatusDisabled`, `ScheduleEnableStatusEnabled` +- New enum type `StopOnDisconnectEnableStatus` with values `StopOnDisconnectEnableStatusDisabled`, `StopOnDisconnectEnableStatusEnabled` +- New function `NewClientFactory(string, azcore.TokenCredential, *arm.ClientOptions) (*ClientFactory, error)` +- New function `*ClientFactory.NewAttachedNetworksClient() *AttachedNetworksClient` +- New function `*ClientFactory.NewCatalogsClient() *CatalogsClient` +- New function `*ClientFactory.NewCheckNameAvailabilityClient() *CheckNameAvailabilityClient` +- New function `*ClientFactory.NewDevBoxDefinitionsClient() *DevBoxDefinitionsClient` +- New function `*ClientFactory.NewDevCentersClient() *DevCentersClient` +- New function `*ClientFactory.NewEnvironmentTypesClient() *EnvironmentTypesClient` +- New function `*ClientFactory.NewGalleriesClient() *GalleriesClient` +- New function `*ClientFactory.NewImageVersionsClient() *ImageVersionsClient` +- New function `*ClientFactory.NewImagesClient() *ImagesClient` +- New function `*ClientFactory.NewNetworkConnectionsClient() *NetworkConnectionsClient` +- New function `*ClientFactory.NewOperationStatusesClient() *OperationStatusesClient` +- New function `*ClientFactory.NewOperationsClient() *OperationsClient` +- New function `*ClientFactory.NewPoolsClient() *PoolsClient` +- New function `*ClientFactory.NewProjectAllowedEnvironmentTypesClient() *ProjectAllowedEnvironmentTypesClient` +- New function `*ClientFactory.NewProjectEnvironmentTypesClient() *ProjectEnvironmentTypesClient` +- New function `*ClientFactory.NewProjectsClient() *ProjectsClient` +- New function `*ClientFactory.NewSKUsClient() *SKUsClient` +- New function `*ClientFactory.NewSchedulesClient() *SchedulesClient` +- New function `*PoolsClient.BeginRunHealthChecks(context.Context, string, string, string, *PoolsClientBeginRunHealthChecksOptions) (*runtime.Poller[PoolsClientRunHealthChecksResponse], error)` +- New function `*NetworkConnectionsClient.NewListOutboundNetworkDependenciesEndpointsPager(string, string, *NetworkConnectionsClientListOutboundNetworkDependenciesEndpointsOptions) *runtime.Pager[NetworkConnectionsClientListOutboundNetworkDependenciesEndpointsResponse]` +- New struct `ClientFactory` +- New struct `EndpointDependency` +- New struct `EndpointDetail` +- New struct `HealthStatusDetail` +- New struct `OutboundEnvironmentEndpoint` +- New struct `OutboundEnvironmentEndpointCollection` +- New struct `StopOnDisconnectConfiguration` +- New field `HibernateSupport` in struct `ImageProperties` +- New field `HealthStatus` in struct `PoolProperties` +- New field `HealthStatusDetails` in struct `PoolProperties` +- New field `StopOnDisconnect` in struct `PoolProperties` +- New field `StopOnDisconnect` in struct `PoolUpdateProperties` +- New field `MaxDevBoxesPerUser` in struct `ProjectProperties` +- New field `MaxDevBoxesPerUser` in struct `ProjectUpdateProperties` + + ## 0.4.0 (2022-11-24) ### Breaking Changes diff --git a/sdk/resourcemanager/devcenter/armdevcenter/attachednetworks_client.go b/sdk/resourcemanager/devcenter/armdevcenter/attachednetworks_client.go index a9f4a7032d58..e765bcbd837d 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/attachednetworks_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/attachednetworks_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -27,67 +25,60 @@ import ( // AttachedNetworksClient contains the methods for the AttachedNetworks group. // Don't use this type directly, use NewAttachedNetworksClient() instead. type AttachedNetworksClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewAttachedNetworksClient creates a new instance of AttachedNetworksClient 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. +// - 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 NewAttachedNetworksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AttachedNetworksClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".AttachedNetworksClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &AttachedNetworksClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // BeginCreateOrUpdate - Creates or updates an attached NetworkConnection. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-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. -// body - Represents an attached NetworkConnection. -// options - AttachedNetworksClientBeginCreateOrUpdateOptions contains the optional parameters for the AttachedNetworksClient.BeginCreateOrUpdate -// method. +// +// Generated from API version 2023-01-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. +// - body - Represents an attached NetworkConnection. +// - options - AttachedNetworksClientBeginCreateOrUpdateOptions contains the optional parameters for the AttachedNetworksClient.BeginCreateOrUpdate +// method. func (client *AttachedNetworksClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, devCenterName string, attachedNetworkConnectionName string, body AttachedNetworkConnection, options *AttachedNetworksClientBeginCreateOrUpdateOptions) (*runtime.Poller[AttachedNetworksClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, devCenterName, attachedNetworkConnectionName, body, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[AttachedNetworksClientCreateOrUpdateResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AttachedNetworksClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[AttachedNetworksClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[AttachedNetworksClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // CreateOrUpdate - Creates or updates an attached NetworkConnection. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview +// +// Generated from API version 2023-01-01-preview func (client *AttachedNetworksClient) createOrUpdate(ctx context.Context, resourceGroupName string, devCenterName string, attachedNetworkConnectionName string, body AttachedNetworkConnection, options *AttachedNetworksClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, devCenterName, attachedNetworkConnectionName, body, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -116,12 +107,12 @@ func (client *AttachedNetworksClient) createOrUpdateCreateRequest(ctx context.Co return nil, errors.New("parameter attachedNetworkConnectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{attachedNetworkConnectionName}", url.PathEscape(attachedNetworkConnectionName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -129,35 +120,37 @@ 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 2022-11-11-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. -// options - AttachedNetworksClientBeginDeleteOptions contains the optional parameters for the AttachedNetworksClient.BeginDelete -// method. +// +// Generated from API version 2023-01-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. +// - options - AttachedNetworksClientBeginDeleteOptions contains the optional parameters for the AttachedNetworksClient.BeginDelete +// method. func (client *AttachedNetworksClient) BeginDelete(ctx context.Context, resourceGroupName string, devCenterName string, attachedNetworkConnectionName string, options *AttachedNetworksClientBeginDeleteOptions) (*runtime.Poller[AttachedNetworksClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, devCenterName, attachedNetworkConnectionName, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[AttachedNetworksClientDeleteResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AttachedNetworksClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[AttachedNetworksClientDeleteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[AttachedNetworksClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Delete - Un-attach a NetworkConnection. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview +// +// Generated from API version 2023-01-01-preview func (client *AttachedNetworksClient) deleteOperation(ctx context.Context, resourceGroupName string, devCenterName string, attachedNetworkConnectionName string, options *AttachedNetworksClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, devCenterName, attachedNetworkConnectionName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -186,12 +179,12 @@ func (client *AttachedNetworksClient) deleteCreateRequest(ctx context.Context, r return nil, errors.New("parameter attachedNetworkConnectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{attachedNetworkConnectionName}", url.PathEscape(attachedNetworkConnectionName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -199,18 +192,19 @@ 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 2022-11-11-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. -// options - AttachedNetworksClientGetByDevCenterOptions contains the optional parameters for the AttachedNetworksClient.GetByDevCenter -// method. +// +// Generated from API version 2023-01-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. +// - options - AttachedNetworksClientGetByDevCenterOptions contains the optional parameters for the AttachedNetworksClient.GetByDevCenter +// method. func (client *AttachedNetworksClient) GetByDevCenter(ctx context.Context, resourceGroupName string, devCenterName string, attachedNetworkConnectionName string, options *AttachedNetworksClientGetByDevCenterOptions) (AttachedNetworksClientGetByDevCenterResponse, error) { req, err := client.getByDevCenterCreateRequest(ctx, resourceGroupName, devCenterName, attachedNetworkConnectionName, options) if err != nil { return AttachedNetworksClientGetByDevCenterResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return AttachedNetworksClientGetByDevCenterResponse{}, err } @@ -239,12 +233,12 @@ func (client *AttachedNetworksClient) getByDevCenterCreateRequest(ctx context.Co return nil, errors.New("parameter attachedNetworkConnectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{attachedNetworkConnectionName}", url.PathEscape(attachedNetworkConnectionName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -261,18 +255,19 @@ 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 2022-11-11-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. -// options - AttachedNetworksClientGetByProjectOptions contains the optional parameters for the AttachedNetworksClient.GetByProject -// method. +// +// Generated from API version 2023-01-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. +// - options - AttachedNetworksClientGetByProjectOptions contains the optional parameters for the AttachedNetworksClient.GetByProject +// method. func (client *AttachedNetworksClient) GetByProject(ctx context.Context, resourceGroupName string, projectName string, attachedNetworkConnectionName string, options *AttachedNetworksClientGetByProjectOptions) (AttachedNetworksClientGetByProjectResponse, error) { req, err := client.getByProjectCreateRequest(ctx, resourceGroupName, projectName, attachedNetworkConnectionName, options) if err != nil { return AttachedNetworksClientGetByProjectResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return AttachedNetworksClientGetByProjectResponse{}, err } @@ -301,12 +296,12 @@ func (client *AttachedNetworksClient) getByProjectCreateRequest(ctx context.Cont return nil, errors.New("parameter attachedNetworkConnectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{attachedNetworkConnectionName}", url.PathEscape(attachedNetworkConnectionName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -322,11 +317,12 @@ func (client *AttachedNetworksClient) getByProjectHandleResponse(resp *http.Resp } // NewListByDevCenterPager - Lists the attached NetworkConnections for a DevCenter. -// Generated from API version 2022-11-11-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.ListByDevCenter -// method. +// +// Generated from API version 2023-01-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 +// method. func (client *AttachedNetworksClient) NewListByDevCenterPager(resourceGroupName string, devCenterName string, options *AttachedNetworksClientListByDevCenterOptions) *runtime.Pager[AttachedNetworksClientListByDevCenterResponse] { return runtime.NewPager(runtime.PagingHandler[AttachedNetworksClientListByDevCenterResponse]{ More: func(page AttachedNetworksClientListByDevCenterResponse) bool { @@ -343,7 +339,7 @@ func (client *AttachedNetworksClient) NewListByDevCenterPager(resourceGroupName if err != nil { return AttachedNetworksClientListByDevCenterResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return AttachedNetworksClientListByDevCenterResponse{}, err } @@ -370,12 +366,12 @@ func (client *AttachedNetworksClient) listByDevCenterCreateRequest(ctx context.C 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.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } @@ -394,11 +390,12 @@ func (client *AttachedNetworksClient) listByDevCenterHandleResponse(resp *http.R } // NewListByProjectPager - Lists the attached NetworkConnections for a Project. -// Generated from API version 2022-11-11-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.ListByProject -// method. +// +// Generated from API version 2023-01-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 +// method. func (client *AttachedNetworksClient) NewListByProjectPager(resourceGroupName string, projectName string, options *AttachedNetworksClientListByProjectOptions) *runtime.Pager[AttachedNetworksClientListByProjectResponse] { return runtime.NewPager(runtime.PagingHandler[AttachedNetworksClientListByProjectResponse]{ More: func(page AttachedNetworksClientListByProjectResponse) bool { @@ -415,7 +412,7 @@ func (client *AttachedNetworksClient) NewListByProjectPager(resourceGroupName st if err != nil { return AttachedNetworksClientListByProjectResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return AttachedNetworksClientListByProjectResponse{}, err } @@ -442,12 +439,12 @@ func (client *AttachedNetworksClient) listByProjectCreateRequest(ctx context.Con 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.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } 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 94d77b2f4793..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/attachednetworks_client_example_test.go +++ /dev/null @@ -1,150 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewAttachedNetworksClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByProjectPager("rg1", "DevProject", &armdevcenter.AttachedNetworksClientListByProjectOptions{Top: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewAttachedNetworksClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetByProject(ctx, "rg1", "DevProject", "network-uswest3", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewAttachedNetworksClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByDevCenterPager("rg1", "Contoso", &armdevcenter.AttachedNetworksClientListByDevCenterOptions{Top: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewAttachedNetworksClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetByDevCenter(ctx, "rg1", "Contoso", "network-uswest3", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewAttachedNetworksClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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) - } - _, 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/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewAttachedNetworksClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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 db192dd67d05..cc1d7edb8381 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/autorest.md +++ b/sdk/resourcemanager/devcenter/armdevcenter/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/c583b05741fadfdca116be3b9ccb1c4be8a73258/specification/devcenter/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/c583b05741fadfdca116be3b9ccb1c4be8a73258/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: 0.4.0 +module-version: 0.5.0 ``` \ 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 47d8936ee9d9..f668158e7c95 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/catalogs_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/catalogs_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -27,67 +25,60 @@ import ( // CatalogsClient contains the methods for the Catalogs group. // Don't use this type directly, use NewCatalogsClient() instead. type CatalogsClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewCatalogsClient creates a new instance of CatalogsClient 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. +// - 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 NewCatalogsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CatalogsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".CatalogsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &CatalogsClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // BeginCreateOrUpdate - Creates or updates a catalog. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-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. -// body - Represents a catalog. -// options - CatalogsClientBeginCreateOrUpdateOptions contains the optional parameters for the CatalogsClient.BeginCreateOrUpdate -// method. +// +// Generated from API version 2023-01-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. +// - body - Represents a catalog. +// - options - CatalogsClientBeginCreateOrUpdateOptions contains the optional parameters for the CatalogsClient.BeginCreateOrUpdate +// method. func (client *CatalogsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, devCenterName string, catalogName string, body Catalog, options *CatalogsClientBeginCreateOrUpdateOptions) (*runtime.Poller[CatalogsClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, devCenterName, catalogName, body, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[CatalogsClientCreateOrUpdateResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CatalogsClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[CatalogsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[CatalogsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // CreateOrUpdate - Creates or updates a catalog. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview +// +// Generated from API version 2023-01-01-preview func (client *CatalogsClient) createOrUpdate(ctx context.Context, resourceGroupName string, devCenterName string, catalogName string, body Catalog, options *CatalogsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, devCenterName, catalogName, body, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -116,12 +107,12 @@ func (client *CatalogsClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, errors.New("parameter catalogName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{catalogName}", url.PathEscape(catalogName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -129,34 +120,36 @@ 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 2022-11-11-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 - CatalogsClientBeginDeleteOptions contains the optional parameters for the CatalogsClient.BeginDelete method. +// +// Generated from API version 2023-01-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 - CatalogsClientBeginDeleteOptions contains the optional parameters for the CatalogsClient.BeginDelete method. func (client *CatalogsClient) BeginDelete(ctx context.Context, resourceGroupName string, devCenterName string, catalogName string, options *CatalogsClientBeginDeleteOptions) (*runtime.Poller[CatalogsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, devCenterName, catalogName, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[CatalogsClientDeleteResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CatalogsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[CatalogsClientDeleteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[CatalogsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Delete - Deletes a catalog resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview +// +// Generated from API version 2023-01-01-preview func (client *CatalogsClient) deleteOperation(ctx context.Context, resourceGroupName string, devCenterName string, catalogName string, options *CatalogsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, devCenterName, catalogName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -185,12 +178,12 @@ func (client *CatalogsClient) deleteCreateRequest(ctx context.Context, resourceG return nil, errors.New("parameter catalogName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{catalogName}", url.PathEscape(catalogName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -198,17 +191,18 @@ 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 2022-11-11-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 - CatalogsClientGetOptions contains the optional parameters for the CatalogsClient.Get method. +// +// Generated from API version 2023-01-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 - CatalogsClientGetOptions contains the optional parameters for the CatalogsClient.Get method. func (client *CatalogsClient) Get(ctx context.Context, resourceGroupName string, devCenterName string, catalogName string, options *CatalogsClientGetOptions) (CatalogsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, devCenterName, catalogName, options) if err != nil { return CatalogsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return CatalogsClientGetResponse{}, err } @@ -237,12 +231,12 @@ func (client *CatalogsClient) getCreateRequest(ctx context.Context, resourceGrou 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.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -258,11 +252,12 @@ func (client *CatalogsClient) getHandleResponse(resp *http.Response) (CatalogsCl } // NewListByDevCenterPager - Lists catalogs for a devcenter. -// Generated from API version 2022-11-11-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.ListByDevCenter -// method. +// +// Generated from API version 2023-01-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 +// method. func (client *CatalogsClient) NewListByDevCenterPager(resourceGroupName string, devCenterName string, options *CatalogsClientListByDevCenterOptions) *runtime.Pager[CatalogsClientListByDevCenterResponse] { return runtime.NewPager(runtime.PagingHandler[CatalogsClientListByDevCenterResponse]{ More: func(page CatalogsClientListByDevCenterResponse) bool { @@ -279,7 +274,7 @@ func (client *CatalogsClient) NewListByDevCenterPager(resourceGroupName string, if err != nil { return CatalogsClientListByDevCenterResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return CatalogsClientListByDevCenterResponse{}, err } @@ -306,12 +301,12 @@ func (client *CatalogsClient) listByDevCenterCreateRequest(ctx context.Context, 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.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } @@ -331,34 +326,36 @@ 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 2022-11-11-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 - CatalogsClientBeginSyncOptions contains the optional parameters for the CatalogsClient.BeginSync method. +// +// Generated from API version 2023-01-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 - CatalogsClientBeginSyncOptions contains the optional parameters for the CatalogsClient.BeginSync method. func (client *CatalogsClient) BeginSync(ctx context.Context, resourceGroupName string, devCenterName string, catalogName string, options *CatalogsClientBeginSyncOptions) (*runtime.Poller[CatalogsClientSyncResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.syncOperation(ctx, resourceGroupName, devCenterName, catalogName, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[CatalogsClientSyncResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CatalogsClientSyncResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[CatalogsClientSyncResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[CatalogsClientSyncResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Sync - Syncs templates for a template source. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview +// +// Generated from API version 2023-01-01-preview func (client *CatalogsClient) syncOperation(ctx context.Context, resourceGroupName string, devCenterName string, catalogName string, options *CatalogsClientBeginSyncOptions) (*http.Response, error) { req, err := client.syncCreateRequest(ctx, resourceGroupName, devCenterName, catalogName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -387,12 +384,12 @@ func (client *CatalogsClient) syncCreateRequest(ctx context.Context, resourceGro return nil, errors.New("parameter catalogName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{catalogName}", url.PathEscape(catalogName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -400,35 +397,37 @@ 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 2022-11-11-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. -// body - Updatable catalog properties. -// options - CatalogsClientBeginUpdateOptions contains the optional parameters for the CatalogsClient.BeginUpdate method. +// +// Generated from API version 2023-01-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. +// - body - Updatable catalog properties. +// - options - CatalogsClientBeginUpdateOptions contains the optional parameters for the CatalogsClient.BeginUpdate method. func (client *CatalogsClient) BeginUpdate(ctx context.Context, resourceGroupName string, devCenterName string, catalogName string, body CatalogUpdate, options *CatalogsClientBeginUpdateOptions) (*runtime.Poller[CatalogsClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.update(ctx, resourceGroupName, devCenterName, catalogName, body, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[CatalogsClientUpdateResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CatalogsClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[CatalogsClientUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[CatalogsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Update - Partially updates a catalog. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview +// +// Generated from API version 2023-01-01-preview func (client *CatalogsClient) update(ctx context.Context, resourceGroupName string, devCenterName string, catalogName string, body CatalogUpdate, options *CatalogsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, devCenterName, catalogName, body, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -457,12 +456,12 @@ func (client *CatalogsClient) updateCreateRequest(ctx context.Context, resourceG return nil, errors.New("parameter catalogName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{catalogName}", url.PathEscape(catalogName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) 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 71297201e529..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/catalogs_client_example_test.go +++ /dev/null @@ -1,192 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewCatalogsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByDevCenterPager("rg1", "Contoso", &armdevcenter.CatalogsClientListByDevCenterOptions{Top: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewCatalogsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "rg1", "Contoso", "CentralCatalog", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewCatalogsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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"), - }, - }, - }, 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/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewCatalogsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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"), - }, - }, - }, 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/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewCatalogsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "rg1", "Contoso", "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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewCatalogsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewCatalogsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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) - } -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/checknameavailability_client.go b/sdk/resourcemanager/devcenter/armdevcenter/checknameavailability_client.go index b9baa4277292..2212efa28091 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/checknameavailability_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/checknameavailability_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,47 +24,39 @@ import ( // CheckNameAvailabilityClient contains the methods for the CheckNameAvailability group. // Don't use this type directly, use NewCheckNameAvailabilityClient() instead. type CheckNameAvailabilityClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewCheckNameAvailabilityClient creates a new instance of CheckNameAvailabilityClient 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. +// - 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 NewCheckNameAvailabilityClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CheckNameAvailabilityClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".CheckNameAvailabilityClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &CheckNameAvailabilityClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // Execute - Check the availability of name for resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview -// nameAvailabilityRequest - The required parameters for checking if resource name is available. -// options - CheckNameAvailabilityClientExecuteOptions contains the optional parameters for the CheckNameAvailabilityClient.Execute -// method. +// +// Generated from API version 2023-01-01-preview +// - nameAvailabilityRequest - The required parameters for checking if resource name is available. +// - options - CheckNameAvailabilityClientExecuteOptions contains the optional parameters for the CheckNameAvailabilityClient.Execute +// method. func (client *CheckNameAvailabilityClient) Execute(ctx context.Context, nameAvailabilityRequest CheckNameAvailabilityRequest, options *CheckNameAvailabilityClientExecuteOptions) (CheckNameAvailabilityClientExecuteResponse, error) { req, err := client.executeCreateRequest(ctx, nameAvailabilityRequest, options) if err != nil { return CheckNameAvailabilityClientExecuteResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return CheckNameAvailabilityClientExecuteResponse{}, err } @@ -83,12 +73,12 @@ func (client *CheckNameAvailabilityClient) executeCreateRequest(ctx context.Cont 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.MethodPost, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, nameAvailabilityRequest) 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 d1aa0e96b8d3..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/checknameavailability_client_example_test.go +++ /dev/null @@ -1,40 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewCheckNameAvailabilityClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/client_factory.go b/sdk/resourcemanager/devcenter/armdevcenter/client_factory.go new file mode 100644 index 000000000000..1471c3b7dde0 --- /dev/null +++ b/sdk/resourcemanager/devcenter/armdevcenter/client_factory.go @@ -0,0 +1,129 @@ +//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 + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + credential azcore.TokenCredential + options *arm.ClientOptions +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - 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 NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + _, err := arm.NewClient(moduleName+".ClientFactory", moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, credential: credential, + options: options.Clone(), + }, nil +} + +func (c *ClientFactory) NewDevCentersClient() *DevCentersClient { + subClient, _ := NewDevCentersClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewProjectsClient() *ProjectsClient { + subClient, _ := NewProjectsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAttachedNetworksClient() *AttachedNetworksClient { + subClient, _ := NewAttachedNetworksClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewGalleriesClient() *GalleriesClient { + subClient, _ := NewGalleriesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewImagesClient() *ImagesClient { + subClient, _ := NewImagesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewImageVersionsClient() *ImageVersionsClient { + subClient, _ := NewImageVersionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewCatalogsClient() *CatalogsClient { + subClient, _ := NewCatalogsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewEnvironmentTypesClient() *EnvironmentTypesClient { + subClient, _ := NewEnvironmentTypesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewProjectAllowedEnvironmentTypesClient() *ProjectAllowedEnvironmentTypesClient { + subClient, _ := NewProjectAllowedEnvironmentTypesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewProjectEnvironmentTypesClient() *ProjectEnvironmentTypesClient { + subClient, _ := NewProjectEnvironmentTypesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewDevBoxDefinitionsClient() *DevBoxDefinitionsClient { + subClient, _ := NewDevBoxDefinitionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewOperationStatusesClient() *OperationStatusesClient { + subClient, _ := NewOperationStatusesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewCheckNameAvailabilityClient() *CheckNameAvailabilityClient { + subClient, _ := NewCheckNameAvailabilityClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewSKUsClient() *SKUsClient { + subClient, _ := NewSKUsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewPoolsClient() *PoolsClient { + subClient, _ := NewPoolsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewSchedulesClient() *SchedulesClient { + subClient, _ := NewSchedulesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewNetworkConnectionsClient() *NetworkConnectionsClient { + subClient, _ := NewNetworkConnectionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/constants.go b/sdk/resourcemanager/devcenter/armdevcenter/constants.go index 0f4d728f163c..101432b7070e 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/constants.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/constants.go @@ -11,7 +11,7 @@ package armdevcenter const ( moduleName = "armdevcenter" - moduleVersion = "v0.4.0" + moduleVersion = "v0.5.0" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -100,19 +100,19 @@ func PossibleDomainJoinTypeValues() []DomainJoinType { } } -// EnableStatus - Enable or disable status. Indicates whether the property applied to is either enabled or disabled. -type EnableStatus string +// EnvironmentTypeEnableStatus - Indicates whether the environment type is either enabled or disabled. +type EnvironmentTypeEnableStatus string const ( - EnableStatusDisabled EnableStatus = "Disabled" - EnableStatusEnabled EnableStatus = "Enabled" + EnvironmentTypeEnableStatusDisabled EnvironmentTypeEnableStatus = "Disabled" + EnvironmentTypeEnableStatusEnabled EnvironmentTypeEnableStatus = "Enabled" ) -// PossibleEnableStatusValues returns the possible values for the EnableStatus const type. -func PossibleEnableStatusValues() []EnableStatus { - return []EnableStatus{ - EnableStatusDisabled, - EnableStatusEnabled, +// PossibleEnvironmentTypeEnableStatusValues returns the possible values for the EnvironmentTypeEnableStatus const type. +func PossibleEnvironmentTypeEnableStatusValues() []EnvironmentTypeEnableStatus { + return []EnvironmentTypeEnableStatus{ + EnvironmentTypeEnableStatusDisabled, + EnvironmentTypeEnableStatusEnabled, } } @@ -140,6 +140,28 @@ func PossibleHealthCheckStatusValues() []HealthCheckStatus { } } +// HealthStatus - Health status indicating whether a pool is available to create Dev Boxes. +type HealthStatus string + +const ( + HealthStatusHealthy HealthStatus = "Healthy" + HealthStatusPending HealthStatus = "Pending" + HealthStatusUnhealthy HealthStatus = "Unhealthy" + HealthStatusUnknown HealthStatus = "Unknown" + HealthStatusWarning HealthStatus = "Warning" +) + +// PossibleHealthStatusValues returns the possible values for the HealthStatus const type. +func PossibleHealthStatusValues() []HealthStatus { + return []HealthStatus{ + HealthStatusHealthy, + HealthStatusPending, + HealthStatusUnhealthy, + HealthStatusUnknown, + HealthStatusWarning, + } +} + // HibernateSupport - Indicates whether hibernate is enabled/disabled. type HibernateSupport string @@ -311,6 +333,23 @@ func PossibleSKUTierValues() []SKUTier { } } +// ScheduleEnableStatus - Schedule enable or disable status. Indicates whether the schedule applied to is either enabled or +// disabled. +type ScheduleEnableStatus string + +const ( + ScheduleEnableStatusDisabled ScheduleEnableStatus = "Disabled" + ScheduleEnableStatusEnabled ScheduleEnableStatus = "Enabled" +) + +// PossibleScheduleEnableStatusValues returns the possible values for the ScheduleEnableStatus const type. +func PossibleScheduleEnableStatusValues() []ScheduleEnableStatus { + return []ScheduleEnableStatus{ + ScheduleEnableStatusDisabled, + ScheduleEnableStatusEnabled, + } +} + // ScheduledFrequency - The frequency of task execution. type ScheduledFrequency string @@ -339,16 +378,19 @@ func PossibleScheduledTypeValues() []ScheduledType { } } -// UsageUnit - The unit details. -type UsageUnit string +// StopOnDisconnectEnableStatus - Stop on disconnect enable or disable status. Indicates whether stop on disconnect to is +// either enabled or disabled. +type StopOnDisconnectEnableStatus string const ( - UsageUnitCount UsageUnit = "Count" + StopOnDisconnectEnableStatusDisabled StopOnDisconnectEnableStatus = "Disabled" + StopOnDisconnectEnableStatusEnabled StopOnDisconnectEnableStatus = "Enabled" ) -// PossibleUsageUnitValues returns the possible values for the UsageUnit const type. -func PossibleUsageUnitValues() []UsageUnit { - return []UsageUnit{ - UsageUnitCount, +// PossibleStopOnDisconnectEnableStatusValues returns the possible values for the StopOnDisconnectEnableStatus const type. +func PossibleStopOnDisconnectEnableStatusValues() []StopOnDisconnectEnableStatus { + return []StopOnDisconnectEnableStatus{ + StopOnDisconnectEnableStatusDisabled, + StopOnDisconnectEnableStatusEnabled, } } diff --git a/sdk/resourcemanager/devcenter/armdevcenter/devboxdefinitions_client.go b/sdk/resourcemanager/devcenter/armdevcenter/devboxdefinitions_client.go index ffa81312d8e3..f2127e38b16e 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/devboxdefinitions_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/devboxdefinitions_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -27,67 +25,60 @@ import ( // DevBoxDefinitionsClient contains the methods for the DevBoxDefinitions group. // Don't use this type directly, use NewDevBoxDefinitionsClient() instead. type DevBoxDefinitionsClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewDevBoxDefinitionsClient creates a new instance of DevBoxDefinitionsClient 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. +// - 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 NewDevBoxDefinitionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DevBoxDefinitionsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".DevBoxDefinitionsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &DevBoxDefinitionsClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // BeginCreateOrUpdate - Creates or updates a Dev Box definition. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-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. -// body - Represents a Dev Box definition. -// options - DevBoxDefinitionsClientBeginCreateOrUpdateOptions contains the optional parameters for the DevBoxDefinitionsClient.BeginCreateOrUpdate -// method. +// +// Generated from API version 2023-01-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. +// - body - Represents a Dev Box definition. +// - options - DevBoxDefinitionsClientBeginCreateOrUpdateOptions contains the optional parameters for the DevBoxDefinitionsClient.BeginCreateOrUpdate +// method. func (client *DevBoxDefinitionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, devCenterName string, devBoxDefinitionName string, body DevBoxDefinition, options *DevBoxDefinitionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[DevBoxDefinitionsClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, devCenterName, devBoxDefinitionName, body, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[DevBoxDefinitionsClientCreateOrUpdateResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DevBoxDefinitionsClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[DevBoxDefinitionsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[DevBoxDefinitionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // CreateOrUpdate - Creates or updates a Dev Box definition. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview +// +// Generated from API version 2023-01-01-preview func (client *DevBoxDefinitionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, devCenterName string, devBoxDefinitionName string, body DevBoxDefinition, options *DevBoxDefinitionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, devCenterName, devBoxDefinitionName, body, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -116,12 +107,12 @@ func (client *DevBoxDefinitionsClient) createOrUpdateCreateRequest(ctx context.C return nil, errors.New("parameter devBoxDefinitionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{devBoxDefinitionName}", url.PathEscape(devBoxDefinitionName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -129,35 +120,37 @@ 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 2022-11-11-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. -// options - DevBoxDefinitionsClientBeginDeleteOptions contains the optional parameters for the DevBoxDefinitionsClient.BeginDelete -// method. +// +// Generated from API version 2023-01-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. +// - options - DevBoxDefinitionsClientBeginDeleteOptions contains the optional parameters for the DevBoxDefinitionsClient.BeginDelete +// method. func (client *DevBoxDefinitionsClient) BeginDelete(ctx context.Context, resourceGroupName string, devCenterName string, devBoxDefinitionName string, options *DevBoxDefinitionsClientBeginDeleteOptions) (*runtime.Poller[DevBoxDefinitionsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, devCenterName, devBoxDefinitionName, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[DevBoxDefinitionsClientDeleteResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DevBoxDefinitionsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[DevBoxDefinitionsClientDeleteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[DevBoxDefinitionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Delete - Deletes a Dev Box definition // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview +// +// Generated from API version 2023-01-01-preview func (client *DevBoxDefinitionsClient) deleteOperation(ctx context.Context, resourceGroupName string, devCenterName string, devBoxDefinitionName string, options *DevBoxDefinitionsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, devCenterName, devBoxDefinitionName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -186,12 +179,12 @@ func (client *DevBoxDefinitionsClient) deleteCreateRequest(ctx context.Context, return nil, errors.New("parameter devBoxDefinitionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{devBoxDefinitionName}", url.PathEscape(devBoxDefinitionName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -199,17 +192,18 @@ 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 2022-11-11-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. -// options - DevBoxDefinitionsClientGetOptions contains the optional parameters for the DevBoxDefinitionsClient.Get method. +// +// Generated from API version 2023-01-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. +// - options - DevBoxDefinitionsClientGetOptions contains the optional parameters for the DevBoxDefinitionsClient.Get method. func (client *DevBoxDefinitionsClient) Get(ctx context.Context, resourceGroupName string, devCenterName string, devBoxDefinitionName string, options *DevBoxDefinitionsClientGetOptions) (DevBoxDefinitionsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, devCenterName, devBoxDefinitionName, options) if err != nil { return DevBoxDefinitionsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return DevBoxDefinitionsClientGetResponse{}, err } @@ -238,12 +232,12 @@ func (client *DevBoxDefinitionsClient) getCreateRequest(ctx context.Context, res return nil, errors.New("parameter devBoxDefinitionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{devBoxDefinitionName}", url.PathEscape(devBoxDefinitionName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -260,18 +254,19 @@ 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 2022-11-11-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. -// options - DevBoxDefinitionsClientGetByProjectOptions contains the optional parameters for the DevBoxDefinitionsClient.GetByProject -// method. +// +// Generated from API version 2023-01-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. +// - options - DevBoxDefinitionsClientGetByProjectOptions contains the optional parameters for the DevBoxDefinitionsClient.GetByProject +// method. func (client *DevBoxDefinitionsClient) GetByProject(ctx context.Context, resourceGroupName string, projectName string, devBoxDefinitionName string, options *DevBoxDefinitionsClientGetByProjectOptions) (DevBoxDefinitionsClientGetByProjectResponse, error) { req, err := client.getByProjectCreateRequest(ctx, resourceGroupName, projectName, devBoxDefinitionName, options) if err != nil { return DevBoxDefinitionsClientGetByProjectResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return DevBoxDefinitionsClientGetByProjectResponse{}, err } @@ -300,12 +295,12 @@ func (client *DevBoxDefinitionsClient) getByProjectCreateRequest(ctx context.Con return nil, errors.New("parameter devBoxDefinitionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{devBoxDefinitionName}", url.PathEscape(devBoxDefinitionName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -321,11 +316,12 @@ func (client *DevBoxDefinitionsClient) getByProjectHandleResponse(resp *http.Res } // NewListByDevCenterPager - List Dev Box definitions for a devcenter. -// Generated from API version 2022-11-11-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.ListByDevCenter -// method. +// +// Generated from API version 2023-01-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 +// method. func (client *DevBoxDefinitionsClient) NewListByDevCenterPager(resourceGroupName string, devCenterName string, options *DevBoxDefinitionsClientListByDevCenterOptions) *runtime.Pager[DevBoxDefinitionsClientListByDevCenterResponse] { return runtime.NewPager(runtime.PagingHandler[DevBoxDefinitionsClientListByDevCenterResponse]{ More: func(page DevBoxDefinitionsClientListByDevCenterResponse) bool { @@ -342,7 +338,7 @@ func (client *DevBoxDefinitionsClient) NewListByDevCenterPager(resourceGroupName if err != nil { return DevBoxDefinitionsClientListByDevCenterResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return DevBoxDefinitionsClientListByDevCenterResponse{}, err } @@ -369,12 +365,12 @@ func (client *DevBoxDefinitionsClient) listByDevCenterCreateRequest(ctx context. 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.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } @@ -393,11 +389,12 @@ func (client *DevBoxDefinitionsClient) listByDevCenterHandleResponse(resp *http. } // NewListByProjectPager - List Dev Box definitions configured for a project. -// Generated from API version 2022-11-11-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.ListByProject -// method. +// +// Generated from API version 2023-01-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 +// method. func (client *DevBoxDefinitionsClient) NewListByProjectPager(resourceGroupName string, projectName string, options *DevBoxDefinitionsClientListByProjectOptions) *runtime.Pager[DevBoxDefinitionsClientListByProjectResponse] { return runtime.NewPager(runtime.PagingHandler[DevBoxDefinitionsClientListByProjectResponse]{ More: func(page DevBoxDefinitionsClientListByProjectResponse) bool { @@ -414,7 +411,7 @@ func (client *DevBoxDefinitionsClient) NewListByProjectPager(resourceGroupName s if err != nil { return DevBoxDefinitionsClientListByProjectResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return DevBoxDefinitionsClientListByProjectResponse{}, err } @@ -441,12 +438,12 @@ func (client *DevBoxDefinitionsClient) listByProjectCreateRequest(ctx context.Co 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.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } @@ -466,36 +463,38 @@ 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 2022-11-11-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. -// body - Represents a Dev Box definition. -// options - DevBoxDefinitionsClientBeginUpdateOptions contains the optional parameters for the DevBoxDefinitionsClient.BeginUpdate -// method. +// +// Generated from API version 2023-01-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. +// - body - Represents a Dev Box definition. +// - options - DevBoxDefinitionsClientBeginUpdateOptions contains the optional parameters for the DevBoxDefinitionsClient.BeginUpdate +// method. func (client *DevBoxDefinitionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, devCenterName string, devBoxDefinitionName string, body DevBoxDefinitionUpdate, options *DevBoxDefinitionsClientBeginUpdateOptions) (*runtime.Poller[DevBoxDefinitionsClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.update(ctx, resourceGroupName, devCenterName, devBoxDefinitionName, body, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[DevBoxDefinitionsClientUpdateResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DevBoxDefinitionsClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[DevBoxDefinitionsClientUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[DevBoxDefinitionsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Update - Partially updates a Dev Box definition. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview +// +// Generated from API version 2023-01-01-preview func (client *DevBoxDefinitionsClient) update(ctx context.Context, resourceGroupName string, devCenterName string, devBoxDefinitionName string, body DevBoxDefinitionUpdate, options *DevBoxDefinitionsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, devCenterName, devBoxDefinitionName, body, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -524,12 +523,12 @@ func (client *DevBoxDefinitionsClient) updateCreateRequest(ctx context.Context, return nil, errors.New("parameter devBoxDefinitionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{devBoxDefinitionName}", url.PathEscape(devBoxDefinitionName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) 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 893d5664a0f6..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/devboxdefinitions_client_example_test.go +++ /dev/null @@ -1,189 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewDevBoxDefinitionsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByDevCenterPager("rg1", "Contoso", &armdevcenter.DevBoxDefinitionsClientListByDevCenterOptions{Top: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewDevBoxDefinitionsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "rg1", "Contoso", "WebDevBox", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewDevBoxDefinitionsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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"), - }, - OSStorageType: to.Ptr("SSD_1024"), - 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewDevBoxDefinitionsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewDevBoxDefinitionsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewDevBoxDefinitionsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByProjectPager("rg1", "ContosoProject", &armdevcenter.DevBoxDefinitionsClientListByProjectOptions{Top: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewDevBoxDefinitionsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetByProject(ctx, "rg1", "ContosoProject", "WebDevBox", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/devcenters_client.go b/sdk/resourcemanager/devcenter/armdevcenter/devcenters_client.go index 7ba2ca640a9c..c1f38aa493a9 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/devcenters_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/devcenters_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -27,66 +25,59 @@ import ( // DevCentersClient contains the methods for the DevCenters group. // Don't use this type directly, use NewDevCentersClient() instead. type DevCentersClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewDevCentersClient creates a new instance of DevCentersClient 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. +// - 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 NewDevCentersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DevCentersClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".DevCentersClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &DevCentersClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // BeginCreateOrUpdate - Creates or updates a devcenter resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// devCenterName - The name of the devcenter. -// body - Represents a devcenter. -// options - DevCentersClientBeginCreateOrUpdateOptions contains the optional parameters for the DevCentersClient.BeginCreateOrUpdate -// method. +// +// Generated from API version 2023-01-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - devCenterName - The name of the devcenter. +// - body - Represents a devcenter. +// - options - DevCentersClientBeginCreateOrUpdateOptions contains the optional parameters for the DevCentersClient.BeginCreateOrUpdate +// method. func (client *DevCentersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, devCenterName string, body DevCenter, options *DevCentersClientBeginCreateOrUpdateOptions) (*runtime.Poller[DevCentersClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, devCenterName, body, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[DevCentersClientCreateOrUpdateResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DevCentersClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[DevCentersClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[DevCentersClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // CreateOrUpdate - Creates or updates a devcenter resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview +// +// Generated from API version 2023-01-01-preview func (client *DevCentersClient) createOrUpdate(ctx context.Context, resourceGroupName string, devCenterName string, body DevCenter, options *DevCentersClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, devCenterName, body, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -111,12 +102,12 @@ func (client *DevCentersClient) createOrUpdateCreateRequest(ctx context.Context, return nil, errors.New("parameter devCenterName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{devCenterName}", url.PathEscape(devCenterName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -124,33 +115,35 @@ 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 2022-11-11-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. +// +// Generated from API version 2023-01-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. func (client *DevCentersClient) BeginDelete(ctx context.Context, resourceGroupName string, devCenterName string, options *DevCentersClientBeginDeleteOptions) (*runtime.Poller[DevCentersClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, devCenterName, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[DevCentersClientDeleteResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DevCentersClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[DevCentersClientDeleteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[DevCentersClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Delete - Deletes a devcenter // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview +// +// Generated from API version 2023-01-01-preview func (client *DevCentersClient) deleteOperation(ctx context.Context, resourceGroupName string, devCenterName string, options *DevCentersClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, devCenterName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -175,12 +168,12 @@ func (client *DevCentersClient) deleteCreateRequest(ctx context.Context, resourc return nil, errors.New("parameter devCenterName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{devCenterName}", url.PathEscape(devCenterName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -188,16 +181,17 @@ 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 2022-11-11-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. +// +// Generated from API version 2023-01-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. func (client *DevCentersClient) Get(ctx context.Context, resourceGroupName string, devCenterName string, options *DevCentersClientGetOptions) (DevCentersClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, devCenterName, options) if err != nil { return DevCentersClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return DevCentersClientGetResponse{}, err } @@ -222,12 +216,12 @@ func (client *DevCentersClient) getCreateRequest(ctx context.Context, resourceGr 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.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -243,10 +237,11 @@ func (client *DevCentersClient) getHandleResponse(resp *http.Response) (DevCente } // NewListByResourceGroupPager - Lists all devcenters in a resource group. -// Generated from API version 2022-11-11-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - DevCentersClientListByResourceGroupOptions contains the optional parameters for the DevCentersClient.ListByResourceGroup -// method. +// +// Generated from API version 2023-01-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. func (client *DevCentersClient) NewListByResourceGroupPager(resourceGroupName string, options *DevCentersClientListByResourceGroupOptions) *runtime.Pager[DevCentersClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[DevCentersClientListByResourceGroupResponse]{ More: func(page DevCentersClientListByResourceGroupResponse) bool { @@ -263,7 +258,7 @@ func (client *DevCentersClient) NewListByResourceGroupPager(resourceGroupName st if err != nil { return DevCentersClientListByResourceGroupResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return DevCentersClientListByResourceGroupResponse{}, err } @@ -286,12 +281,12 @@ func (client *DevCentersClient) listByResourceGroupCreateRequest(ctx context.Con 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.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } @@ -310,9 +305,10 @@ func (client *DevCentersClient) listByResourceGroupHandleResponse(resp *http.Res } // NewListBySubscriptionPager - Lists all devcenters in a subscription. -// Generated from API version 2022-11-11-preview -// options - DevCentersClientListBySubscriptionOptions contains the optional parameters for the DevCentersClient.ListBySubscription -// method. +// +// Generated from API version 2023-01-01-preview +// - options - DevCentersClientListBySubscriptionOptions contains the optional parameters for the DevCentersClient.NewListBySubscriptionPager +// method. func (client *DevCentersClient) NewListBySubscriptionPager(options *DevCentersClientListBySubscriptionOptions) *runtime.Pager[DevCentersClientListBySubscriptionResponse] { return runtime.NewPager(runtime.PagingHandler[DevCentersClientListBySubscriptionResponse]{ More: func(page DevCentersClientListBySubscriptionResponse) bool { @@ -329,7 +325,7 @@ func (client *DevCentersClient) NewListBySubscriptionPager(options *DevCentersCl if err != nil { return DevCentersClientListBySubscriptionResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return DevCentersClientListBySubscriptionResponse{}, err } @@ -348,12 +344,12 @@ func (client *DevCentersClient) listBySubscriptionCreateRequest(ctx context.Cont 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.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } @@ -373,34 +369,36 @@ 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 2022-11-11-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// devCenterName - The name of the devcenter. -// body - Updatable devcenter properties. -// options - DevCentersClientBeginUpdateOptions contains the optional parameters for the DevCentersClient.BeginUpdate method. +// +// Generated from API version 2023-01-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - devCenterName - The name of the devcenter. +// - body - Updatable devcenter properties. +// - options - DevCentersClientBeginUpdateOptions contains the optional parameters for the DevCentersClient.BeginUpdate method. func (client *DevCentersClient) BeginUpdate(ctx context.Context, resourceGroupName string, devCenterName string, body Update, options *DevCentersClientBeginUpdateOptions) (*runtime.Poller[DevCentersClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.update(ctx, resourceGroupName, devCenterName, body, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[DevCentersClientUpdateResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DevCentersClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[DevCentersClientUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[DevCentersClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Update - Partially updates a devcenter. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview +// +// Generated from API version 2023-01-01-preview func (client *DevCentersClient) update(ctx context.Context, resourceGroupName string, devCenterName string, body Update, options *DevCentersClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, devCenterName, body, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -425,12 +423,12 @@ func (client *DevCentersClient) updateCreateRequest(ctx context.Context, resourc return nil, errors.New("parameter devCenterName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{devCenterName}", url.PathEscape(devCenterName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) 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 3d5e21c58258..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/devcenters_client_example_test.go +++ /dev/null @@ -1,197 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewDevCentersClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(&armdevcenter.DevCentersClientListBySubscriptionOptions{Top: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewDevCentersClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("rg1", &armdevcenter.DevCentersClientListByResourceGroupOptions{Top: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewDevCentersClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "rg1", "Contoso", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewDevCentersClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "rg1", "Contoso", armdevcenter.DevCenter{ - Location: to.Ptr("centralus"), - Tags: map[string]*string{ - "CostCode": to.Ptr("12345"), - }, - Properties: &armdevcenter.Properties{}, - }, 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewDevCentersClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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{}, - }, 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewDevCentersClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewDevCentersClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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/environmenttypes_client.go b/sdk/resourcemanager/devcenter/armdevcenter/environmenttypes_client.go index 02f4d438cc73..95cfac94d649 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/environmenttypes_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/environmenttypes_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -27,50 +25,42 @@ import ( // EnvironmentTypesClient contains the methods for the EnvironmentTypes group. // Don't use this type directly, use NewEnvironmentTypesClient() instead. type EnvironmentTypesClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewEnvironmentTypesClient creates a new instance of EnvironmentTypesClient 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. +// - 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 NewEnvironmentTypesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*EnvironmentTypesClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".EnvironmentTypesClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &EnvironmentTypesClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // CreateOrUpdate - Creates or updates an environment type. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-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. -// body - Represents an Environment Type. -// options - EnvironmentTypesClientCreateOrUpdateOptions contains the optional parameters for the EnvironmentTypesClient.CreateOrUpdate -// method. +// +// Generated from API version 2023-01-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. +// - body - Represents an Environment Type. +// - options - EnvironmentTypesClientCreateOrUpdateOptions contains the optional parameters for the EnvironmentTypesClient.CreateOrUpdate +// method. func (client *EnvironmentTypesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, devCenterName string, environmentTypeName string, body EnvironmentType, options *EnvironmentTypesClientCreateOrUpdateOptions) (EnvironmentTypesClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, devCenterName, environmentTypeName, body, options) if err != nil { return EnvironmentTypesClientCreateOrUpdateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return EnvironmentTypesClientCreateOrUpdateResponse{}, err } @@ -99,12 +89,12 @@ func (client *EnvironmentTypesClient) createOrUpdateCreateRequest(ctx context.Co return nil, errors.New("parameter environmentTypeName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{environmentTypeName}", url.PathEscape(environmentTypeName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -121,17 +111,18 @@ 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 2022-11-11-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. -// options - EnvironmentTypesClientDeleteOptions contains the optional parameters for the EnvironmentTypesClient.Delete method. +// +// Generated from API version 2023-01-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. +// - options - EnvironmentTypesClientDeleteOptions contains the optional parameters for the EnvironmentTypesClient.Delete method. func (client *EnvironmentTypesClient) Delete(ctx context.Context, resourceGroupName string, devCenterName string, environmentTypeName string, options *EnvironmentTypesClientDeleteOptions) (EnvironmentTypesClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, devCenterName, environmentTypeName, options) if err != nil { return EnvironmentTypesClientDeleteResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return EnvironmentTypesClientDeleteResponse{}, err } @@ -160,12 +151,12 @@ func (client *EnvironmentTypesClient) deleteCreateRequest(ctx context.Context, r return nil, errors.New("parameter environmentTypeName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{environmentTypeName}", url.PathEscape(environmentTypeName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -173,17 +164,18 @@ 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 2022-11-11-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. -// options - EnvironmentTypesClientGetOptions contains the optional parameters for the EnvironmentTypesClient.Get method. +// +// Generated from API version 2023-01-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. +// - options - EnvironmentTypesClientGetOptions contains the optional parameters for the EnvironmentTypesClient.Get method. func (client *EnvironmentTypesClient) Get(ctx context.Context, resourceGroupName string, devCenterName string, environmentTypeName string, options *EnvironmentTypesClientGetOptions) (EnvironmentTypesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, devCenterName, environmentTypeName, options) if err != nil { return EnvironmentTypesClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return EnvironmentTypesClientGetResponse{}, err } @@ -212,12 +204,12 @@ func (client *EnvironmentTypesClient) getCreateRequest(ctx context.Context, reso return nil, errors.New("parameter environmentTypeName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{environmentTypeName}", url.PathEscape(environmentTypeName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -233,11 +225,12 @@ func (client *EnvironmentTypesClient) getHandleResponse(resp *http.Response) (En } // NewListByDevCenterPager - Lists environment types for the devcenter. -// Generated from API version 2022-11-11-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.ListByDevCenter -// method. +// +// Generated from API version 2023-01-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 +// method. func (client *EnvironmentTypesClient) NewListByDevCenterPager(resourceGroupName string, devCenterName string, options *EnvironmentTypesClientListByDevCenterOptions) *runtime.Pager[EnvironmentTypesClientListByDevCenterResponse] { return runtime.NewPager(runtime.PagingHandler[EnvironmentTypesClientListByDevCenterResponse]{ More: func(page EnvironmentTypesClientListByDevCenterResponse) bool { @@ -254,7 +247,7 @@ func (client *EnvironmentTypesClient) NewListByDevCenterPager(resourceGroupName if err != nil { return EnvironmentTypesClientListByDevCenterResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return EnvironmentTypesClientListByDevCenterResponse{}, err } @@ -281,12 +274,12 @@ func (client *EnvironmentTypesClient) listByDevCenterCreateRequest(ctx context.C 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.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } @@ -306,18 +299,19 @@ 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 2022-11-11-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. -// body - Updatable environment type properties. -// options - EnvironmentTypesClientUpdateOptions contains the optional parameters for the EnvironmentTypesClient.Update method. +// +// Generated from API version 2023-01-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. +// - body - Updatable environment type properties. +// - options - EnvironmentTypesClientUpdateOptions contains the optional parameters for the EnvironmentTypesClient.Update method. func (client *EnvironmentTypesClient) Update(ctx context.Context, resourceGroupName string, devCenterName string, environmentTypeName string, body EnvironmentTypeUpdate, options *EnvironmentTypesClientUpdateOptions) (EnvironmentTypesClientUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, devCenterName, environmentTypeName, body, options) if err != nil { return EnvironmentTypesClientUpdateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return EnvironmentTypesClientUpdateResponse{}, err } @@ -346,12 +340,12 @@ func (client *EnvironmentTypesClient) updateCreateRequest(ctx context.Context, r return nil, errors.New("parameter environmentTypeName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{environmentTypeName}", url.PathEscape(environmentTypeName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) 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 6bb2ed9d7956..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/environmenttypes_client_example_test.go +++ /dev/null @@ -1,124 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewEnvironmentTypesClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByDevCenterPager("rg1", "Contoso", &armdevcenter.EnvironmentTypesClientListByDevCenterOptions{Top: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewEnvironmentTypesClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "rg1", "Contoso", "DevTest", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewEnvironmentTypesClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, "rg1", "Contoso", "DevTest", armdevcenter.EnvironmentType{ - Tags: map[string]*string{ - "Owner": to.Ptr("superuser"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewEnvironmentTypesClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "rg1", "Contoso", "DevTest", armdevcenter.EnvironmentTypeUpdate{ - Tags: map[string]*string{ - "Owner": to.Ptr("superuser"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewEnvironmentTypesClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.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/galleries_client.go b/sdk/resourcemanager/devcenter/armdevcenter/galleries_client.go index 3343cd7f1ce7..2b67880e4d33 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/galleries_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/galleries_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -27,67 +25,60 @@ import ( // GalleriesClient contains the methods for the Galleries group. // Don't use this type directly, use NewGalleriesClient() instead. type GalleriesClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewGalleriesClient creates a new instance of GalleriesClient 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. +// - 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 NewGalleriesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GalleriesClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".GalleriesClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &GalleriesClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // BeginCreateOrUpdate - Creates or updates a gallery. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-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. -// body - Represents a gallery. -// options - GalleriesClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleriesClient.BeginCreateOrUpdate -// method. +// +// Generated from API version 2023-01-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. +// - body - Represents a gallery. +// - options - GalleriesClientBeginCreateOrUpdateOptions contains the optional parameters for the GalleriesClient.BeginCreateOrUpdate +// method. func (client *GalleriesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, devCenterName string, galleryName string, body Gallery, options *GalleriesClientBeginCreateOrUpdateOptions) (*runtime.Poller[GalleriesClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, devCenterName, galleryName, body, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[GalleriesClientCreateOrUpdateResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GalleriesClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[GalleriesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[GalleriesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // CreateOrUpdate - Creates or updates a gallery. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview +// +// Generated from API version 2023-01-01-preview func (client *GalleriesClient) createOrUpdate(ctx context.Context, resourceGroupName string, devCenterName string, galleryName string, body Gallery, options *GalleriesClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, devCenterName, galleryName, body, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -116,12 +107,12 @@ func (client *GalleriesClient) createOrUpdateCreateRequest(ctx context.Context, return nil, errors.New("parameter galleryName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -129,34 +120,36 @@ 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 2022-11-11-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. -// options - GalleriesClientBeginDeleteOptions contains the optional parameters for the GalleriesClient.BeginDelete method. +// +// Generated from API version 2023-01-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. +// - options - GalleriesClientBeginDeleteOptions contains the optional parameters for the GalleriesClient.BeginDelete method. func (client *GalleriesClient) BeginDelete(ctx context.Context, resourceGroupName string, devCenterName string, galleryName string, options *GalleriesClientBeginDeleteOptions) (*runtime.Poller[GalleriesClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, devCenterName, galleryName, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[GalleriesClientDeleteResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GalleriesClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[GalleriesClientDeleteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[GalleriesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Delete - Deletes a gallery resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview +// +// Generated from API version 2023-01-01-preview func (client *GalleriesClient) deleteOperation(ctx context.Context, resourceGroupName string, devCenterName string, galleryName string, options *GalleriesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, devCenterName, galleryName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -185,12 +178,12 @@ func (client *GalleriesClient) deleteCreateRequest(ctx context.Context, resource return nil, errors.New("parameter galleryName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -198,17 +191,18 @@ 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 2022-11-11-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. -// options - GalleriesClientGetOptions contains the optional parameters for the GalleriesClient.Get method. +// +// Generated from API version 2023-01-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. +// - options - GalleriesClientGetOptions contains the optional parameters for the GalleriesClient.Get method. func (client *GalleriesClient) Get(ctx context.Context, resourceGroupName string, devCenterName string, galleryName string, options *GalleriesClientGetOptions) (GalleriesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, devCenterName, galleryName, options) if err != nil { return GalleriesClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return GalleriesClientGetResponse{}, err } @@ -237,12 +231,12 @@ func (client *GalleriesClient) getCreateRequest(ctx context.Context, resourceGro return nil, errors.New("parameter galleryName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -258,11 +252,12 @@ func (client *GalleriesClient) getHandleResponse(resp *http.Response) (Galleries } // NewListByDevCenterPager - Lists galleries for a devcenter. -// Generated from API version 2022-11-11-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.ListByDevCenter -// method. +// +// Generated from API version 2023-01-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 +// method. func (client *GalleriesClient) NewListByDevCenterPager(resourceGroupName string, devCenterName string, options *GalleriesClientListByDevCenterOptions) *runtime.Pager[GalleriesClientListByDevCenterResponse] { return runtime.NewPager(runtime.PagingHandler[GalleriesClientListByDevCenterResponse]{ More: func(page GalleriesClientListByDevCenterResponse) bool { @@ -279,7 +274,7 @@ func (client *GalleriesClient) NewListByDevCenterPager(resourceGroupName string, if err != nil { return GalleriesClientListByDevCenterResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return GalleriesClientListByDevCenterResponse{}, err } @@ -306,12 +301,12 @@ func (client *GalleriesClient) listByDevCenterCreateRequest(ctx context.Context, 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.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } 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 8ce43ac5dad0..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/galleries_client_example_test.go +++ /dev/null @@ -1,107 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewGalleriesClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByDevCenterPager("rg1", "Contoso", &armdevcenter.GalleriesClientListByDevCenterOptions{Top: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewGalleriesClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "rg1", "Contoso", "StandardGallery", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewGalleriesClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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) - } - _, 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/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewGalleriesClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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 14e26a07289d..c7897d2c41ce 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/go.mod +++ b/sdk/resourcemanager/devcenter/armdevcenter/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devcenter/armdevcen go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.7.0 // indirect - github.com/golang-jwt/jwt/v4 v4.4.2 // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect - golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect - golang.org/x/text v0.3.7 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.2 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + golang.org/x/net v0.7.0 // indirect + golang.org/x/text v0.7.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/devcenter/armdevcenter/go.sum b/sdk/resourcemanager/devcenter/armdevcenter/go.sum index 8c0539b73123..f54c298864a1 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/go.sum +++ b/sdk/resourcemanager/devcenter/armdevcenter/go.sum @@ -1,30 +1,15 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 h1:t/W5MYAuQy81cvM8VUNfRLzhtKpXhVUAN7Cd7KVbTyc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0/go.mod h1:NBanQUfSWiWn3QEpWDTCU0IjBECKOYvl2R8xdRtMtiM= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.7.0 h1:VgSJlZH5u0k2qxSpqyghcFQKmvYckj46uymKK5XzkBM= -github.com/AzureAD/microsoft-authentication-library-for-go v0.7.0/go.mod h1:BDJ5qMFKx9DugEg3+uQSDCdbYPr5s9vBTrL9P8TpqOU= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.2 h1:+5VZ72z0Qan5Bog5C+ZkgSqUbeVUd9wgtHOrIKuc5b8= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.2/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt/v4 v4.4.2 h1:rcc4lwaZgFMCZ5jxF9ABolDcIHdBytAFgqFPbSJQAYs= -github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/devcenter/armdevcenter/images_client.go b/sdk/resourcemanager/devcenter/armdevcenter/images_client.go index d130d42859cf..661eff23fe99 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/images_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/images_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -27,49 +25,41 @@ import ( // ImagesClient contains the methods for the Images group. // Don't use this type directly, use NewImagesClient() instead. type ImagesClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewImagesClient creates a new instance of ImagesClient 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. +// - 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 NewImagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ImagesClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".ImagesClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ImagesClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // Get - Gets a gallery image. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-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. -// imageName - The name of the image. -// options - ImagesClientGetOptions contains the optional parameters for the ImagesClient.Get method. +// +// Generated from API version 2023-01-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. +// - imageName - The name of the image. +// - options - ImagesClientGetOptions contains the optional parameters for the ImagesClient.Get method. func (client *ImagesClient) Get(ctx context.Context, resourceGroupName string, devCenterName string, galleryName string, imageName string, options *ImagesClientGetOptions) (ImagesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, devCenterName, galleryName, imageName, options) if err != nil { return ImagesClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ImagesClientGetResponse{}, err } @@ -102,12 +92,12 @@ func (client *ImagesClient) getCreateRequest(ctx context.Context, resourceGroupN 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.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -123,10 +113,12 @@ func (client *ImagesClient) getHandleResponse(resp *http.Response) (ImagesClient } // NewListByDevCenterPager - Lists images for a devcenter. -// Generated from API version 2022-11-11-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.ListByDevCenter method. +// +// Generated from API version 2023-01-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 +// method. func (client *ImagesClient) NewListByDevCenterPager(resourceGroupName string, devCenterName string, options *ImagesClientListByDevCenterOptions) *runtime.Pager[ImagesClientListByDevCenterResponse] { return runtime.NewPager(runtime.PagingHandler[ImagesClientListByDevCenterResponse]{ More: func(page ImagesClientListByDevCenterResponse) bool { @@ -143,7 +135,7 @@ func (client *ImagesClient) NewListByDevCenterPager(resourceGroupName string, de if err != nil { return ImagesClientListByDevCenterResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ImagesClientListByDevCenterResponse{}, err } @@ -170,12 +162,12 @@ func (client *ImagesClient) listByDevCenterCreateRequest(ctx context.Context, re 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.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } @@ -194,11 +186,13 @@ func (client *ImagesClient) listByDevCenterHandleResponse(resp *http.Response) ( } // NewListByGalleryPager - Lists images for a gallery. -// Generated from API version 2022-11-11-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. -// options - ImagesClientListByGalleryOptions contains the optional parameters for the ImagesClient.ListByGallery method. +// +// Generated from API version 2023-01-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. +// - options - ImagesClientListByGalleryOptions contains the optional parameters for the ImagesClient.NewListByGalleryPager +// method. func (client *ImagesClient) NewListByGalleryPager(resourceGroupName string, devCenterName string, galleryName string, options *ImagesClientListByGalleryOptions) *runtime.Pager[ImagesClientListByGalleryResponse] { return runtime.NewPager(runtime.PagingHandler[ImagesClientListByGalleryResponse]{ More: func(page ImagesClientListByGalleryResponse) bool { @@ -215,7 +209,7 @@ func (client *ImagesClient) NewListByGalleryPager(resourceGroupName string, devC if err != nil { return ImagesClientListByGalleryResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ImagesClientListByGalleryResponse{}, err } @@ -246,12 +240,12 @@ func (client *ImagesClient) listByGalleryCreateRequest(ctx context.Context, reso return nil, errors.New("parameter galleryName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } 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 6b64c127d1d5..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/images_client_example_test.go +++ /dev/null @@ -1,84 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewImagesClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByDevCenterPager("rg1", "Contoso", &armdevcenter.ImagesClientListByDevCenterOptions{Top: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewImagesClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByGalleryPager("rg1", "Contoso", "DevGallery", &armdevcenter.ImagesClientListByGalleryOptions{Top: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewImagesClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "rg1", "Contoso", "DefaultDevGallery", "ContosoBaseImage", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/imageversions_client.go b/sdk/resourcemanager/devcenter/armdevcenter/imageversions_client.go index 0a279c12862b..6e53969e4ac6 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/imageversions_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/imageversions_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,50 +24,42 @@ import ( // ImageVersionsClient contains the methods for the ImageVersions group. // Don't use this type directly, use NewImageVersionsClient() instead. type ImageVersionsClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewImageVersionsClient creates a new instance of ImageVersionsClient 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. +// - 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 NewImageVersionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ImageVersionsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".ImageVersionsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ImageVersionsClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // Get - Gets an image version. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-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. -// imageName - The name of the image. -// versionName - The version of the image. -// options - ImageVersionsClientGetOptions contains the optional parameters for the ImageVersionsClient.Get method. +// +// Generated from API version 2023-01-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. +// - imageName - The name of the image. +// - versionName - The version of the image. +// - options - ImageVersionsClientGetOptions contains the optional parameters for the ImageVersionsClient.Get method. func (client *ImageVersionsClient) Get(ctx context.Context, resourceGroupName string, devCenterName string, galleryName string, imageName string, versionName string, options *ImageVersionsClientGetOptions) (ImageVersionsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, devCenterName, galleryName, imageName, versionName, options) if err != nil { return ImageVersionsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ImageVersionsClientGetResponse{}, err } @@ -106,12 +96,12 @@ func (client *ImageVersionsClient) getCreateRequest(ctx context.Context, resourc 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.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -127,13 +117,14 @@ func (client *ImageVersionsClient) getHandleResponse(resp *http.Response) (Image } // NewListByImagePager - Lists versions for an image. -// Generated from API version 2022-11-11-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. -// imageName - The name of the image. -// options - ImageVersionsClientListByImageOptions contains the optional parameters for the ImageVersionsClient.ListByImage -// method. +// +// Generated from API version 2023-01-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. +// - imageName - The name of the image. +// - options - ImageVersionsClientListByImageOptions contains the optional parameters for the ImageVersionsClient.NewListByImagePager +// method. func (client *ImageVersionsClient) NewListByImagePager(resourceGroupName string, devCenterName string, galleryName string, imageName string, options *ImageVersionsClientListByImageOptions) *runtime.Pager[ImageVersionsClientListByImageResponse] { return runtime.NewPager(runtime.PagingHandler[ImageVersionsClientListByImageResponse]{ More: func(page ImageVersionsClientListByImageResponse) bool { @@ -150,7 +141,7 @@ func (client *ImageVersionsClient) NewListByImagePager(resourceGroupName string, if err != nil { return ImageVersionsClientListByImageResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ImageVersionsClientListByImageResponse{}, err } @@ -185,12 +176,12 @@ func (client *ImageVersionsClient) listByImageCreateRequest(ctx context.Context, 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.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-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/imageversions_client_example_test.go b/sdk/resourcemanager/devcenter/armdevcenter/imageversions_client_example_test.go deleted file mode 100644 index 474fcb911b46..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/imageversions_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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewImageVersionsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByImagePager("rg1", "Contoso", "DefaultDevGallery", "Win11", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewImageVersionsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "rg1", "Contoso", "DefaultDevGallery", "Win11", "1.0.0", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/models.go b/sdk/resourcemanager/devcenter/armdevcenter/models.go index 7ca2b83ccad8..136324783916 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/models.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/models.go @@ -114,14 +114,14 @@ type AttachedNetworksClientGetByProjectOptions struct { // placeholder for future optional parameters } -// AttachedNetworksClientListByDevCenterOptions contains the optional parameters for the AttachedNetworksClient.ListByDevCenter +// AttachedNetworksClientListByDevCenterOptions contains the optional parameters for the AttachedNetworksClient.NewListByDevCenterPager // method. type AttachedNetworksClientListByDevCenterOptions struct { // The maximum number of resources to return from the operation. Example: '$top=10'. Top *int32 } -// AttachedNetworksClientListByProjectOptions contains the optional parameters for the AttachedNetworksClient.ListByProject +// AttachedNetworksClientListByProjectOptions contains the optional parameters for the AttachedNetworksClient.NewListByProjectPager // method. type AttachedNetworksClientListByProjectOptions struct { // The maximum number of resources to return from the operation. Example: '$top=10'. @@ -230,7 +230,7 @@ type CatalogsClientGetOptions struct { // placeholder for future optional parameters } -// CatalogsClientListByDevCenterOptions contains the optional parameters for the CatalogsClient.ListByDevCenter method. +// CatalogsClientListByDevCenterOptions contains the optional parameters for the CatalogsClient.NewListByDevCenterPager method. type CatalogsClientListByDevCenterOptions struct { // The maximum number of resources to return from the operation. Example: '$top=10'. Top *int32 @@ -385,14 +385,14 @@ type DevBoxDefinitionsClientGetOptions struct { // placeholder for future optional parameters } -// DevBoxDefinitionsClientListByDevCenterOptions contains the optional parameters for the DevBoxDefinitionsClient.ListByDevCenter +// DevBoxDefinitionsClientListByDevCenterOptions contains the optional parameters for the DevBoxDefinitionsClient.NewListByDevCenterPager // method. type DevBoxDefinitionsClientListByDevCenterOptions struct { // The maximum number of resources to return from the operation. Example: '$top=10'. Top *int32 } -// DevBoxDefinitionsClientListByProjectOptions contains the optional parameters for the DevBoxDefinitionsClient.ListByProject +// DevBoxDefinitionsClientListByProjectOptions contains the optional parameters for the DevBoxDefinitionsClient.NewListByProjectPager // method. type DevBoxDefinitionsClientListByProjectOptions struct { // The maximum number of resources to return from the operation. Example: '$top=10'. @@ -450,20 +450,38 @@ type DevCentersClientGetOptions struct { // placeholder for future optional parameters } -// DevCentersClientListByResourceGroupOptions contains the optional parameters for the DevCentersClient.ListByResourceGroup +// DevCentersClientListByResourceGroupOptions contains the optional parameters for the DevCentersClient.NewListByResourceGroupPager // method. type DevCentersClientListByResourceGroupOptions struct { // The maximum number of resources to return from the operation. Example: '$top=10'. Top *int32 } -// DevCentersClientListBySubscriptionOptions contains the optional parameters for the DevCentersClient.ListBySubscription +// DevCentersClientListBySubscriptionOptions contains the optional parameters for the DevCentersClient.NewListBySubscriptionPager // method. type DevCentersClientListBySubscriptionOptions struct { // The maximum number of resources to return from the operation. Example: '$top=10'. Top *int32 } +// 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. + Description *string `json:"description,omitempty" azure:"ro"` + + // READ-ONLY; The domain name of the dependency. Domain names may be fully qualified or may contain a * wildcard. + DomainName *string `json:"domainName,omitempty" azure:"ro"` + + // READ-ONLY; The list of connection details for this endpoint. + EndpointDetails []*EndpointDetail `json:"endpointDetails,omitempty" azure:"ro"` +} + +// EndpointDetail - Details about the connection between the Batch service and the endpoint. +type EndpointDetail struct { + // READ-ONLY; The port an endpoint is connected to. + Port *int32 `json:"port,omitempty" azure:"ro"` +} + // EnvironmentRole - A role that can be assigned to a user. type EnvironmentRole struct { // READ-ONLY; This is a description of the Role Assignment. @@ -532,7 +550,7 @@ type EnvironmentTypesClientGetOptions struct { // placeholder for future optional parameters } -// EnvironmentTypesClientListByDevCenterOptions contains the optional parameters for the EnvironmentTypesClient.ListByDevCenter +// EnvironmentTypesClientListByDevCenterOptions contains the optional parameters for the EnvironmentTypesClient.NewListByDevCenterPager // method. type EnvironmentTypesClientListByDevCenterOptions struct { // The maximum number of resources to return from the operation. Example: '$top=10'. @@ -547,7 +565,7 @@ type EnvironmentTypesClientUpdateOptions struct { // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. - Info interface{} `json:"info,omitempty" azure:"ro"` + Info any `json:"info,omitempty" azure:"ro"` // READ-ONLY; The additional info type. Type *string `json:"type,omitempty" azure:"ro"` @@ -589,7 +607,8 @@ type GalleriesClientGetOptions struct { // placeholder for future optional parameters } -// GalleriesClientListByDevCenterOptions contains the optional parameters for the GalleriesClient.ListByDevCenter method. +// GalleriesClientListByDevCenterOptions contains the optional parameters for the GalleriesClient.NewListByDevCenterPager +// method. type GalleriesClientListByDevCenterOptions struct { // The maximum number of resources to return from the operation. Example: '$top=10'. Top *int32 @@ -709,6 +728,15 @@ type HealthCheckStatusDetailsProperties struct { StartDateTime *time.Time `json:"startDateTime,omitempty" azure:"ro"` } +// HealthStatusDetail - Pool health status detail. +type HealthStatusDetail struct { + // READ-ONLY; An identifier for the issue. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; A message describing the issue, intended to be suitable for display in a user interface + Message *string `json:"message,omitempty" azure:"ro"` +} + // Image - Represents an image. type Image struct { // Image properties. @@ -741,6 +769,10 @@ type ImageProperties struct { // READ-ONLY; The description of the image. Description *string `json:"description,omitempty" azure:"ro"` + // READ-ONLY; Indicates whether this image has hibernate enabled. Not all images are capable of supporting hibernation. To + // find out more see https://aka.ms/devbox/hibernate + HibernateSupport *HibernateSupport `json:"hibernateSupport,omitempty" azure:"ro"` + // READ-ONLY; The name of the image offer. Offer *string `json:"offer,omitempty" azure:"ro"` @@ -762,15 +794,6 @@ type ImageReference struct { // Image ID, or Image version ID. When Image ID is provided, its latest version will be used. ID *string `json:"id,omitempty"` - // The image offer. - Offer *string `json:"offer,omitempty"` - - // The image publisher. - Publisher *string `json:"publisher,omitempty"` - - // The image sku. - SKU *string `json:"sku,omitempty"` - // READ-ONLY; The actual version of the image after use. When id references a gallery image latest version, this will indicate // the actual version in use. ExactVersion *string `json:"exactVersion,omitempty" azure:"ro"` @@ -835,7 +858,8 @@ type ImageVersionsClientGetOptions struct { // placeholder for future optional parameters } -// ImageVersionsClientListByImageOptions contains the optional parameters for the ImageVersionsClient.ListByImage method. +// ImageVersionsClientListByImageOptions contains the optional parameters for the ImageVersionsClient.NewListByImagePager +// method. type ImageVersionsClientListByImageOptions struct { // placeholder for future optional parameters } @@ -845,13 +869,13 @@ type ImagesClientGetOptions struct { // placeholder for future optional parameters } -// ImagesClientListByDevCenterOptions contains the optional parameters for the ImagesClient.ListByDevCenter method. +// ImagesClientListByDevCenterOptions contains the optional parameters for the ImagesClient.NewListByDevCenterPager method. type ImagesClientListByDevCenterOptions struct { // The maximum number of resources to return from the operation. Example: '$top=10'. Top *int32 } -// ImagesClientListByGalleryOptions contains the optional parameters for the ImagesClient.ListByGallery method. +// ImagesClientListByGalleryOptions contains the optional parameters for the ImagesClient.NewListByGalleryPager method. type ImagesClientListByGalleryOptions struct { // The maximum number of resources to return from the operation. Example: '$top=10'. Top *int32 @@ -866,15 +890,6 @@ type ListResult struct { Value []*DevCenter `json:"value,omitempty" azure:"ro"` } -// ListUsagesResult - List of Core Usages. -type ListUsagesResult struct { - // READ-ONLY; The link to get the next page of Usage result. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` - - // READ-ONLY; The array page of Usages. - Value []*Usage `json:"value,omitempty" azure:"ro"` -} - // ManagedServiceIdentity - Managed service identity (system assigned and/or user assigned identities) type ManagedServiceIdentity struct { // REQUIRED; Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). @@ -1000,27 +1015,34 @@ type NetworkConnectionsClientGetOptions struct { // placeholder for future optional parameters } -// NetworkConnectionsClientListByResourceGroupOptions contains the optional parameters for the NetworkConnectionsClient.ListByResourceGroup +// NetworkConnectionsClientListByResourceGroupOptions contains the optional parameters for the NetworkConnectionsClient.NewListByResourceGroupPager // method. type NetworkConnectionsClientListByResourceGroupOptions struct { // The maximum number of resources to return from the operation. Example: '$top=10'. Top *int32 } -// NetworkConnectionsClientListBySubscriptionOptions contains the optional parameters for the NetworkConnectionsClient.ListBySubscription +// NetworkConnectionsClientListBySubscriptionOptions contains the optional parameters for the NetworkConnectionsClient.NewListBySubscriptionPager // method. type NetworkConnectionsClientListBySubscriptionOptions struct { // The maximum number of resources to return from the operation. Example: '$top=10'. Top *int32 } -// NetworkConnectionsClientListHealthDetailsOptions contains the optional parameters for the NetworkConnectionsClient.ListHealthDetails +// NetworkConnectionsClientListHealthDetailsOptions contains the optional parameters for the NetworkConnectionsClient.NewListHealthDetailsPager // method. type NetworkConnectionsClientListHealthDetailsOptions struct { // The maximum number of resources to return from the operation. Example: '$top=10'. Top *int32 } +// NetworkConnectionsClientListOutboundNetworkDependenciesEndpointsOptions contains the optional parameters for the NetworkConnectionsClient.NewListOutboundNetworkDependenciesEndpointsPager +// method. +type NetworkConnectionsClientListOutboundNetworkDependenciesEndpointsOptions struct { + // The maximum number of resources to return from the operation. Example: '$top=10'. + Top *int32 +} + // NetworkProperties - Network properties type NetworkProperties struct { // REQUIRED; AAD Join type. @@ -1129,7 +1151,7 @@ type OperationStatus struct { StartTime *time.Time `json:"startTime,omitempty"` // READ-ONLY; Custom operation properties, populated only for a successful operation. - Properties interface{} `json:"properties,omitempty" azure:"ro"` + Properties any `json:"properties,omitempty" azure:"ro"` // READ-ONLY; The id of the resource. ResourceID *string `json:"resourceId,omitempty" azure:"ro"` @@ -1167,11 +1189,30 @@ type OperationStatusesClientGetOptions struct { // placeholder for future optional parameters } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. type OperationsClientListOptions struct { // placeholder for future optional parameters } +// OutboundEnvironmentEndpoint - A collection of related endpoints from the same service for which the agent requires outbound +// access. +type OutboundEnvironmentEndpoint struct { + // READ-ONLY; The type of service that the agent connects to. + Category *string `json:"category,omitempty" azure:"ro"` + + // READ-ONLY; The endpoints for this service for which the agent requires outbound access. + Endpoints []*EndpointDependency `json:"endpoints,omitempty" azure:"ro"` +} + +// OutboundEnvironmentEndpointCollection - Values returned by the List operation. +type OutboundEnvironmentEndpointCollection struct { + // The continuation token. + NextLink *string `json:"nextLink,omitempty"` + + // READ-ONLY; The collection of outbound network dependency endpoints returned by the listing operation. + Value []*OutboundEnvironmentEndpoint `json:"value,omitempty" azure:"ro"` +} + // Pool - A pool of Virtual Machines. type Pool struct { // REQUIRED; The geo-location where the resource lives @@ -1219,6 +1260,16 @@ type PoolProperties struct { // Name of a Network Connection in parent Project of this Pool NetworkConnectionName *string `json:"networkConnectionName,omitempty"` + // Stop on disconnect configuration settings for Dev Boxes created in this pool. + StopOnDisconnect *StopOnDisconnectConfiguration `json:"stopOnDisconnect,omitempty"` + + // READ-ONLY; Overall health status of the Pool. Indicates whether or not the Pool is available to create Dev Boxes. + HealthStatus *HealthStatus `json:"healthStatus,omitempty" azure:"ro"` + + // READ-ONLY; Details on the Pool health status to help diagnose issues. This is only populated when the pool status indicates + // the pool is in a non-healthy state + HealthStatusDetails []*HealthStatusDetail `json:"healthStatusDetails,omitempty" azure:"ro"` + // READ-ONLY; The provisioning state of the resource. ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } @@ -1248,6 +1299,9 @@ type PoolUpdateProperties struct { // Name of a Network Connection in parent Project of this Pool NetworkConnectionName *string `json:"networkConnectionName,omitempty"` + + // Stop on disconnect configuration settings for Dev Boxes created in this pool. + StopOnDisconnect *StopOnDisconnectConfiguration `json:"stopOnDisconnect,omitempty"` } // PoolsClientBeginCreateOrUpdateOptions contains the optional parameters for the PoolsClient.BeginCreateOrUpdate method. @@ -1262,6 +1316,12 @@ type PoolsClientBeginDeleteOptions struct { ResumeToken string } +// PoolsClientBeginRunHealthChecksOptions contains the optional parameters for the PoolsClient.BeginRunHealthChecks method. +type PoolsClientBeginRunHealthChecksOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // PoolsClientBeginUpdateOptions contains the optional parameters for the PoolsClient.BeginUpdate method. type PoolsClientBeginUpdateOptions struct { // Resumes the LRO from the provided token. @@ -1273,7 +1333,7 @@ type PoolsClientGetOptions struct { // placeholder for future optional parameters } -// PoolsClientListByProjectOptions contains the optional parameters for the PoolsClient.ListByProject method. +// PoolsClientListByProjectOptions contains the optional parameters for the PoolsClient.NewListByProjectPager method. type PoolsClientListByProjectOptions struct { // The maximum number of resources to return from the operation. Example: '$top=10'. Top *int32 @@ -1309,7 +1369,7 @@ type ProjectAllowedEnvironmentTypesClientGetOptions struct { // placeholder for future optional parameters } -// ProjectAllowedEnvironmentTypesClientListOptions contains the optional parameters for the ProjectAllowedEnvironmentTypesClient.List +// ProjectAllowedEnvironmentTypesClientListOptions contains the optional parameters for the ProjectAllowedEnvironmentTypesClient.NewListPager // method. type ProjectAllowedEnvironmentTypesClientListOptions struct { // The maximum number of resources to return from the operation. Example: '$top=10'. @@ -1362,7 +1422,7 @@ type ProjectEnvironmentTypeProperties struct { DeploymentTargetID *string `json:"deploymentTargetId,omitempty"` // Defines whether this Environment Type can be used in this Project. - Status *EnableStatus `json:"status,omitempty"` + Status *EnvironmentTypeEnableStatus `json:"status,omitempty"` // Role Assignments created on environment backing resources. This is a mapping from a user object ID to an object of role // definition IDs. @@ -1396,7 +1456,7 @@ type ProjectEnvironmentTypeUpdateProperties struct { DeploymentTargetID *string `json:"deploymentTargetId,omitempty"` // Defines whether this Environment Type can be used in this Project. - Status *EnableStatus `json:"status,omitempty"` + Status *EnvironmentTypeEnableStatus `json:"status,omitempty"` // Role Assignments created on environment backing resources. This is a mapping from a user object ID to an object of role // definition IDs. @@ -1427,7 +1487,8 @@ type ProjectEnvironmentTypesClientGetOptions struct { // placeholder for future optional parameters } -// ProjectEnvironmentTypesClientListOptions contains the optional parameters for the ProjectEnvironmentTypesClient.List method. +// ProjectEnvironmentTypesClientListOptions contains the optional parameters for the ProjectEnvironmentTypesClient.NewListPager +// method. type ProjectEnvironmentTypesClientListOptions struct { // The maximum number of resources to return from the operation. Example: '$top=10'. Top *int32 @@ -1456,6 +1517,10 @@ type ProjectProperties struct { // Resource Id of an associated DevCenter DevCenterID *string `json:"devCenterId,omitempty"` + // When specified, limits the maximum number of Dev Boxes a single user can create across all pools in the project. This will + // have no effect on existing Dev Boxes when reduced. + MaxDevBoxesPerUser *int32 `json:"maxDevBoxesPerUser,omitempty"` + // READ-ONLY; The URI of the resource. DevCenterURI *string `json:"devCenterUri,omitempty" azure:"ro"` @@ -1482,6 +1547,10 @@ type ProjectUpdateProperties struct { // Resource Id of an associated DevCenter DevCenterID *string `json:"devCenterId,omitempty"` + + // When specified, limits the maximum number of Dev Boxes a single user can create across all pools in the project. This will + // have no effect on existing Dev Boxes when reduced. + MaxDevBoxesPerUser *int32 `json:"maxDevBoxesPerUser,omitempty"` } // ProjectsClientBeginCreateOrUpdateOptions contains the optional parameters for the ProjectsClient.BeginCreateOrUpdate method. @@ -1507,13 +1576,15 @@ type ProjectsClientGetOptions struct { // placeholder for future optional parameters } -// ProjectsClientListByResourceGroupOptions contains the optional parameters for the ProjectsClient.ListByResourceGroup method. +// ProjectsClientListByResourceGroupOptions contains the optional parameters for the ProjectsClient.NewListByResourceGroupPager +// method. type ProjectsClientListByResourceGroupOptions struct { // The maximum number of resources to return from the operation. Example: '$top=10'. Top *int32 } -// ProjectsClientListBySubscriptionOptions contains the optional parameters for the ProjectsClient.ListBySubscription method. +// ProjectsClientListBySubscriptionOptions contains the optional parameters for the ProjectsClient.NewListBySubscriptionPager +// method. type ProjectsClientListBySubscriptionOptions struct { // The maximum number of resources to return from the operation. Example: '$top=10'. Top *int32 @@ -1604,7 +1675,7 @@ type SKUListResult struct { Value []*SKUInfo `json:"value,omitempty" azure:"ro"` } -// SKUsClientListBySubscriptionOptions contains the optional parameters for the SKUsClient.ListBySubscription method. +// 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'. Top *int32 @@ -1643,7 +1714,7 @@ type ScheduleProperties struct { Frequency *ScheduledFrequency `json:"frequency,omitempty"` // Indicates whether or not this scheduled task is enabled. - State *EnableStatus `json:"state,omitempty"` + State *ScheduleEnableStatus `json:"state,omitempty"` // The target time to trigger the action. The format is HH:MM. Time *string `json:"time,omitempty"` @@ -1677,7 +1748,7 @@ type ScheduleUpdateProperties struct { Frequency *ScheduledFrequency `json:"frequency,omitempty"` // Indicates whether or not this scheduled task is enabled. - State *EnableStatus `json:"state,omitempty"` + State *ScheduleEnableStatus `json:"state,omitempty"` // The target time to trigger the action. The format is HH:MM. Time *string `json:"time,omitempty"` @@ -1720,12 +1791,21 @@ type SchedulesClientGetOptions struct { Top *int32 } -// SchedulesClientListByPoolOptions contains the optional parameters for the SchedulesClient.ListByPool method. +// SchedulesClientListByPoolOptions contains the optional parameters for the SchedulesClient.NewListByPoolPager method. type SchedulesClientListByPoolOptions struct { // The maximum number of resources to return from the operation. Example: '$top=10'. Top *int32 } +// StopOnDisconnectConfiguration - Stop on disconnect configuration settings for Dev Boxes created in this pool. +type StopOnDisconnectConfiguration struct { + // The specified time in minutes to wait before stopping a Dev Box once disconnect is detected. + GracePeriodMinutes *int32 `json:"gracePeriodMinutes,omitempty"` + + // Whether the feature to stop the Dev Box on disconnect once the grace period has lapsed is enabled. + Status *StopOnDisconnectEnableStatus `json:"status,omitempty"` +} + // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // The timestamp of resource creation (UTC). @@ -1759,35 +1839,6 @@ type Update struct { Tags map[string]*string `json:"tags,omitempty"` } -// Usage - The core usage details. -type Usage struct { - // The current usage. - CurrentValue *int64 `json:"currentValue,omitempty"` - - // The limit integer. - Limit *int64 `json:"limit,omitempty"` - - // The name. - Name *UsageName `json:"name,omitempty"` - - // The unit details. - Unit *UsageUnit `json:"unit,omitempty"` -} - -// UsageName - The Usage Names. -type UsageName struct { - // The localized name of the resource. - LocalizedValue *string `json:"localizedValue,omitempty"` - - // The name of the resource. - Value *string `json:"value,omitempty"` -} - -// UsagesClientListByLocationOptions contains the optional parameters for the UsagesClient.ListByLocation method. -type UsagesClientListByLocationOptions struct { - // placeholder for future optional parameters -} - // UserAssignedIdentity - User assigned identity properties type UserAssignedIdentity struct { // READ-ONLY; The client ID of the assigned identity. diff --git a/sdk/resourcemanager/devcenter/armdevcenter/models_serde.go b/sdk/resourcemanager/devcenter/armdevcenter/models_serde.go index 7109f06fa029..eaddc7476e3f 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/models_serde.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/models_serde.go @@ -18,7 +18,7 @@ import ( // MarshalJSON implements the json.Marshaller interface for type AllowedEnvironmentType. func (a AllowedEnvironmentType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", a.ID) populate(objectMap, "name", a.Name) populate(objectMap, "properties", a.Properties) @@ -61,7 +61,7 @@ func (a *AllowedEnvironmentType) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AllowedEnvironmentTypeListResult. func (a AllowedEnvironmentTypeListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", a.NextLink) populate(objectMap, "value", a.Value) return json.Marshal(objectMap) @@ -92,7 +92,7 @@ func (a *AllowedEnvironmentTypeListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AllowedEnvironmentTypeProperties. func (a AllowedEnvironmentTypeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "provisioningState", a.ProvisioningState) return json.Marshal(objectMap) } @@ -119,7 +119,7 @@ func (a *AllowedEnvironmentTypeProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AttachedNetworkConnection. func (a AttachedNetworkConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", a.ID) populate(objectMap, "name", a.Name) populate(objectMap, "properties", a.Properties) @@ -162,7 +162,7 @@ func (a *AttachedNetworkConnection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AttachedNetworkConnectionProperties. func (a AttachedNetworkConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "domainJoinType", a.DomainJoinType) populate(objectMap, "healthCheckStatus", a.HealthCheckStatus) populate(objectMap, "networkConnectionId", a.NetworkConnectionID) @@ -205,7 +205,7 @@ func (a *AttachedNetworkConnectionProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AttachedNetworkListResult. func (a AttachedNetworkListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", a.NextLink) populate(objectMap, "value", a.Value) return json.Marshal(objectMap) @@ -236,7 +236,7 @@ func (a *AttachedNetworkListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Capability. func (c Capability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "name", c.Name) populate(objectMap, "value", c.Value) return json.Marshal(objectMap) @@ -267,7 +267,7 @@ func (c *Capability) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Catalog. func (c Catalog) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", c.ID) populate(objectMap, "name", c.Name) populate(objectMap, "properties", c.Properties) @@ -310,7 +310,7 @@ func (c *Catalog) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CatalogListResult. func (c CatalogListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", c.NextLink) populate(objectMap, "value", c.Value) return json.Marshal(objectMap) @@ -341,7 +341,7 @@ func (c *CatalogListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CatalogProperties. func (c CatalogProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "adoGit", c.AdoGit) populate(objectMap, "gitHub", c.GitHub) populateTimeRFC3339(objectMap, "lastSyncTime", c.LastSyncTime) @@ -384,7 +384,7 @@ func (c *CatalogProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CatalogUpdate. func (c CatalogUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", c.Properties) populate(objectMap, "tags", c.Tags) return json.Marshal(objectMap) @@ -415,7 +415,7 @@ func (c *CatalogUpdate) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CatalogUpdateProperties. func (c CatalogUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "adoGit", c.AdoGit) populate(objectMap, "gitHub", c.GitHub) return json.Marshal(objectMap) @@ -446,7 +446,7 @@ func (c *CatalogUpdateProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CheckNameAvailabilityRequest. func (c CheckNameAvailabilityRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "name", c.Name) populate(objectMap, "type", c.Type) return json.Marshal(objectMap) @@ -477,7 +477,7 @@ func (c *CheckNameAvailabilityRequest) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CheckNameAvailabilityResponse. func (c CheckNameAvailabilityResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "message", c.Message) populate(objectMap, "nameAvailable", c.NameAvailable) populate(objectMap, "reason", c.Reason) @@ -512,7 +512,7 @@ func (c *CheckNameAvailabilityResponse) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DevBoxDefinition. func (d DevBoxDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", d.ID) populate(objectMap, "location", d.Location) populate(objectMap, "name", d.Name) @@ -563,7 +563,7 @@ func (d *DevBoxDefinition) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DevBoxDefinitionListResult. func (d DevBoxDefinitionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", d.NextLink) populate(objectMap, "value", d.Value) return json.Marshal(objectMap) @@ -594,7 +594,7 @@ func (d *DevBoxDefinitionListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DevBoxDefinitionProperties. func (d DevBoxDefinitionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "activeImageReference", d.ActiveImageReference) populate(objectMap, "hibernateSupport", d.HibernateSupport) populate(objectMap, "imageReference", d.ImageReference) @@ -649,7 +649,7 @@ func (d *DevBoxDefinitionProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DevBoxDefinitionUpdate. func (d DevBoxDefinitionUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "location", d.Location) populate(objectMap, "properties", d.Properties) populate(objectMap, "tags", d.Tags) @@ -684,7 +684,7 @@ func (d *DevBoxDefinitionUpdate) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DevBoxDefinitionUpdateProperties. func (d DevBoxDefinitionUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "hibernateSupport", d.HibernateSupport) populate(objectMap, "imageReference", d.ImageReference) populate(objectMap, "osStorageType", d.OSStorageType) @@ -723,7 +723,7 @@ func (d *DevBoxDefinitionUpdateProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DevCenter. func (d DevCenter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", d.ID) populate(objectMap, "identity", d.Identity) populate(objectMap, "location", d.Location) @@ -776,9 +776,71 @@ func (d *DevCenter) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type EndpointDependency. +func (e EndpointDependency) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", e.Description) + populate(objectMap, "domainName", e.DomainName) + populate(objectMap, "endpointDetails", e.EndpointDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointDependency. +func (e *EndpointDependency) 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 "description": + err = unpopulate(val, "Description", &e.Description) + delete(rawMsg, key) + case "domainName": + err = unpopulate(val, "DomainName", &e.DomainName) + delete(rawMsg, key) + case "endpointDetails": + err = unpopulate(val, "EndpointDetails", &e.EndpointDetails) + 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 EndpointDetail. +func (e EndpointDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "port", e.Port) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointDetail. +func (e *EndpointDetail) 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 "port": + err = unpopulate(val, "Port", &e.Port) + 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 EnvironmentRole. func (e EnvironmentRole) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "description", e.Description) populate(objectMap, "roleName", e.RoleName) return json.Marshal(objectMap) @@ -809,7 +871,7 @@ func (e *EnvironmentRole) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type EnvironmentType. func (e EnvironmentType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", e.ID) populate(objectMap, "name", e.Name) populate(objectMap, "properties", e.Properties) @@ -856,7 +918,7 @@ func (e *EnvironmentType) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type EnvironmentTypeListResult. func (e EnvironmentTypeListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", e.NextLink) populate(objectMap, "value", e.Value) return json.Marshal(objectMap) @@ -887,7 +949,7 @@ func (e *EnvironmentTypeListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type EnvironmentTypeProperties. func (e EnvironmentTypeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "provisioningState", e.ProvisioningState) return json.Marshal(objectMap) } @@ -914,7 +976,7 @@ func (e *EnvironmentTypeProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type EnvironmentTypeUpdate. func (e EnvironmentTypeUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "tags", e.Tags) return json.Marshal(objectMap) } @@ -941,7 +1003,7 @@ func (e *EnvironmentTypeUpdate) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "info", &e.Info) populate(objectMap, "type", e.Type) return json.Marshal(objectMap) @@ -972,7 +1034,7 @@ func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ErrorDetail. func (e ErrorDetail) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "additionalInfo", e.AdditionalInfo) populate(objectMap, "code", e.Code) populate(objectMap, "details", e.Details) @@ -1015,7 +1077,7 @@ func (e *ErrorDetail) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Gallery. func (g Gallery) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", g.ID) populate(objectMap, "name", g.Name) populate(objectMap, "properties", g.Properties) @@ -1058,7 +1120,7 @@ func (g *Gallery) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type GalleryListResult. func (g GalleryListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", g.NextLink) populate(objectMap, "value", g.Value) return json.Marshal(objectMap) @@ -1089,7 +1151,7 @@ func (g *GalleryListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type GalleryProperties. func (g GalleryProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "galleryResourceId", g.GalleryResourceID) populate(objectMap, "provisioningState", g.ProvisioningState) return json.Marshal(objectMap) @@ -1120,7 +1182,7 @@ func (g *GalleryProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type GitCatalog. func (g GitCatalog) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "branch", g.Branch) populate(objectMap, "path", g.Path) populate(objectMap, "secretIdentifier", g.SecretIdentifier) @@ -1159,7 +1221,7 @@ func (g *GitCatalog) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type HealthCheck. func (h HealthCheck) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "additionalDetails", h.AdditionalDetails) populate(objectMap, "displayName", h.DisplayName) populateTimeRFC3339(objectMap, "endDateTime", h.EndDateTime) @@ -1210,7 +1272,7 @@ func (h *HealthCheck) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type HealthCheckStatusDetails. func (h HealthCheckStatusDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", h.ID) populate(objectMap, "name", h.Name) populate(objectMap, "properties", h.Properties) @@ -1253,7 +1315,7 @@ func (h *HealthCheckStatusDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type HealthCheckStatusDetailsListResult. func (h HealthCheckStatusDetailsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", h.NextLink) populate(objectMap, "value", h.Value) return json.Marshal(objectMap) @@ -1284,7 +1346,7 @@ func (h *HealthCheckStatusDetailsListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type HealthCheckStatusDetailsProperties. func (h HealthCheckStatusDetailsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "endDateTime", h.EndDateTime) populate(objectMap, "healthChecks", h.HealthChecks) populateTimeRFC3339(objectMap, "startDateTime", h.StartDateTime) @@ -1317,9 +1379,40 @@ func (h *HealthCheckStatusDetailsProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type HealthStatusDetail. +func (h HealthStatusDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", h.Code) + populate(objectMap, "message", h.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HealthStatusDetail. +func (h *HealthStatusDetail) 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", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &h.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &h.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Image. func (i Image) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", i.ID) populate(objectMap, "name", i.Name) populate(objectMap, "properties", i.Properties) @@ -1362,7 +1455,7 @@ func (i *Image) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ImageListResult. func (i ImageListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", i.NextLink) populate(objectMap, "value", i.Value) return json.Marshal(objectMap) @@ -1393,8 +1486,9 @@ func (i *ImageListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ImageProperties. func (i ImageProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + 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) @@ -1415,6 +1509,9 @@ func (i *ImageProperties) UnmarshalJSON(data []byte) error { 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) delete(rawMsg, key) @@ -1440,12 +1537,9 @@ func (i *ImageProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ImageReference. func (i ImageReference) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "exactVersion", i.ExactVersion) populate(objectMap, "id", i.ID) - populate(objectMap, "offer", i.Offer) - populate(objectMap, "publisher", i.Publisher) - populate(objectMap, "sku", i.SKU) return json.Marshal(objectMap) } @@ -1464,15 +1558,6 @@ func (i *ImageReference) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &i.ID) delete(rawMsg, key) - case "offer": - err = unpopulate(val, "Offer", &i.Offer) - delete(rawMsg, key) - case "publisher": - err = unpopulate(val, "Publisher", &i.Publisher) - 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) @@ -1483,7 +1568,7 @@ func (i *ImageReference) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ImageValidationErrorDetails. func (i ImageValidationErrorDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "code", i.Code) populate(objectMap, "message", i.Message) return json.Marshal(objectMap) @@ -1514,7 +1599,7 @@ func (i *ImageValidationErrorDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ImageVersion. func (i ImageVersion) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", i.ID) populate(objectMap, "name", i.Name) populate(objectMap, "properties", i.Properties) @@ -1557,7 +1642,7 @@ func (i *ImageVersion) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ImageVersionListResult. func (i ImageVersionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", i.NextLink) populate(objectMap, "value", i.Value) return json.Marshal(objectMap) @@ -1588,7 +1673,7 @@ func (i *ImageVersionListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ImageVersionProperties. func (i ImageVersionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "excludeFromLatest", i.ExcludeFromLatest) populate(objectMap, "name", i.Name) populate(objectMap, "osDiskImageSizeInGb", i.OSDiskImageSizeInGb) @@ -1631,7 +1716,7 @@ func (i *ImageVersionProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ListResult. func (l ListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", l.NextLink) populate(objectMap, "value", l.Value) return json.Marshal(objectMap) @@ -1660,40 +1745,9 @@ func (l *ListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ListUsagesResult. -func (l ListUsagesResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - 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]interface{}) + objectMap := make(map[string]any) populate(objectMap, "principalId", m.PrincipalID) populate(objectMap, "tenantId", m.TenantID) populate(objectMap, "type", m.Type) @@ -1732,7 +1786,7 @@ func (m *ManagedServiceIdentity) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type NetworkConnection. func (n NetworkConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", n.ID) populate(objectMap, "location", n.Location) populate(objectMap, "name", n.Name) @@ -1783,7 +1837,7 @@ func (n *NetworkConnection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type NetworkConnectionListResult. func (n NetworkConnectionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", n.NextLink) populate(objectMap, "value", n.Value) return json.Marshal(objectMap) @@ -1814,7 +1868,7 @@ func (n *NetworkConnectionListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type NetworkConnectionUpdate. func (n NetworkConnectionUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "location", n.Location) populate(objectMap, "properties", n.Properties) populate(objectMap, "tags", n.Tags) @@ -1849,7 +1903,7 @@ func (n *NetworkConnectionUpdate) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type NetworkConnectionUpdateProperties. func (n NetworkConnectionUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "domainName", n.DomainName) populate(objectMap, "domainPassword", n.DomainPassword) populate(objectMap, "domainUsername", n.DomainUsername) @@ -1892,7 +1946,7 @@ func (n *NetworkConnectionUpdateProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type NetworkProperties. func (n NetworkProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "domainJoinType", n.DomainJoinType) populate(objectMap, "domainName", n.DomainName) populate(objectMap, "domainPassword", n.DomainPassword) @@ -1951,7 +2005,7 @@ func (n *NetworkProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Operation. func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "actionType", o.ActionType) populate(objectMap, "display", o.Display) populate(objectMap, "isDataAction", o.IsDataAction) @@ -1994,7 +2048,7 @@ func (o *Operation) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type OperationDisplay. func (o OperationDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "description", o.Description) populate(objectMap, "operation", o.Operation) populate(objectMap, "provider", o.Provider) @@ -2033,7 +2087,7 @@ func (o *OperationDisplay) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type OperationListResult. func (o OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", o.NextLink) populate(objectMap, "value", o.Value) return json.Marshal(objectMap) @@ -2064,7 +2118,7 @@ func (o *OperationListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type OperationStatus. func (o OperationStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "endTime", o.EndTime) populate(objectMap, "error", o.Error) populate(objectMap, "id", o.ID) @@ -2127,7 +2181,7 @@ func (o *OperationStatus) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type OperationStatusResult. func (o OperationStatusResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "endTime", o.EndTime) populate(objectMap, "error", o.Error) populate(objectMap, "id", o.ID) @@ -2180,9 +2234,71 @@ func (o *OperationStatusResult) UnmarshalJSON(data []byte) error { 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 Pool. func (p Pool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "location", p.Location) populate(objectMap, "name", p.Name) @@ -2233,7 +2349,7 @@ func (p *Pool) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PoolListResult. func (p PoolListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", p.NextLink) populate(objectMap, "value", p.Value) return json.Marshal(objectMap) @@ -2264,12 +2380,15 @@ func (p *PoolListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PoolProperties. func (p PoolProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "devBoxDefinitionName", p.DevBoxDefinitionName) + populate(objectMap, "healthStatus", p.HealthStatus) + populate(objectMap, "healthStatusDetails", p.HealthStatusDetails) populate(objectMap, "licenseType", p.LicenseType) populate(objectMap, "localAdministrator", p.LocalAdministrator) populate(objectMap, "networkConnectionName", p.NetworkConnectionName) populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "stopOnDisconnect", p.StopOnDisconnect) return json.Marshal(objectMap) } @@ -2285,6 +2404,12 @@ func (p *PoolProperties) UnmarshalJSON(data []byte) error { case "devBoxDefinitionName": err = unpopulate(val, "DevBoxDefinitionName", &p.DevBoxDefinitionName) delete(rawMsg, key) + case "healthStatus": + err = unpopulate(val, "HealthStatus", &p.HealthStatus) + delete(rawMsg, key) + case "healthStatusDetails": + err = unpopulate(val, "HealthStatusDetails", &p.HealthStatusDetails) + delete(rawMsg, key) case "licenseType": err = unpopulate(val, "LicenseType", &p.LicenseType) delete(rawMsg, key) @@ -2297,6 +2422,9 @@ func (p *PoolProperties) UnmarshalJSON(data []byte) error { case "provisioningState": err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) delete(rawMsg, key) + case "stopOnDisconnect": + err = unpopulate(val, "StopOnDisconnect", &p.StopOnDisconnect) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -2307,7 +2435,7 @@ func (p *PoolProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PoolUpdate. func (p PoolUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "location", p.Location) populate(objectMap, "properties", p.Properties) populate(objectMap, "tags", p.Tags) @@ -2342,11 +2470,12 @@ 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]interface{}) + objectMap := make(map[string]any) populate(objectMap, "devBoxDefinitionName", p.DevBoxDefinitionName) populate(objectMap, "licenseType", p.LicenseType) populate(objectMap, "localAdministrator", p.LocalAdministrator) populate(objectMap, "networkConnectionName", p.NetworkConnectionName) + populate(objectMap, "stopOnDisconnect", p.StopOnDisconnect) return json.Marshal(objectMap) } @@ -2371,6 +2500,9 @@ func (p *PoolUpdateProperties) UnmarshalJSON(data []byte) error { case "networkConnectionName": err = unpopulate(val, "NetworkConnectionName", &p.NetworkConnectionName) delete(rawMsg, key) + case "stopOnDisconnect": + err = unpopulate(val, "StopOnDisconnect", &p.StopOnDisconnect) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -2381,7 +2513,7 @@ func (p *PoolUpdateProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Project. func (p Project) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "location", p.Location) populate(objectMap, "name", p.Name) @@ -2432,7 +2564,7 @@ func (p *Project) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ProjectEnvironmentType. func (p ProjectEnvironmentType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "identity", p.Identity) populate(objectMap, "location", p.Location) @@ -2487,7 +2619,7 @@ func (p *ProjectEnvironmentType) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ProjectEnvironmentTypeListResult. func (p ProjectEnvironmentTypeListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", p.NextLink) populate(objectMap, "value", p.Value) return json.Marshal(objectMap) @@ -2518,7 +2650,7 @@ func (p *ProjectEnvironmentTypeListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ProjectEnvironmentTypeProperties. func (p ProjectEnvironmentTypeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "creatorRoleAssignment", p.CreatorRoleAssignment) populate(objectMap, "deploymentTargetId", p.DeploymentTargetID) populate(objectMap, "provisioningState", p.ProvisioningState) @@ -2561,7 +2693,7 @@ func (p *ProjectEnvironmentTypeProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ProjectEnvironmentTypeUpdate. func (p ProjectEnvironmentTypeUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "identity", p.Identity) populate(objectMap, "properties", p.Properties) populate(objectMap, "tags", p.Tags) @@ -2596,7 +2728,7 @@ func (p *ProjectEnvironmentTypeUpdate) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ProjectEnvironmentTypeUpdateProperties. func (p ProjectEnvironmentTypeUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "creatorRoleAssignment", p.CreatorRoleAssignment) populate(objectMap, "deploymentTargetId", p.DeploymentTargetID) populate(objectMap, "status", p.Status) @@ -2635,7 +2767,7 @@ func (p *ProjectEnvironmentTypeUpdateProperties) UnmarshalJSON(data []byte) erro // MarshalJSON implements the json.Marshaller interface for type ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment. func (p ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "roles", p.Roles) return json.Marshal(objectMap) } @@ -2662,7 +2794,7 @@ func (p *ProjectEnvironmentTypeUpdatePropertiesCreatorRoleAssignment) UnmarshalJ // MarshalJSON implements the json.Marshaller interface for type ProjectListResult. func (p ProjectListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", p.NextLink) populate(objectMap, "value", p.Value) return json.Marshal(objectMap) @@ -2693,10 +2825,11 @@ func (p *ProjectListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ProjectProperties. func (p ProjectProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "description", p.Description) populate(objectMap, "devCenterId", p.DevCenterID) populate(objectMap, "devCenterUri", p.DevCenterURI) + populate(objectMap, "maxDevBoxesPerUser", p.MaxDevBoxesPerUser) populate(objectMap, "provisioningState", p.ProvisioningState) return json.Marshal(objectMap) } @@ -2719,6 +2852,9 @@ func (p *ProjectProperties) UnmarshalJSON(data []byte) error { case "devCenterUri": err = unpopulate(val, "DevCenterURI", &p.DevCenterURI) delete(rawMsg, key) + case "maxDevBoxesPerUser": + err = unpopulate(val, "MaxDevBoxesPerUser", &p.MaxDevBoxesPerUser) + delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) delete(rawMsg, key) @@ -2732,7 +2868,7 @@ func (p *ProjectProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ProjectUpdate. func (p ProjectUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "location", p.Location) populate(objectMap, "properties", p.Properties) populate(objectMap, "tags", p.Tags) @@ -2767,9 +2903,10 @@ func (p *ProjectUpdate) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ProjectUpdateProperties. func (p ProjectUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "description", p.Description) populate(objectMap, "devCenterId", p.DevCenterID) + populate(objectMap, "maxDevBoxesPerUser", p.MaxDevBoxesPerUser) return json.Marshal(objectMap) } @@ -2788,6 +2925,9 @@ func (p *ProjectUpdateProperties) UnmarshalJSON(data []byte) error { case "devCenterId": err = unpopulate(val, "DevCenterID", &p.DevCenterID) delete(rawMsg, key) + case "maxDevBoxesPerUser": + err = unpopulate(val, "MaxDevBoxesPerUser", &p.MaxDevBoxesPerUser) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -2798,7 +2938,7 @@ 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]interface{}) + objectMap := make(map[string]any) populate(objectMap, "devCenterUri", p.DevCenterURI) populate(objectMap, "provisioningState", p.ProvisioningState) return json.Marshal(objectMap) @@ -2829,7 +2969,7 @@ func (p *Properties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RecommendedMachineConfiguration. func (r RecommendedMachineConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "memory", r.Memory) populate(objectMap, "vCPUs", r.VCPUs) return json.Marshal(objectMap) @@ -2860,7 +3000,7 @@ func (r *RecommendedMachineConfiguration) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResourceRange. func (r ResourceRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "max", r.Max) populate(objectMap, "min", r.Min) return json.Marshal(objectMap) @@ -2891,7 +3031,7 @@ func (r *ResourceRange) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SKU. func (s SKU) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "capacity", s.Capacity) populate(objectMap, "family", s.Family) populate(objectMap, "name", s.Name) @@ -2934,7 +3074,7 @@ func (s *SKU) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SKUInfo. func (s SKUInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "capabilities", s.Capabilities) populate(objectMap, "capacity", s.Capacity) populate(objectMap, "family", s.Family) @@ -2989,7 +3129,7 @@ func (s *SKUInfo) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SKUListResult. func (s SKUListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) @@ -3020,7 +3160,7 @@ func (s *SKUListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Schedule. func (s Schedule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", s.ID) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) @@ -3063,7 +3203,7 @@ func (s *Schedule) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ScheduleListResult. func (s ScheduleListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) @@ -3094,7 +3234,7 @@ func (s *ScheduleListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ScheduleProperties. func (s ScheduleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "frequency", s.Frequency) populate(objectMap, "provisioningState", s.ProvisioningState) populate(objectMap, "state", s.State) @@ -3141,7 +3281,7 @@ func (s *ScheduleProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ScheduleUpdate. func (s ScheduleUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "location", s.Location) populate(objectMap, "properties", s.Properties) populate(objectMap, "tags", s.Tags) @@ -3176,7 +3316,7 @@ func (s *ScheduleUpdate) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ScheduleUpdateProperties. func (s ScheduleUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "frequency", s.Frequency) populate(objectMap, "state", s.State) populate(objectMap, "time", s.Time) @@ -3217,9 +3357,40 @@ func (s *ScheduleUpdateProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type StopOnDisconnectConfiguration. +func (s StopOnDisconnectConfiguration) 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 StopOnDisconnectConfiguration. +func (s *StopOnDisconnectConfiguration) 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 SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) @@ -3266,7 +3437,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Update. func (u Update) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "identity", u.Identity) populate(objectMap, "location", u.Location) populate(objectMap, "tags", u.Tags) @@ -3299,79 +3470,9 @@ func (u *Update) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Usage. -func (u Usage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "currentValue", u.CurrentValue) - populate(objectMap, "limit", u.Limit) - populate(objectMap, "name", u.Name) - populate(objectMap, "unit", u.Unit) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Usage. -func (u *Usage) 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", u, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "currentValue": - err = unpopulate(val, "CurrentValue", &u.CurrentValue) - delete(rawMsg, key) - case "limit": - err = unpopulate(val, "Limit", &u.Limit) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &u.Name) - delete(rawMsg, key) - case "unit": - err = unpopulate(val, "Unit", &u.Unit) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type UsageName. -func (u UsageName) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "localizedValue", u.LocalizedValue) - populate(objectMap, "value", u.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type UsageName. -func (u *UsageName) 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", u, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "localizedValue": - err = unpopulate(val, "LocalizedValue", &u.LocalizedValue) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &u.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentity. func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "clientId", u.ClientID) populate(objectMap, "principalId", u.PrincipalID) return json.Marshal(objectMap) @@ -3402,7 +3503,7 @@ func (u *UserAssignedIdentity) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type UserRoleAssignmentValue. func (u UserRoleAssignmentValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "roles", u.Roles) return json.Marshal(objectMap) } @@ -3427,7 +3528,7 @@ func (u *UserRoleAssignmentValue) UnmarshalJSON(data []byte) error { return nil } -func populate(m map[string]interface{}, k string, v interface{}) { +func populate(m map[string]any, k string, v any) { if v == nil { return } else if azcore.IsNullValue(v) { @@ -3437,7 +3538,7 @@ func populate(m map[string]interface{}, k string, v interface{}) { } } -func unpopulate(data json.RawMessage, fn string, v interface{}) error { +func unpopulate(data json.RawMessage, fn string, v any) error { if data == nil { return nil } diff --git a/sdk/resourcemanager/devcenter/armdevcenter/networkconnections_client.go b/sdk/resourcemanager/devcenter/armdevcenter/networkconnections_client.go index 534a11912223..7e45d31cd4fc 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/networkconnections_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/networkconnections_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -27,66 +25,59 @@ import ( // NetworkConnectionsClient contains the methods for the NetworkConnections group. // Don't use this type directly, use NewNetworkConnectionsClient() instead. type NetworkConnectionsClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewNetworkConnectionsClient creates a new instance of NetworkConnectionsClient 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. +// - 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 NewNetworkConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*NetworkConnectionsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".NetworkConnectionsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &NetworkConnectionsClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // BeginCreateOrUpdate - Creates or updates a Network Connections resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-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 -// options - NetworkConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the NetworkConnectionsClient.BeginCreateOrUpdate -// method. +// +// Generated from API version 2023-01-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 +// - options - NetworkConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the NetworkConnectionsClient.BeginCreateOrUpdate +// method. func (client *NetworkConnectionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, networkConnectionName string, body NetworkConnection, options *NetworkConnectionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[NetworkConnectionsClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, networkConnectionName, body, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[NetworkConnectionsClientCreateOrUpdateResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NetworkConnectionsClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[NetworkConnectionsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[NetworkConnectionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // CreateOrUpdate - Creates or updates a Network Connections resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview +// +// Generated from API version 2023-01-01-preview func (client *NetworkConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, networkConnectionName string, body NetworkConnection, options *NetworkConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, networkConnectionName, body, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -111,12 +102,12 @@ func (client *NetworkConnectionsClient) createOrUpdateCreateRequest(ctx context. return nil, errors.New("parameter networkConnectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{networkConnectionName}", url.PathEscape(networkConnectionName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -124,34 +115,36 @@ 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 2022-11-11-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 -// method. +// +// Generated from API version 2023-01-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 +// method. func (client *NetworkConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, networkConnectionName string, options *NetworkConnectionsClientBeginDeleteOptions) (*runtime.Poller[NetworkConnectionsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, networkConnectionName, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[NetworkConnectionsClientDeleteResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NetworkConnectionsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[NetworkConnectionsClientDeleteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[NetworkConnectionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Delete - Deletes a Network Connections resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview +// +// Generated from API version 2023-01-01-preview func (client *NetworkConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, networkConnectionName string, options *NetworkConnectionsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, networkConnectionName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -176,12 +169,12 @@ func (client *NetworkConnectionsClient) deleteCreateRequest(ctx context.Context, return nil, errors.New("parameter networkConnectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{networkConnectionName}", url.PathEscape(networkConnectionName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -189,16 +182,17 @@ 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 2022-11-11-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. +// +// Generated from API version 2023-01-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. func (client *NetworkConnectionsClient) Get(ctx context.Context, resourceGroupName string, networkConnectionName string, options *NetworkConnectionsClientGetOptions) (NetworkConnectionsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, networkConnectionName, options) if err != nil { return NetworkConnectionsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return NetworkConnectionsClientGetResponse{}, err } @@ -223,12 +217,12 @@ func (client *NetworkConnectionsClient) getCreateRequest(ctx context.Context, re return nil, errors.New("parameter networkConnectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{networkConnectionName}", url.PathEscape(networkConnectionName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -245,17 +239,18 @@ 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 2022-11-11-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 -// method. +// +// Generated from API version 2023-01-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 +// method. func (client *NetworkConnectionsClient) GetHealthDetails(ctx context.Context, resourceGroupName string, networkConnectionName string, options *NetworkConnectionsClientGetHealthDetailsOptions) (NetworkConnectionsClientGetHealthDetailsResponse, error) { req, err := client.getHealthDetailsCreateRequest(ctx, resourceGroupName, networkConnectionName, options) if err != nil { return NetworkConnectionsClientGetHealthDetailsResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return NetworkConnectionsClientGetHealthDetailsResponse{}, err } @@ -280,12 +275,12 @@ func (client *NetworkConnectionsClient) getHealthDetailsCreateRequest(ctx contex return nil, errors.New("parameter networkConnectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{networkConnectionName}", url.PathEscape(networkConnectionName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -301,10 +296,11 @@ func (client *NetworkConnectionsClient) getHealthDetailsHandleResponse(resp *htt } // NewListByResourceGroupPager - Lists network connections in a resource group -// Generated from API version 2022-11-11-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - NetworkConnectionsClientListByResourceGroupOptions contains the optional parameters for the NetworkConnectionsClient.ListByResourceGroup -// method. +// +// Generated from API version 2023-01-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. func (client *NetworkConnectionsClient) NewListByResourceGroupPager(resourceGroupName string, options *NetworkConnectionsClientListByResourceGroupOptions) *runtime.Pager[NetworkConnectionsClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[NetworkConnectionsClientListByResourceGroupResponse]{ More: func(page NetworkConnectionsClientListByResourceGroupResponse) bool { @@ -321,7 +317,7 @@ func (client *NetworkConnectionsClient) NewListByResourceGroupPager(resourceGrou if err != nil { return NetworkConnectionsClientListByResourceGroupResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return NetworkConnectionsClientListByResourceGroupResponse{}, err } @@ -344,12 +340,12 @@ func (client *NetworkConnectionsClient) listByResourceGroupCreateRequest(ctx con 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.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } @@ -368,9 +364,10 @@ func (client *NetworkConnectionsClient) listByResourceGroupHandleResponse(resp * } // NewListBySubscriptionPager - Lists network connections in a subscription -// Generated from API version 2022-11-11-preview -// options - NetworkConnectionsClientListBySubscriptionOptions contains the optional parameters for the NetworkConnectionsClient.ListBySubscription -// method. +// +// Generated from API version 2023-01-01-preview +// - options - NetworkConnectionsClientListBySubscriptionOptions contains the optional parameters for the NetworkConnectionsClient.NewListBySubscriptionPager +// method. func (client *NetworkConnectionsClient) NewListBySubscriptionPager(options *NetworkConnectionsClientListBySubscriptionOptions) *runtime.Pager[NetworkConnectionsClientListBySubscriptionResponse] { return runtime.NewPager(runtime.PagingHandler[NetworkConnectionsClientListBySubscriptionResponse]{ More: func(page NetworkConnectionsClientListBySubscriptionResponse) bool { @@ -387,7 +384,7 @@ func (client *NetworkConnectionsClient) NewListBySubscriptionPager(options *Netw if err != nil { return NetworkConnectionsClientListBySubscriptionResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return NetworkConnectionsClientListBySubscriptionResponse{}, err } @@ -406,12 +403,12 @@ func (client *NetworkConnectionsClient) listBySubscriptionCreateRequest(ctx cont 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.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } @@ -430,11 +427,12 @@ func (client *NetworkConnectionsClient) listBySubscriptionHandleResponse(resp *h } // NewListHealthDetailsPager - Lists health check status details -// Generated from API version 2022-11-11-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.ListHealthDetails -// method. +// +// Generated from API version 2023-01-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 +// method. func (client *NetworkConnectionsClient) NewListHealthDetailsPager(resourceGroupName string, networkConnectionName string, options *NetworkConnectionsClientListHealthDetailsOptions) *runtime.Pager[NetworkConnectionsClientListHealthDetailsResponse] { return runtime.NewPager(runtime.PagingHandler[NetworkConnectionsClientListHealthDetailsResponse]{ More: func(page NetworkConnectionsClientListHealthDetailsResponse) bool { @@ -451,7 +449,7 @@ func (client *NetworkConnectionsClient) NewListHealthDetailsPager(resourceGroupN if err != nil { return NetworkConnectionsClientListHealthDetailsResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return NetworkConnectionsClientListHealthDetailsResponse{}, err } @@ -478,12 +476,12 @@ func (client *NetworkConnectionsClient) listHealthDetailsCreateRequest(ctx conte return nil, errors.New("parameter networkConnectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{networkConnectionName}", url.PathEscape(networkConnectionName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } @@ -501,38 +499,114 @@ func (client *NetworkConnectionsClient) listHealthDetailsHandleResponse(resp *ht return result, nil } +// 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 2023-01-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 +// the NetworkConnectionsClient.NewListOutboundNetworkDependenciesEndpointsPager method. +func (client *NetworkConnectionsClient) NewListOutboundNetworkDependenciesEndpointsPager(resourceGroupName string, networkConnectionName string, options *NetworkConnectionsClientListOutboundNetworkDependenciesEndpointsOptions) *runtime.Pager[NetworkConnectionsClientListOutboundNetworkDependenciesEndpointsResponse] { + return runtime.NewPager(runtime.PagingHandler[NetworkConnectionsClientListOutboundNetworkDependenciesEndpointsResponse]{ + More: func(page NetworkConnectionsClientListOutboundNetworkDependenciesEndpointsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *NetworkConnectionsClientListOutboundNetworkDependenciesEndpointsResponse) (NetworkConnectionsClientListOutboundNetworkDependenciesEndpointsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listOutboundNetworkDependenciesEndpointsCreateRequest(ctx, resourceGroupName, networkConnectionName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return NetworkConnectionsClientListOutboundNetworkDependenciesEndpointsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return NetworkConnectionsClientListOutboundNetworkDependenciesEndpointsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return NetworkConnectionsClientListOutboundNetworkDependenciesEndpointsResponse{}, runtime.NewResponseError(resp) + } + return client.listOutboundNetworkDependenciesEndpointsHandleResponse(resp) + }, + }) +} + +// listOutboundNetworkDependenciesEndpointsCreateRequest creates the ListOutboundNetworkDependenciesEndpoints request. +func (client *NetworkConnectionsClient) listOutboundNetworkDependenciesEndpointsCreateRequest(ctx context.Context, resourceGroupName string, networkConnectionName string, options *NetworkConnectionsClientListOutboundNetworkDependenciesEndpointsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/networkConnections/{networkConnectionName}/outboundNetworkDependenciesEndpoints" + 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 networkConnectionName == "" { + return nil, errors.New("parameter networkConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkConnectionName}", url.PathEscape(networkConnectionName)) + 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", "2023-01-01-preview") + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listOutboundNetworkDependenciesEndpointsHandleResponse handles the ListOutboundNetworkDependenciesEndpoints response. +func (client *NetworkConnectionsClient) listOutboundNetworkDependenciesEndpointsHandleResponse(resp *http.Response) (NetworkConnectionsClientListOutboundNetworkDependenciesEndpointsResponse, error) { + result := NetworkConnectionsClientListOutboundNetworkDependenciesEndpointsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OutboundEnvironmentEndpointCollection); err != nil { + return NetworkConnectionsClientListOutboundNetworkDependenciesEndpointsResponse{}, err + } + return result, nil +} + // BeginRunHealthChecks - Triggers a new health check run. The execution and health check result can be tracked via the network // Connection health check details // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-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 -// method. +// +// Generated from API version 2023-01-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 +// method. func (client *NetworkConnectionsClient) BeginRunHealthChecks(ctx context.Context, resourceGroupName string, networkConnectionName string, options *NetworkConnectionsClientBeginRunHealthChecksOptions) (*runtime.Poller[NetworkConnectionsClientRunHealthChecksResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.runHealthChecks(ctx, resourceGroupName, networkConnectionName, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[NetworkConnectionsClientRunHealthChecksResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NetworkConnectionsClientRunHealthChecksResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[NetworkConnectionsClientRunHealthChecksResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[NetworkConnectionsClientRunHealthChecksResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // RunHealthChecks - Triggers a new health check run. The execution and health check result can be tracked via the network // Connection health check details // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview +// +// Generated from API version 2023-01-01-preview func (client *NetworkConnectionsClient) runHealthChecks(ctx context.Context, resourceGroupName string, networkConnectionName string, options *NetworkConnectionsClientBeginRunHealthChecksOptions) (*http.Response, error) { req, err := client.runHealthChecksCreateRequest(ctx, resourceGroupName, networkConnectionName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -557,12 +631,12 @@ func (client *NetworkConnectionsClient) runHealthChecksCreateRequest(ctx context return nil, errors.New("parameter networkConnectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{networkConnectionName}", url.PathEscape(networkConnectionName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -570,35 +644,37 @@ 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 2022-11-11-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 -// options - NetworkConnectionsClientBeginUpdateOptions contains the optional parameters for the NetworkConnectionsClient.BeginUpdate -// method. +// +// Generated from API version 2023-01-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 +// - options - NetworkConnectionsClientBeginUpdateOptions contains the optional parameters for the NetworkConnectionsClient.BeginUpdate +// method. func (client *NetworkConnectionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, networkConnectionName string, body NetworkConnectionUpdate, options *NetworkConnectionsClientBeginUpdateOptions) (*runtime.Poller[NetworkConnectionsClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.update(ctx, resourceGroupName, networkConnectionName, body, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[NetworkConnectionsClientUpdateResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NetworkConnectionsClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[NetworkConnectionsClientUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[NetworkConnectionsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Update - Partially updates a Network Connection // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview +// +// Generated from API version 2023-01-01-preview func (client *NetworkConnectionsClient) update(ctx context.Context, resourceGroupName string, networkConnectionName string, body NetworkConnectionUpdate, options *NetworkConnectionsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, networkConnectionName, body, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -623,12 +699,12 @@ func (client *NetworkConnectionsClient) updateCreateRequest(ctx context.Context, return nil, errors.New("parameter networkConnectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{networkConnectionName}", url.PathEscape(networkConnectionName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) 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 ae1274c4e6be..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/networkconnections_client_example_test.go +++ /dev/null @@ -1,230 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewNetworkConnectionsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(&armdevcenter.NetworkConnectionsClientListBySubscriptionOptions{Top: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewNetworkConnectionsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("rg1", &armdevcenter.NetworkConnectionsClientListByResourceGroupOptions{Top: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewNetworkConnectionsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "rg1", "uswest3network", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewNetworkConnectionsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewNetworkConnectionsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewNetworkConnectionsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewNetworkConnectionsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListHealthDetailsPager("rg1", "uswest3network", &armdevcenter.NetworkConnectionsClientListHealthDetailsOptions{Top: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewNetworkConnectionsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetHealthDetails(ctx, "rg1", "eastusnetwork", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewNetworkConnectionsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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) - } -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/operations_client.go b/sdk/resourcemanager/devcenter/armdevcenter/operations_client.go index 5d5dd5a67ac1..2d86bfbfaae6 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/operations_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/operations_client.go @@ -13,8 +13,6 @@ import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -23,35 +21,27 @@ import ( // OperationsClient contains the methods for the Operations group. // Don't use this type directly, use NewOperationsClient() instead. type OperationsClient struct { - host string - pl runtime.Pipeline + internal *arm.Client } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".OperationsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &OperationsClient{ - host: ep, - pl: pl, + internal: cl, } return client, nil } // NewListPager - Lists all of the available resource provider operations. -// Generated from API version 2022-11-11-preview -// options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// +// Generated from API version 2023-01-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]{ More: func(page OperationsClientListResponse) bool { @@ -68,7 +58,7 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption if err != nil { return OperationsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return OperationsClientListResponse{}, err } @@ -83,12 +73,12 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption // listCreateRequest creates the List request. func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.DevCenter/operations" - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-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 7c269cfdb7be..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/operations_client_example_test.go +++ /dev/null @@ -1,41 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewOperationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/operationstatuses_client.go b/sdk/resourcemanager/devcenter/armdevcenter/operationstatuses_client.go index 7dd8598e0a9d..a9e42511061c 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/operationstatuses_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/operationstatuses_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -26,47 +24,39 @@ import ( // OperationStatusesClient contains the methods for the OperationStatuses group. // Don't use this type directly, use NewOperationStatusesClient() instead. type OperationStatusesClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewOperationStatusesClient creates a new instance of OperationStatusesClient 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. +// - 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 NewOperationStatusesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationStatusesClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".OperationStatusesClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &OperationStatusesClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // Get - Gets the current status of an async operation. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview -// location - The Azure region -// operationID - The ID of an ongoing async operation -// options - OperationStatusesClientGetOptions contains the optional parameters for the OperationStatusesClient.Get method. +// +// Generated from API version 2023-01-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. func (client *OperationStatusesClient) Get(ctx context.Context, location string, operationID string, options *OperationStatusesClientGetOptions) (OperationStatusesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, location, operationID, options) if err != nil { return OperationStatusesClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return OperationStatusesClientGetResponse{}, err } @@ -91,12 +81,12 @@ func (client *OperationStatusesClient) getCreateRequest(ctx context.Context, loc return nil, errors.New("parameter operationID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-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 a0c637ce15d3..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/operationstatuses_client_example_test.go +++ /dev/null @@ -1,36 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewOperationStatusesClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "westus3", "3fa1a29d-e807-488d-81d1-f1c5456a08cd", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/pools_client.go b/sdk/resourcemanager/devcenter/armdevcenter/pools_client.go index eb8ed7f91e64..224df6b14273 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/pools_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/pools_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -27,67 +25,60 @@ import ( // PoolsClient contains the methods for the Pools group. // Don't use this type directly, use NewPoolsClient() instead. type PoolsClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewPoolsClient creates a new instance of PoolsClient 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. +// - 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 NewPoolsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PoolsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".PoolsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &PoolsClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // BeginCreateOrUpdate - Creates or updates a machine pool // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// projectName - The name of the project. -// poolName - Name of the pool. -// body - Represents a machine pool -// options - PoolsClientBeginCreateOrUpdateOptions contains the optional parameters for the PoolsClient.BeginCreateOrUpdate -// method. +// +// Generated from API version 2023-01-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. +// - body - Represents a machine pool +// - options - PoolsClientBeginCreateOrUpdateOptions contains the optional parameters for the PoolsClient.BeginCreateOrUpdate +// method. func (client *PoolsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, projectName string, poolName string, body Pool, options *PoolsClientBeginCreateOrUpdateOptions) (*runtime.Poller[PoolsClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, projectName, poolName, body, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PoolsClientCreateOrUpdateResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PoolsClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[PoolsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[PoolsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // CreateOrUpdate - Creates or updates a machine pool // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview +// +// Generated from API version 2023-01-01-preview func (client *PoolsClient) createOrUpdate(ctx context.Context, resourceGroupName string, projectName string, poolName string, body Pool, options *PoolsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, projectName, poolName, body, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -116,12 +107,12 @@ func (client *PoolsClient) createOrUpdateCreateRequest(ctx context.Context, reso return nil, errors.New("parameter poolName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -129,34 +120,36 @@ 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 2022-11-11-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// projectName - The name of the project. -// poolName - Name of the pool. -// options - PoolsClientBeginDeleteOptions contains the optional parameters for the PoolsClient.BeginDelete method. +// +// Generated from API version 2023-01-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. +// - options - PoolsClientBeginDeleteOptions contains the optional parameters for the PoolsClient.BeginDelete method. func (client *PoolsClient) BeginDelete(ctx context.Context, resourceGroupName string, projectName string, poolName string, options *PoolsClientBeginDeleteOptions) (*runtime.Poller[PoolsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, projectName, poolName, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PoolsClientDeleteResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PoolsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[PoolsClientDeleteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[PoolsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Delete - Deletes a machine pool // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview +// +// Generated from API version 2023-01-01-preview func (client *PoolsClient) deleteOperation(ctx context.Context, resourceGroupName string, projectName string, poolName string, options *PoolsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, projectName, poolName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -185,12 +178,12 @@ func (client *PoolsClient) deleteCreateRequest(ctx context.Context, resourceGrou return nil, errors.New("parameter poolName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -198,17 +191,18 @@ 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 2022-11-11-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// projectName - The name of the project. -// poolName - Name of the pool. -// options - PoolsClientGetOptions contains the optional parameters for the PoolsClient.Get method. +// +// Generated from API version 2023-01-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. +// - options - PoolsClientGetOptions contains the optional parameters for the PoolsClient.Get method. func (client *PoolsClient) Get(ctx context.Context, resourceGroupName string, projectName string, poolName string, options *PoolsClientGetOptions) (PoolsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, poolName, options) if err != nil { return PoolsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PoolsClientGetResponse{}, err } @@ -237,12 +231,12 @@ func (client *PoolsClient) getCreateRequest(ctx context.Context, resourceGroupNa return nil, errors.New("parameter poolName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -258,10 +252,11 @@ func (client *PoolsClient) getHandleResponse(resp *http.Response) (PoolsClientGe } // NewListByProjectPager - Lists pools for a project -// Generated from API version 2022-11-11-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.ListByProject method. +// +// Generated from API version 2023-01-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. func (client *PoolsClient) NewListByProjectPager(resourceGroupName string, projectName string, options *PoolsClientListByProjectOptions) *runtime.Pager[PoolsClientListByProjectResponse] { return runtime.NewPager(runtime.PagingHandler[PoolsClientListByProjectResponse]{ More: func(page PoolsClientListByProjectResponse) bool { @@ -278,7 +273,7 @@ func (client *PoolsClient) NewListByProjectPager(resourceGroupName string, proje if err != nil { return PoolsClientListByProjectResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return PoolsClientListByProjectResponse{}, err } @@ -305,12 +300,12 @@ func (client *PoolsClient) listByProjectCreateRequest(ctx context.Context, resou 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.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } @@ -328,37 +323,111 @@ func (client *PoolsClient) listByProjectHandleResponse(resp *http.Response) (Poo return result, nil } +// BeginRunHealthChecks - Triggers a refresh of the pool status. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-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. +// - options - PoolsClientBeginRunHealthChecksOptions contains the optional parameters for the PoolsClient.BeginRunHealthChecks +// method. +func (client *PoolsClient) BeginRunHealthChecks(ctx context.Context, resourceGroupName string, projectName string, poolName string, options *PoolsClientBeginRunHealthChecksOptions) (*runtime.Poller[PoolsClientRunHealthChecksResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.runHealthChecks(ctx, resourceGroupName, projectName, poolName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PoolsClientRunHealthChecksResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[PoolsClientRunHealthChecksResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// RunHealthChecks - Triggers a refresh of the pool status. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01-preview +func (client *PoolsClient) runHealthChecks(ctx context.Context, resourceGroupName string, projectName string, poolName string, options *PoolsClientBeginRunHealthChecksOptions) (*http.Response, error) { + req, err := client.runHealthChecksCreateRequest(ctx, resourceGroupName, projectName, poolName, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// runHealthChecksCreateRequest creates the RunHealthChecks request. +func (client *PoolsClient) runHealthChecksCreateRequest(ctx context.Context, resourceGroupName string, projectName string, poolName string, options *PoolsClientBeginRunHealthChecksOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevCenter/projects/{projectName}/pools/{poolName}/runHealthChecks" + 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 poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + 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", "2023-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + // BeginUpdate - Partially updates a machine pool // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// projectName - The name of the project. -// poolName - Name of the pool. -// body - Represents a machine pool -// options - PoolsClientBeginUpdateOptions contains the optional parameters for the PoolsClient.BeginUpdate method. +// +// Generated from API version 2023-01-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. +// - body - Represents a machine pool +// - options - PoolsClientBeginUpdateOptions contains the optional parameters for the PoolsClient.BeginUpdate method. func (client *PoolsClient) BeginUpdate(ctx context.Context, resourceGroupName string, projectName string, poolName string, body PoolUpdate, options *PoolsClientBeginUpdateOptions) (*runtime.Poller[PoolsClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.update(ctx, resourceGroupName, projectName, poolName, body, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PoolsClientUpdateResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PoolsClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[PoolsClientUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[PoolsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Update - Partially updates a machine pool // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview +// +// Generated from API version 2023-01-01-preview func (client *PoolsClient) update(ctx context.Context, resourceGroupName string, projectName string, poolName string, body PoolUpdate, options *PoolsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, projectName, poolName, body, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -387,12 +456,12 @@ func (client *PoolsClient) updateCreateRequest(ctx context.Context, resourceGrou return nil, errors.New("parameter poolName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) 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 83ba91600627..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/pools_client_example_test.go +++ /dev/null @@ -1,140 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewPoolsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByProjectPager("rg1", "DevProject", &armdevcenter.PoolsClientListByProjectOptions{Top: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/examples/Pools_Get.json -func ExamplePoolsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdevcenter.NewPoolsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "rg1", "DevProject", "DevPool", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/examples/Pools_Put.json -func ExamplePoolsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdevcenter.NewPoolsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "rg1", "DevProject", "DevPool", armdevcenter.Pool{ - Location: to.Ptr("centralus"), - Properties: &armdevcenter.PoolProperties{ - DevBoxDefinitionName: to.Ptr("WebDevBox"), - LicenseType: to.Ptr(armdevcenter.LicenseTypeWindowsClient), - LocalAdministrator: to.Ptr(armdevcenter.LocalAdminStatusEnabled), - NetworkConnectionName: to.Ptr("Network1-westus2"), - }, - }, 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewPoolsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewPoolsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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) - } -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/projectallowedenvironmenttypes_client.go b/sdk/resourcemanager/devcenter/armdevcenter/projectallowedenvironmenttypes_client.go index b1754b04677e..905c95a45a42 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/projectallowedenvironmenttypes_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/projectallowedenvironmenttypes_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -27,49 +25,41 @@ import ( // ProjectAllowedEnvironmentTypesClient contains the methods for the ProjectAllowedEnvironmentTypes group. // Don't use this type directly, use NewProjectAllowedEnvironmentTypesClient() instead. type ProjectAllowedEnvironmentTypesClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewProjectAllowedEnvironmentTypesClient creates a new instance of ProjectAllowedEnvironmentTypesClient 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. +// - 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 NewProjectAllowedEnvironmentTypesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProjectAllowedEnvironmentTypesClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".ProjectAllowedEnvironmentTypesClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ProjectAllowedEnvironmentTypesClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // Get - Gets an allowed environment type. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-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. -// options - ProjectAllowedEnvironmentTypesClientGetOptions contains the optional parameters for the ProjectAllowedEnvironmentTypesClient.Get -// method. +// +// Generated from API version 2023-01-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. +// - options - ProjectAllowedEnvironmentTypesClientGetOptions contains the optional parameters for the ProjectAllowedEnvironmentTypesClient.Get +// method. func (client *ProjectAllowedEnvironmentTypesClient) Get(ctx context.Context, resourceGroupName string, projectName string, environmentTypeName string, options *ProjectAllowedEnvironmentTypesClientGetOptions) (ProjectAllowedEnvironmentTypesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, environmentTypeName, options) if err != nil { return ProjectAllowedEnvironmentTypesClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ProjectAllowedEnvironmentTypesClientGetResponse{}, err } @@ -98,12 +88,12 @@ func (client *ProjectAllowedEnvironmentTypesClient) getCreateRequest(ctx context return nil, errors.New("parameter environmentTypeName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{environmentTypeName}", url.PathEscape(environmentTypeName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -119,11 +109,12 @@ func (client *ProjectAllowedEnvironmentTypesClient) getHandleResponse(resp *http } // NewListPager - Lists allowed environment types for a project. -// Generated from API version 2022-11-11-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.List -// method. +// +// Generated from API version 2023-01-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 +// method. func (client *ProjectAllowedEnvironmentTypesClient) NewListPager(resourceGroupName string, projectName string, options *ProjectAllowedEnvironmentTypesClientListOptions) *runtime.Pager[ProjectAllowedEnvironmentTypesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ProjectAllowedEnvironmentTypesClientListResponse]{ More: func(page ProjectAllowedEnvironmentTypesClientListResponse) bool { @@ -140,7 +131,7 @@ func (client *ProjectAllowedEnvironmentTypesClient) NewListPager(resourceGroupNa if err != nil { return ProjectAllowedEnvironmentTypesClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ProjectAllowedEnvironmentTypesClientListResponse{}, err } @@ -167,12 +158,12 @@ func (client *ProjectAllowedEnvironmentTypesClient) listCreateRequest(ctx contex 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.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } 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 912c84361ddc..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/projectallowedenvironmenttypes_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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewProjectAllowedEnvironmentTypesClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("rg1", "Contoso", &armdevcenter.ProjectAllowedEnvironmentTypesClientListOptions{Top: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewProjectAllowedEnvironmentTypesClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "rg1", "Contoso", "DevTest", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/projectenvironmenttypes_client.go b/sdk/resourcemanager/devcenter/armdevcenter/projectenvironmenttypes_client.go index 3b54e699d6cc..ef98454c4f07 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/projectenvironmenttypes_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/projectenvironmenttypes_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -27,50 +25,42 @@ import ( // ProjectEnvironmentTypesClient contains the methods for the ProjectEnvironmentTypes group. // Don't use this type directly, use NewProjectEnvironmentTypesClient() instead. type ProjectEnvironmentTypesClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewProjectEnvironmentTypesClient creates a new instance of ProjectEnvironmentTypesClient 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. +// - 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 NewProjectEnvironmentTypesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProjectEnvironmentTypesClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".ProjectEnvironmentTypesClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ProjectEnvironmentTypesClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // CreateOrUpdate - Creates or updates a project environment type. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-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. -// body - Represents a Project Environment Type. -// options - ProjectEnvironmentTypesClientCreateOrUpdateOptions contains the optional parameters for the ProjectEnvironmentTypesClient.CreateOrUpdate -// method. +// +// Generated from API version 2023-01-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. +// - body - Represents a Project Environment Type. +// - options - ProjectEnvironmentTypesClientCreateOrUpdateOptions contains the optional parameters for the ProjectEnvironmentTypesClient.CreateOrUpdate +// method. func (client *ProjectEnvironmentTypesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, projectName string, environmentTypeName string, body ProjectEnvironmentType, options *ProjectEnvironmentTypesClientCreateOrUpdateOptions) (ProjectEnvironmentTypesClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, projectName, environmentTypeName, body, options) if err != nil { return ProjectEnvironmentTypesClientCreateOrUpdateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ProjectEnvironmentTypesClientCreateOrUpdateResponse{}, err } @@ -99,12 +89,12 @@ func (client *ProjectEnvironmentTypesClient) createOrUpdateCreateRequest(ctx con return nil, errors.New("parameter environmentTypeName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{environmentTypeName}", url.PathEscape(environmentTypeName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -121,18 +111,19 @@ 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 2022-11-11-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. -// options - ProjectEnvironmentTypesClientDeleteOptions contains the optional parameters for the ProjectEnvironmentTypesClient.Delete -// method. +// +// Generated from API version 2023-01-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. +// - options - ProjectEnvironmentTypesClientDeleteOptions contains the optional parameters for the ProjectEnvironmentTypesClient.Delete +// method. func (client *ProjectEnvironmentTypesClient) Delete(ctx context.Context, resourceGroupName string, projectName string, environmentTypeName string, options *ProjectEnvironmentTypesClientDeleteOptions) (ProjectEnvironmentTypesClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, projectName, environmentTypeName, options) if err != nil { return ProjectEnvironmentTypesClientDeleteResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ProjectEnvironmentTypesClientDeleteResponse{}, err } @@ -161,12 +152,12 @@ func (client *ProjectEnvironmentTypesClient) deleteCreateRequest(ctx context.Con return nil, errors.New("parameter environmentTypeName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{environmentTypeName}", url.PathEscape(environmentTypeName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -174,18 +165,19 @@ 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 2022-11-11-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. -// options - ProjectEnvironmentTypesClientGetOptions contains the optional parameters for the ProjectEnvironmentTypesClient.Get -// method. +// +// Generated from API version 2023-01-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. +// - options - ProjectEnvironmentTypesClientGetOptions contains the optional parameters for the ProjectEnvironmentTypesClient.Get +// method. func (client *ProjectEnvironmentTypesClient) Get(ctx context.Context, resourceGroupName string, projectName string, environmentTypeName string, options *ProjectEnvironmentTypesClientGetOptions) (ProjectEnvironmentTypesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, environmentTypeName, options) if err != nil { return ProjectEnvironmentTypesClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ProjectEnvironmentTypesClientGetResponse{}, err } @@ -214,12 +206,12 @@ func (client *ProjectEnvironmentTypesClient) getCreateRequest(ctx context.Contex return nil, errors.New("parameter environmentTypeName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{environmentTypeName}", url.PathEscape(environmentTypeName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -235,11 +227,12 @@ func (client *ProjectEnvironmentTypesClient) getHandleResponse(resp *http.Respon } // NewListPager - Lists environment types for a project. -// Generated from API version 2022-11-11-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.List -// method. +// +// Generated from API version 2023-01-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 +// method. func (client *ProjectEnvironmentTypesClient) NewListPager(resourceGroupName string, projectName string, options *ProjectEnvironmentTypesClientListOptions) *runtime.Pager[ProjectEnvironmentTypesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ProjectEnvironmentTypesClientListResponse]{ More: func(page ProjectEnvironmentTypesClientListResponse) bool { @@ -256,7 +249,7 @@ func (client *ProjectEnvironmentTypesClient) NewListPager(resourceGroupName stri if err != nil { return ProjectEnvironmentTypesClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ProjectEnvironmentTypesClientListResponse{}, err } @@ -283,12 +276,12 @@ func (client *ProjectEnvironmentTypesClient) listCreateRequest(ctx context.Conte 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.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } @@ -308,19 +301,20 @@ 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 2022-11-11-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. -// body - Updatable project environment type properties. -// options - ProjectEnvironmentTypesClientUpdateOptions contains the optional parameters for the ProjectEnvironmentTypesClient.Update -// method. +// +// Generated from API version 2023-01-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. +// - body - Updatable project environment type properties. +// - options - ProjectEnvironmentTypesClientUpdateOptions contains the optional parameters for the ProjectEnvironmentTypesClient.Update +// method. func (client *ProjectEnvironmentTypesClient) Update(ctx context.Context, resourceGroupName string, projectName string, environmentTypeName string, body ProjectEnvironmentTypeUpdate, options *ProjectEnvironmentTypesClientUpdateOptions) (ProjectEnvironmentTypesClientUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, projectName, environmentTypeName, body, options) if err != nil { return ProjectEnvironmentTypesClientUpdateResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ProjectEnvironmentTypesClientUpdateResponse{}, err } @@ -349,12 +343,12 @@ func (client *ProjectEnvironmentTypesClient) updateCreateRequest(ctx context.Con return nil, errors.New("parameter environmentTypeName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{environmentTypeName}", url.PathEscape(environmentTypeName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) 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 f4709f0b9e2a..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/projectenvironmenttypes_client_example_test.go +++ /dev/null @@ -1,163 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewProjectEnvironmentTypesClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("rg1", "ContosoProj", &armdevcenter.ProjectEnvironmentTypesClientListOptions{Top: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewProjectEnvironmentTypesClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "rg1", "ContosoProj", "DevTest", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewProjectEnvironmentTypesClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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.EnableStatusEnabled), - 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewProjectEnvironmentTypesClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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.EnableStatusEnabled), - 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewProjectEnvironmentTypesClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.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/projects_client.go b/sdk/resourcemanager/devcenter/armdevcenter/projects_client.go index 848a6bc02807..9af9319f0c6a 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/projects_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/projects_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -27,66 +25,59 @@ import ( // ProjectsClient contains the methods for the Projects group. // Don't use this type directly, use NewProjectsClient() instead. type ProjectsClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewProjectsClient creates a new instance of ProjectsClient 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. +// - 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 NewProjectsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProjectsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".ProjectsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ProjectsClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // BeginCreateOrUpdate - Creates or updates a project. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// projectName - The name of the project. -// body - Represents a project. -// options - ProjectsClientBeginCreateOrUpdateOptions contains the optional parameters for the ProjectsClient.BeginCreateOrUpdate -// method. +// +// Generated from API version 2023-01-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - projectName - The name of the project. +// - body - Represents a project. +// - options - ProjectsClientBeginCreateOrUpdateOptions contains the optional parameters for the ProjectsClient.BeginCreateOrUpdate +// method. func (client *ProjectsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, projectName string, body Project, options *ProjectsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ProjectsClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, projectName, body, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ProjectsClientCreateOrUpdateResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProjectsClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[ProjectsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ProjectsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // CreateOrUpdate - Creates or updates a project. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview +// +// Generated from API version 2023-01-01-preview func (client *ProjectsClient) createOrUpdate(ctx context.Context, resourceGroupName string, projectName string, body Project, options *ProjectsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, projectName, body, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -111,12 +102,12 @@ func (client *ProjectsClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, errors.New("parameter projectName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) @@ -124,33 +115,35 @@ 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 2022-11-11-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. +// +// Generated from API version 2023-01-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. func (client *ProjectsClient) BeginDelete(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientBeginDeleteOptions) (*runtime.Poller[ProjectsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, projectName, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ProjectsClientDeleteResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProjectsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[ProjectsClientDeleteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ProjectsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Delete - Deletes a project resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview +// +// Generated from API version 2023-01-01-preview func (client *ProjectsClient) deleteOperation(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, projectName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -175,12 +168,12 @@ func (client *ProjectsClient) deleteCreateRequest(ctx context.Context, resourceG return nil, errors.New("parameter projectName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -188,16 +181,17 @@ 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 2022-11-11-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. +// +// Generated from API version 2023-01-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. func (client *ProjectsClient) Get(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientGetOptions) (ProjectsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, options) if err != nil { return ProjectsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ProjectsClientGetResponse{}, err } @@ -222,12 +216,12 @@ func (client *ProjectsClient) getCreateRequest(ctx context.Context, resourceGrou 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.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -243,10 +237,11 @@ func (client *ProjectsClient) getHandleResponse(resp *http.Response) (ProjectsCl } // NewListByResourceGroupPager - Lists all projects in the resource group. -// Generated from API version 2022-11-11-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - ProjectsClientListByResourceGroupOptions contains the optional parameters for the ProjectsClient.ListByResourceGroup -// method. +// +// Generated from API version 2023-01-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. func (client *ProjectsClient) NewListByResourceGroupPager(resourceGroupName string, options *ProjectsClientListByResourceGroupOptions) *runtime.Pager[ProjectsClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[ProjectsClientListByResourceGroupResponse]{ More: func(page ProjectsClientListByResourceGroupResponse) bool { @@ -263,7 +258,7 @@ func (client *ProjectsClient) NewListByResourceGroupPager(resourceGroupName stri if err != nil { return ProjectsClientListByResourceGroupResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ProjectsClientListByResourceGroupResponse{}, err } @@ -286,12 +281,12 @@ func (client *ProjectsClient) listByResourceGroupCreateRequest(ctx context.Conte 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.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } @@ -310,9 +305,10 @@ func (client *ProjectsClient) listByResourceGroupHandleResponse(resp *http.Respo } // NewListBySubscriptionPager - Lists all projects in the subscription. -// Generated from API version 2022-11-11-preview -// options - ProjectsClientListBySubscriptionOptions contains the optional parameters for the ProjectsClient.ListBySubscription -// method. +// +// Generated from API version 2023-01-01-preview +// - options - ProjectsClientListBySubscriptionOptions contains the optional parameters for the ProjectsClient.NewListBySubscriptionPager +// method. func (client *ProjectsClient) NewListBySubscriptionPager(options *ProjectsClientListBySubscriptionOptions) *runtime.Pager[ProjectsClientListBySubscriptionResponse] { return runtime.NewPager(runtime.PagingHandler[ProjectsClientListBySubscriptionResponse]{ More: func(page ProjectsClientListBySubscriptionResponse) bool { @@ -329,7 +325,7 @@ func (client *ProjectsClient) NewListBySubscriptionPager(options *ProjectsClient if err != nil { return ProjectsClientListBySubscriptionResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ProjectsClientListBySubscriptionResponse{}, err } @@ -348,12 +344,12 @@ func (client *ProjectsClient) listBySubscriptionCreateRequest(ctx context.Contex 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.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } @@ -373,34 +369,36 @@ 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 2022-11-11-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// projectName - The name of the project. -// body - Updatable project properties. -// options - ProjectsClientBeginUpdateOptions contains the optional parameters for the ProjectsClient.BeginUpdate method. +// +// Generated from API version 2023-01-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - projectName - The name of the project. +// - body - Updatable project properties. +// - options - ProjectsClientBeginUpdateOptions contains the optional parameters for the ProjectsClient.BeginUpdate method. func (client *ProjectsClient) BeginUpdate(ctx context.Context, resourceGroupName string, projectName string, body ProjectUpdate, options *ProjectsClientBeginUpdateOptions) (*runtime.Poller[ProjectsClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.update(ctx, resourceGroupName, projectName, body, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ProjectsClientUpdateResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProjectsClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[ProjectsClientUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ProjectsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Update - Partially updates a project. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview +// +// Generated from API version 2023-01-01-preview func (client *ProjectsClient) update(ctx context.Context, resourceGroupName string, projectName string, body ProjectUpdate, options *ProjectsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, projectName, body, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -425,12 +423,12 @@ func (client *ProjectsClient) updateCreateRequest(ctx context.Context, resourceG return nil, errors.New("parameter projectName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, body) 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 70909261abfc..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/projects_client_example_test.go +++ /dev/null @@ -1,168 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewProjectsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(&armdevcenter.ProjectsClientListBySubscriptionOptions{Top: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewProjectsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("rg1", &armdevcenter.ProjectsClientListByResourceGroupOptions{Top: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewProjectsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "rg1", "DevProject", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/examples/Projects_Put.json -func ExampleProjectsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdevcenter.NewProjectsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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"), - }, - }, 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewProjectsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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."), - }, - }, 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewProjectsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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/response_types.go b/sdk/resourcemanager/devcenter/armdevcenter/response_types.go index 3ba7fc8c0721..68c2d5255e53 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/response_types.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/response_types.go @@ -9,12 +9,12 @@ package armdevcenter -// AttachedNetworksClientCreateOrUpdateResponse contains the response from method AttachedNetworksClient.CreateOrUpdate. +// AttachedNetworksClientCreateOrUpdateResponse contains the response from method AttachedNetworksClient.BeginCreateOrUpdate. type AttachedNetworksClientCreateOrUpdateResponse struct { AttachedNetworkConnection } -// AttachedNetworksClientDeleteResponse contains the response from method AttachedNetworksClient.Delete. +// AttachedNetworksClientDeleteResponse contains the response from method AttachedNetworksClient.BeginDelete. type AttachedNetworksClientDeleteResponse struct { // placeholder for future response values } @@ -29,22 +29,22 @@ type AttachedNetworksClientGetByProjectResponse struct { AttachedNetworkConnection } -// AttachedNetworksClientListByDevCenterResponse contains the response from method AttachedNetworksClient.ListByDevCenter. +// AttachedNetworksClientListByDevCenterResponse contains the response from method AttachedNetworksClient.NewListByDevCenterPager. type AttachedNetworksClientListByDevCenterResponse struct { AttachedNetworkListResult } -// AttachedNetworksClientListByProjectResponse contains the response from method AttachedNetworksClient.ListByProject. +// AttachedNetworksClientListByProjectResponse contains the response from method AttachedNetworksClient.NewListByProjectPager. type AttachedNetworksClientListByProjectResponse struct { AttachedNetworkListResult } -// CatalogsClientCreateOrUpdateResponse contains the response from method CatalogsClient.CreateOrUpdate. +// CatalogsClientCreateOrUpdateResponse contains the response from method CatalogsClient.BeginCreateOrUpdate. type CatalogsClientCreateOrUpdateResponse struct { Catalog } -// CatalogsClientDeleteResponse contains the response from method CatalogsClient.Delete. +// CatalogsClientDeleteResponse contains the response from method CatalogsClient.BeginDelete. type CatalogsClientDeleteResponse struct { // placeholder for future response values } @@ -54,17 +54,17 @@ type CatalogsClientGetResponse struct { Catalog } -// CatalogsClientListByDevCenterResponse contains the response from method CatalogsClient.ListByDevCenter. +// CatalogsClientListByDevCenterResponse contains the response from method CatalogsClient.NewListByDevCenterPager. type CatalogsClientListByDevCenterResponse struct { CatalogListResult } -// CatalogsClientSyncResponse contains the response from method CatalogsClient.Sync. +// CatalogsClientSyncResponse contains the response from method CatalogsClient.BeginSync. type CatalogsClientSyncResponse struct { // placeholder for future response values } -// CatalogsClientUpdateResponse contains the response from method CatalogsClient.Update. +// CatalogsClientUpdateResponse contains the response from method CatalogsClient.BeginUpdate. type CatalogsClientUpdateResponse struct { Catalog } @@ -74,12 +74,12 @@ type CheckNameAvailabilityClientExecuteResponse struct { CheckNameAvailabilityResponse } -// DevBoxDefinitionsClientCreateOrUpdateResponse contains the response from method DevBoxDefinitionsClient.CreateOrUpdate. +// DevBoxDefinitionsClientCreateOrUpdateResponse contains the response from method DevBoxDefinitionsClient.BeginCreateOrUpdate. type DevBoxDefinitionsClientCreateOrUpdateResponse struct { DevBoxDefinition } -// DevBoxDefinitionsClientDeleteResponse contains the response from method DevBoxDefinitionsClient.Delete. +// DevBoxDefinitionsClientDeleteResponse contains the response from method DevBoxDefinitionsClient.BeginDelete. type DevBoxDefinitionsClientDeleteResponse struct { // placeholder for future response values } @@ -94,27 +94,27 @@ type DevBoxDefinitionsClientGetResponse struct { DevBoxDefinition } -// DevBoxDefinitionsClientListByDevCenterResponse contains the response from method DevBoxDefinitionsClient.ListByDevCenter. +// DevBoxDefinitionsClientListByDevCenterResponse contains the response from method DevBoxDefinitionsClient.NewListByDevCenterPager. type DevBoxDefinitionsClientListByDevCenterResponse struct { DevBoxDefinitionListResult } -// DevBoxDefinitionsClientListByProjectResponse contains the response from method DevBoxDefinitionsClient.ListByProject. +// DevBoxDefinitionsClientListByProjectResponse contains the response from method DevBoxDefinitionsClient.NewListByProjectPager. type DevBoxDefinitionsClientListByProjectResponse struct { DevBoxDefinitionListResult } -// DevBoxDefinitionsClientUpdateResponse contains the response from method DevBoxDefinitionsClient.Update. +// DevBoxDefinitionsClientUpdateResponse contains the response from method DevBoxDefinitionsClient.BeginUpdate. type DevBoxDefinitionsClientUpdateResponse struct { DevBoxDefinition } -// DevCentersClientCreateOrUpdateResponse contains the response from method DevCentersClient.CreateOrUpdate. +// DevCentersClientCreateOrUpdateResponse contains the response from method DevCentersClient.BeginCreateOrUpdate. type DevCentersClientCreateOrUpdateResponse struct { DevCenter } -// DevCentersClientDeleteResponse contains the response from method DevCentersClient.Delete. +// DevCentersClientDeleteResponse contains the response from method DevCentersClient.BeginDelete. type DevCentersClientDeleteResponse struct { // placeholder for future response values } @@ -124,17 +124,17 @@ type DevCentersClientGetResponse struct { DevCenter } -// DevCentersClientListByResourceGroupResponse contains the response from method DevCentersClient.ListByResourceGroup. +// DevCentersClientListByResourceGroupResponse contains the response from method DevCentersClient.NewListByResourceGroupPager. type DevCentersClientListByResourceGroupResponse struct { ListResult } -// DevCentersClientListBySubscriptionResponse contains the response from method DevCentersClient.ListBySubscription. +// DevCentersClientListBySubscriptionResponse contains the response from method DevCentersClient.NewListBySubscriptionPager. type DevCentersClientListBySubscriptionResponse struct { ListResult } -// DevCentersClientUpdateResponse contains the response from method DevCentersClient.Update. +// DevCentersClientUpdateResponse contains the response from method DevCentersClient.BeginUpdate. type DevCentersClientUpdateResponse struct { DevCenter } @@ -154,7 +154,7 @@ type EnvironmentTypesClientGetResponse struct { EnvironmentType } -// EnvironmentTypesClientListByDevCenterResponse contains the response from method EnvironmentTypesClient.ListByDevCenter. +// EnvironmentTypesClientListByDevCenterResponse contains the response from method EnvironmentTypesClient.NewListByDevCenterPager. type EnvironmentTypesClientListByDevCenterResponse struct { EnvironmentTypeListResult } @@ -164,12 +164,12 @@ type EnvironmentTypesClientUpdateResponse struct { EnvironmentType } -// GalleriesClientCreateOrUpdateResponse contains the response from method GalleriesClient.CreateOrUpdate. +// GalleriesClientCreateOrUpdateResponse contains the response from method GalleriesClient.BeginCreateOrUpdate. type GalleriesClientCreateOrUpdateResponse struct { Gallery } -// GalleriesClientDeleteResponse contains the response from method GalleriesClient.Delete. +// GalleriesClientDeleteResponse contains the response from method GalleriesClient.BeginDelete. type GalleriesClientDeleteResponse struct { // placeholder for future response values } @@ -179,7 +179,7 @@ type GalleriesClientGetResponse struct { Gallery } -// GalleriesClientListByDevCenterResponse contains the response from method GalleriesClient.ListByDevCenter. +// GalleriesClientListByDevCenterResponse contains the response from method GalleriesClient.NewListByDevCenterPager. type GalleriesClientListByDevCenterResponse struct { GalleryListResult } @@ -189,7 +189,7 @@ type ImageVersionsClientGetResponse struct { ImageVersion } -// ImageVersionsClientListByImageResponse contains the response from method ImageVersionsClient.ListByImage. +// ImageVersionsClientListByImageResponse contains the response from method ImageVersionsClient.NewListByImagePager. type ImageVersionsClientListByImageResponse struct { ImageVersionListResult } @@ -199,22 +199,22 @@ type ImagesClientGetResponse struct { Image } -// ImagesClientListByDevCenterResponse contains the response from method ImagesClient.ListByDevCenter. +// ImagesClientListByDevCenterResponse contains the response from method ImagesClient.NewListByDevCenterPager. type ImagesClientListByDevCenterResponse struct { ImageListResult } -// ImagesClientListByGalleryResponse contains the response from method ImagesClient.ListByGallery. +// ImagesClientListByGalleryResponse contains the response from method ImagesClient.NewListByGalleryPager. type ImagesClientListByGalleryResponse struct { ImageListResult } -// NetworkConnectionsClientCreateOrUpdateResponse contains the response from method NetworkConnectionsClient.CreateOrUpdate. +// NetworkConnectionsClientCreateOrUpdateResponse contains the response from method NetworkConnectionsClient.BeginCreateOrUpdate. type NetworkConnectionsClientCreateOrUpdateResponse struct { NetworkConnection } -// NetworkConnectionsClientDeleteResponse contains the response from method NetworkConnectionsClient.Delete. +// NetworkConnectionsClientDeleteResponse contains the response from method NetworkConnectionsClient.BeginDelete. type NetworkConnectionsClientDeleteResponse struct { // placeholder for future response values } @@ -229,27 +229,32 @@ type NetworkConnectionsClientGetResponse struct { NetworkConnection } -// NetworkConnectionsClientListByResourceGroupResponse contains the response from method NetworkConnectionsClient.ListByResourceGroup. +// NetworkConnectionsClientListByResourceGroupResponse contains the response from method NetworkConnectionsClient.NewListByResourceGroupPager. type NetworkConnectionsClientListByResourceGroupResponse struct { NetworkConnectionListResult } -// NetworkConnectionsClientListBySubscriptionResponse contains the response from method NetworkConnectionsClient.ListBySubscription. +// NetworkConnectionsClientListBySubscriptionResponse contains the response from method NetworkConnectionsClient.NewListBySubscriptionPager. type NetworkConnectionsClientListBySubscriptionResponse struct { NetworkConnectionListResult } -// NetworkConnectionsClientListHealthDetailsResponse contains the response from method NetworkConnectionsClient.ListHealthDetails. +// NetworkConnectionsClientListHealthDetailsResponse contains the response from method NetworkConnectionsClient.NewListHealthDetailsPager. type NetworkConnectionsClientListHealthDetailsResponse struct { HealthCheckStatusDetailsListResult } -// NetworkConnectionsClientRunHealthChecksResponse contains the response from method NetworkConnectionsClient.RunHealthChecks. +// NetworkConnectionsClientListOutboundNetworkDependenciesEndpointsResponse contains the response from method NetworkConnectionsClient.NewListOutboundNetworkDependenciesEndpointsPager. +type NetworkConnectionsClientListOutboundNetworkDependenciesEndpointsResponse struct { + OutboundEnvironmentEndpointCollection +} + +// NetworkConnectionsClientRunHealthChecksResponse contains the response from method NetworkConnectionsClient.BeginRunHealthChecks. type NetworkConnectionsClientRunHealthChecksResponse struct { // placeholder for future response values } -// NetworkConnectionsClientUpdateResponse contains the response from method NetworkConnectionsClient.Update. +// NetworkConnectionsClientUpdateResponse contains the response from method NetworkConnectionsClient.BeginUpdate. type NetworkConnectionsClientUpdateResponse struct { NetworkConnection } @@ -259,17 +264,17 @@ type OperationStatusesClientGetResponse struct { OperationStatus } -// OperationsClientListResponse contains the response from method OperationsClient.List. +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { OperationListResult } -// PoolsClientCreateOrUpdateResponse contains the response from method PoolsClient.CreateOrUpdate. +// PoolsClientCreateOrUpdateResponse contains the response from method PoolsClient.BeginCreateOrUpdate. type PoolsClientCreateOrUpdateResponse struct { Pool } -// PoolsClientDeleteResponse contains the response from method PoolsClient.Delete. +// PoolsClientDeleteResponse contains the response from method PoolsClient.BeginDelete. type PoolsClientDeleteResponse struct { // placeholder for future response values } @@ -279,12 +284,17 @@ type PoolsClientGetResponse struct { Pool } -// PoolsClientListByProjectResponse contains the response from method PoolsClient.ListByProject. +// PoolsClientListByProjectResponse contains the response from method PoolsClient.NewListByProjectPager. type PoolsClientListByProjectResponse struct { PoolListResult } -// PoolsClientUpdateResponse contains the response from method PoolsClient.Update. +// PoolsClientRunHealthChecksResponse contains the response from method PoolsClient.BeginRunHealthChecks. +type PoolsClientRunHealthChecksResponse struct { + // placeholder for future response values +} + +// PoolsClientUpdateResponse contains the response from method PoolsClient.BeginUpdate. type PoolsClientUpdateResponse struct { Pool } @@ -294,7 +304,7 @@ type ProjectAllowedEnvironmentTypesClientGetResponse struct { AllowedEnvironmentType } -// ProjectAllowedEnvironmentTypesClientListResponse contains the response from method ProjectAllowedEnvironmentTypesClient.List. +// ProjectAllowedEnvironmentTypesClientListResponse contains the response from method ProjectAllowedEnvironmentTypesClient.NewListPager. type ProjectAllowedEnvironmentTypesClientListResponse struct { AllowedEnvironmentTypeListResult } @@ -314,7 +324,7 @@ type ProjectEnvironmentTypesClientGetResponse struct { ProjectEnvironmentType } -// ProjectEnvironmentTypesClientListResponse contains the response from method ProjectEnvironmentTypesClient.List. +// ProjectEnvironmentTypesClientListResponse contains the response from method ProjectEnvironmentTypesClient.NewListPager. type ProjectEnvironmentTypesClientListResponse struct { ProjectEnvironmentTypeListResult } @@ -324,12 +334,12 @@ type ProjectEnvironmentTypesClientUpdateResponse struct { ProjectEnvironmentType } -// ProjectsClientCreateOrUpdateResponse contains the response from method ProjectsClient.CreateOrUpdate. +// ProjectsClientCreateOrUpdateResponse contains the response from method ProjectsClient.BeginCreateOrUpdate. type ProjectsClientCreateOrUpdateResponse struct { Project } -// ProjectsClientDeleteResponse contains the response from method ProjectsClient.Delete. +// ProjectsClientDeleteResponse contains the response from method ProjectsClient.BeginDelete. type ProjectsClientDeleteResponse struct { // placeholder for future response values } @@ -339,32 +349,32 @@ type ProjectsClientGetResponse struct { Project } -// ProjectsClientListByResourceGroupResponse contains the response from method ProjectsClient.ListByResourceGroup. +// ProjectsClientListByResourceGroupResponse contains the response from method ProjectsClient.NewListByResourceGroupPager. type ProjectsClientListByResourceGroupResponse struct { ProjectListResult } -// ProjectsClientListBySubscriptionResponse contains the response from method ProjectsClient.ListBySubscription. +// ProjectsClientListBySubscriptionResponse contains the response from method ProjectsClient.NewListBySubscriptionPager. type ProjectsClientListBySubscriptionResponse struct { ProjectListResult } -// ProjectsClientUpdateResponse contains the response from method ProjectsClient.Update. +// ProjectsClientUpdateResponse contains the response from method ProjectsClient.BeginUpdate. type ProjectsClientUpdateResponse struct { Project } -// SKUsClientListBySubscriptionResponse contains the response from method SKUsClient.ListBySubscription. +// SKUsClientListBySubscriptionResponse contains the response from method SKUsClient.NewListBySubscriptionPager. type SKUsClientListBySubscriptionResponse struct { SKUListResult } -// SchedulesClientCreateOrUpdateResponse contains the response from method SchedulesClient.CreateOrUpdate. +// SchedulesClientCreateOrUpdateResponse contains the response from method SchedulesClient.BeginCreateOrUpdate. type SchedulesClientCreateOrUpdateResponse struct { Schedule } -// SchedulesClientDeleteResponse contains the response from method SchedulesClient.Delete. +// SchedulesClientDeleteResponse contains the response from method SchedulesClient.BeginDelete. type SchedulesClientDeleteResponse struct { // placeholder for future response values } @@ -374,17 +384,12 @@ type SchedulesClientGetResponse struct { Schedule } -// SchedulesClientListByPoolResponse contains the response from method SchedulesClient.ListByPool. +// SchedulesClientListByPoolResponse contains the response from method SchedulesClient.NewListByPoolPager. type SchedulesClientListByPoolResponse struct { ScheduleListResult } -// SchedulesClientUpdateResponse contains the response from method SchedulesClient.Update. +// SchedulesClientUpdateResponse contains the response from method SchedulesClient.BeginUpdate. type SchedulesClientUpdateResponse struct { Schedule } - -// UsagesClientListByLocationResponse contains the response from method UsagesClient.ListByLocation. -type UsagesClientListByLocationResponse struct { - ListUsagesResult -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/schedules_client.go b/sdk/resourcemanager/devcenter/armdevcenter/schedules_client.go index 09a85998ca1d..44046b126056 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/schedules_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/schedules_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -27,68 +25,61 @@ import ( // SchedulesClient contains the methods for the Schedules group. // Don't use this type directly, use NewSchedulesClient() instead. type SchedulesClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewSchedulesClient creates a new instance of SchedulesClient 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. +// - 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 NewSchedulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SchedulesClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".SchedulesClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &SchedulesClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // BeginCreateOrUpdate - Creates or updates a Schedule. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// projectName - The name of the project. -// poolName - Name of the pool. -// scheduleName - The name of the schedule that uniquely identifies it. -// body - Represents a scheduled task -// options - SchedulesClientBeginCreateOrUpdateOptions contains the optional parameters for the SchedulesClient.BeginCreateOrUpdate -// method. +// +// Generated from API version 2023-01-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. +// - scheduleName - The name of the schedule that uniquely identifies it. +// - body - Represents a scheduled task +// - options - SchedulesClientBeginCreateOrUpdateOptions contains the optional parameters for the SchedulesClient.BeginCreateOrUpdate +// method. func (client *SchedulesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, projectName string, poolName string, scheduleName string, body Schedule, options *SchedulesClientBeginCreateOrUpdateOptions) (*runtime.Poller[SchedulesClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, projectName, poolName, scheduleName, body, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SchedulesClientCreateOrUpdateResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SchedulesClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[SchedulesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[SchedulesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // CreateOrUpdate - Creates or updates a Schedule. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview +// +// Generated from API version 2023-01-01-preview func (client *SchedulesClient) createOrUpdate(ctx context.Context, resourceGroupName string, projectName string, poolName string, scheduleName string, body Schedule, options *SchedulesClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, projectName, poolName, scheduleName, body, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -121,12 +112,12 @@ func (client *SchedulesClient) createOrUpdateCreateRequest(ctx context.Context, return nil, errors.New("parameter scheduleName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{scheduleName}", url.PathEscape(scheduleName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } @@ -137,35 +128,37 @@ 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 2022-11-11-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// projectName - The name of the project. -// poolName - Name of the pool. -// scheduleName - The name of the schedule that uniquely identifies it. -// options - SchedulesClientBeginDeleteOptions contains the optional parameters for the SchedulesClient.BeginDelete method. +// +// Generated from API version 2023-01-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. +// - scheduleName - The name of the schedule that uniquely identifies it. +// - options - SchedulesClientBeginDeleteOptions contains the optional parameters for the SchedulesClient.BeginDelete method. func (client *SchedulesClient) BeginDelete(ctx context.Context, resourceGroupName string, projectName string, poolName string, scheduleName string, options *SchedulesClientBeginDeleteOptions) (*runtime.Poller[SchedulesClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, projectName, poolName, scheduleName, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SchedulesClientDeleteResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SchedulesClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[SchedulesClientDeleteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[SchedulesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Delete - Deletes a Scheduled. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview +// +// Generated from API version 2023-01-01-preview func (client *SchedulesClient) deleteOperation(ctx context.Context, resourceGroupName string, projectName string, poolName string, scheduleName string, options *SchedulesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, projectName, poolName, scheduleName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -198,12 +191,12 @@ func (client *SchedulesClient) deleteCreateRequest(ctx context.Context, resource return nil, errors.New("parameter scheduleName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{scheduleName}", url.PathEscape(scheduleName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } @@ -214,18 +207,19 @@ 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 2022-11-11-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// projectName - The name of the project. -// poolName - Name of the pool. -// scheduleName - The name of the schedule that uniquely identifies it. -// options - SchedulesClientGetOptions contains the optional parameters for the SchedulesClient.Get method. +// +// Generated from API version 2023-01-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. +// - scheduleName - The name of the schedule that uniquely identifies it. +// - options - SchedulesClientGetOptions contains the optional parameters for the SchedulesClient.Get method. func (client *SchedulesClient) Get(ctx context.Context, resourceGroupName string, projectName string, poolName string, scheduleName string, options *SchedulesClientGetOptions) (SchedulesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, poolName, scheduleName, options) if err != nil { return SchedulesClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return SchedulesClientGetResponse{}, err } @@ -258,12 +252,12 @@ func (client *SchedulesClient) getCreateRequest(ctx context.Context, resourceGro return nil, errors.New("parameter scheduleName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{scheduleName}", url.PathEscape(scheduleName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } @@ -282,11 +276,13 @@ func (client *SchedulesClient) getHandleResponse(resp *http.Response) (Schedules } // NewListByPoolPager - Lists schedules for a pool -// Generated from API version 2022-11-11-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// projectName - The name of the project. -// poolName - Name of the pool. -// options - SchedulesClientListByPoolOptions contains the optional parameters for the SchedulesClient.ListByPool method. +// +// Generated from API version 2023-01-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. +// - options - SchedulesClientListByPoolOptions contains the optional parameters for the SchedulesClient.NewListByPoolPager +// method. func (client *SchedulesClient) NewListByPoolPager(resourceGroupName string, projectName string, poolName string, options *SchedulesClientListByPoolOptions) *runtime.Pager[SchedulesClientListByPoolResponse] { return runtime.NewPager(runtime.PagingHandler[SchedulesClientListByPoolResponse]{ More: func(page SchedulesClientListByPoolResponse) bool { @@ -303,7 +299,7 @@ func (client *SchedulesClient) NewListByPoolPager(resourceGroupName string, proj if err != nil { return SchedulesClientListByPoolResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return SchedulesClientListByPoolResponse{}, err } @@ -334,12 +330,12 @@ func (client *SchedulesClient) listByPoolCreateRequest(ctx context.Context, reso return nil, errors.New("parameter poolName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } @@ -359,36 +355,38 @@ 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 2022-11-11-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// projectName - The name of the project. -// poolName - Name of the pool. -// scheduleName - The name of the schedule that uniquely identifies it. -// body - Represents a scheduled task. -// options - SchedulesClientBeginUpdateOptions contains the optional parameters for the SchedulesClient.BeginUpdate method. +// +// Generated from API version 2023-01-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. +// - scheduleName - The name of the schedule that uniquely identifies it. +// - body - Represents a scheduled task. +// - options - SchedulesClientBeginUpdateOptions contains the optional parameters for the SchedulesClient.BeginUpdate method. func (client *SchedulesClient) BeginUpdate(ctx context.Context, resourceGroupName string, projectName string, poolName string, scheduleName string, body ScheduleUpdate, options *SchedulesClientBeginUpdateOptions) (*runtime.Poller[SchedulesClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.update(ctx, resourceGroupName, projectName, poolName, scheduleName, body, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SchedulesClientUpdateResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SchedulesClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[SchedulesClientUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[SchedulesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Update - Partially updates a Scheduled. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-11-preview +// +// Generated from API version 2023-01-01-preview func (client *SchedulesClient) update(ctx context.Context, resourceGroupName string, projectName string, poolName string, scheduleName string, body ScheduleUpdate, options *SchedulesClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, projectName, poolName, scheduleName, body, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -421,12 +419,12 @@ func (client *SchedulesClient) updateCreateRequest(ctx context.Context, resource return nil, errors.New("parameter scheduleName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{scheduleName}", url.PathEscape(scheduleName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } 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 e9f1961555bd..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/schedules_client_example_test.go +++ /dev/null @@ -1,140 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewSchedulesClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByPoolPager("rg1", "TestProject", "DevPool", &armdevcenter.SchedulesClientListByPoolOptions{Top: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewSchedulesClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "rg1", "TestProject", "DevPool", "autoShutdown", &armdevcenter.SchedulesClientGetOptions{Top: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewSchedulesClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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.EnableStatusEnabled), - 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewSchedulesClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewSchedulesClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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 4e77048dc3d4..a3350897fcd9 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/skus_client.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/skus_client.go @@ -14,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -27,38 +25,31 @@ import ( // SKUsClient contains the methods for the SKUs group. // Don't use this type directly, use NewSKUsClient() instead. type SKUsClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewSKUsClient creates a new instance of SKUsClient 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. +// - 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 NewSKUsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SKUsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".SKUsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &SKUsClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // NewListBySubscriptionPager - Lists the Microsoft.DevCenter SKUs available in a subscription -// Generated from API version 2022-11-11-preview -// options - SKUsClientListBySubscriptionOptions contains the optional parameters for the SKUsClient.ListBySubscription method. +// +// Generated from API version 2023-01-01-preview +// - options - SKUsClientListBySubscriptionOptions contains the optional parameters for the SKUsClient.NewListBySubscriptionPager +// method. func (client *SKUsClient) NewListBySubscriptionPager(options *SKUsClientListBySubscriptionOptions) *runtime.Pager[SKUsClientListBySubscriptionResponse] { return runtime.NewPager(runtime.PagingHandler[SKUsClientListBySubscriptionResponse]{ More: func(page SKUsClientListBySubscriptionResponse) bool { @@ -75,7 +66,7 @@ func (client *SKUsClient) NewListBySubscriptionPager(options *SKUsClientListBySu if err != nil { return SKUsClientListBySubscriptionResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return SKUsClientListBySubscriptionResponse{}, err } @@ -94,12 +85,12 @@ func (client *SKUsClient) listBySubscriptionCreateRequest(ctx context.Context, o 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.host, urlPath)) + 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", "2022-11-11-preview") + reqQP.Set("api-version", "2023-01-01-preview") if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } 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 d5829c8f7e2c..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/skus_client_example_test.go +++ /dev/null @@ -1,41 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewSKUsClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(&armdevcenter.SKUsClientListBySubscriptionOptions{Top: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/devcenter/armdevcenter/time_rfc3339.go b/sdk/resourcemanager/devcenter/armdevcenter/time_rfc3339.go index 38cf1ddfbb72..f487d5beae04 100644 --- a/sdk/resourcemanager/devcenter/armdevcenter/time_rfc3339.go +++ b/sdk/resourcemanager/devcenter/armdevcenter/time_rfc3339.go @@ -62,7 +62,7 @@ func (t *timeRFC3339) Parse(layout, value string) error { return err } -func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { +func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) { diff --git a/sdk/resourcemanager/devcenter/armdevcenter/usages_client.go b/sdk/resourcemanager/devcenter/armdevcenter/usages_client.go deleted file mode 100644 index d44587e75860..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/usages_client.go +++ /dev/null @@ -1,119 +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 - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "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" -) - -// UsagesClient contains the methods for the Usages group. -// Don't use this type directly, use NewUsagesClient() instead. -type UsagesClient struct { - host string - subscriptionID string - pl runtime.Pipeline -} - -// NewUsagesClient creates a new instance of UsagesClient 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 NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UsagesClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &UsagesClient{ - subscriptionID: subscriptionID, - host: ep, - pl: pl, - } - return client, nil -} - -// NewListByLocationPager - Lists the current usages and limits in this location for the provided subscription. -// Generated from API version 2022-11-11-preview -// location - The Azure region -// options - UsagesClientListByLocationOptions contains the optional parameters for the UsagesClient.ListByLocation method. -func (client *UsagesClient) NewListByLocationPager(location string, options *UsagesClientListByLocationOptions) *runtime.Pager[UsagesClientListByLocationResponse] { - return runtime.NewPager(runtime.PagingHandler[UsagesClientListByLocationResponse]{ - More: func(page UsagesClientListByLocationResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *UsagesClientListByLocationResponse) (UsagesClientListByLocationResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByLocationCreateRequest(ctx, location, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return UsagesClientListByLocationResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return UsagesClientListByLocationResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return UsagesClientListByLocationResponse{}, runtime.NewResponseError(resp) - } - return client.listByLocationHandleResponse(resp) - }, - }) -} - -// listByLocationCreateRequest creates the ListByLocation request. -func (client *UsagesClient) listByLocationCreateRequest(ctx context.Context, location string, options *UsagesClientListByLocationOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DevCenter/locations/{location}/usages" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if location == "" { - return nil, errors.New("parameter location cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-11-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByLocationHandleResponse handles the ListByLocation response. -func (client *UsagesClient) listByLocationHandleResponse(resp *http.Response) (UsagesClientListByLocationResponse, error) { - result := UsagesClientListByLocationResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ListUsagesResult); err != nil { - return UsagesClientListByLocationResponse{}, err - } - return result, 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 8c83b868f13f..000000000000 --- a/sdk/resourcemanager/devcenter/armdevcenter/usages_client_example_test.go +++ /dev/null @@ -1,41 +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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/devcenter/resource-manager/Microsoft.DevCenter/preview/2022-11-11-preview/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() - client, err := armdevcenter.NewUsagesClient("0ac520ee-14c0-480f-b6c9-0a90c58ffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByLocationPager("westus", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -}