From 858ca87c6dd8cd53816e94bfb762c7cd120d68b8 Mon Sep 17 00:00:00 2001 From: ReleaseHelper Date: Sat, 9 Sep 2023 01:15:38 +0000 Subject: [PATCH 1/6] [Release] sdk/resourcemanager/containerregistry/armcontainerregistry/1.1.0-beta.4 generation from spec commit: bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd --- .../armcontainerregistry/CHANGELOG.md | 89 + .../agentpools_client_example_test.go | 12 +- .../armcontainerregistry/autorest.md | 7 +- .../armcontainerregistry/cacherules_client.go | 28 +- .../cacherules_client_example_test.go | 10 +- .../armcontainerregistry/client_factory.go | 20 - .../connectedregistries_client.go | 494 ----- ...connectedregistries_client_example_test.go | 302 --- .../armcontainerregistry/constants.go | 203 +- .../credentialsets_client.go | 28 +- .../credentialsets_client_example_test.go | 10 +- .../exportpipelines_client.go | 335 ---- .../exportpipelines_client_example_test.go | 189 -- .../fake/cacherules_server.go | 6 +- .../fake/connectedregistries_server.go | 400 ---- .../fake/credentialsets_server.go | 6 +- .../fake/exportpipelines_server.go | 272 --- .../fake/importpipelines_server.go | 272 --- .../fake/pipelineruns_server.go | 272 --- .../armcontainerregistry/go.mod | 2 +- .../importpipelines_client.go | 335 ---- .../importpipelines_client_example_test.go | 227 --- .../armcontainerregistry/models.go | 540 +----- .../armcontainerregistry/models_serde.go | 1677 +++-------------- .../armcontainerregistry/operations_client.go | 4 +- .../operations_client_example_test.go | 2 +- .../armcontainerregistry/options.go | 107 -- .../pipelineruns_client.go | 334 ---- .../pipelineruns_client_example_test.go | 296 --- .../privateendpointconnections_client.go | 20 +- ...endpointconnections_client_example_test.go | 8 +- .../armcontainerregistry/registries_client.go | 66 +- .../registries_client_example_test.go | 58 +- .../replications_client.go | 26 +- .../replications_client_example_test.go | 12 +- .../armcontainerregistry/response_types.go | 103 - .../runs_client_example_test.go | 10 +- .../armcontainerregistry/scopemaps_client.go | 26 +- .../scopemaps_client_example_test.go | 10 +- .../taskruns_client_example_test.go | 12 +- .../tasks_client_example_test.go | 28 +- .../armcontainerregistry/tokens_client.go | 26 +- .../tokens_client_example_test.go | 10 +- .../armcontainerregistry/webhooks_client.go | 38 +- .../webhooks_client_example_test.go | 22 +- 45 files changed, 610 insertions(+), 6344 deletions(-) delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/connectedregistries_client.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/connectedregistries_client_example_test.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/exportpipelines_client.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/exportpipelines_client_example_test.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/fake/connectedregistries_server.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/fake/exportpipelines_server.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/fake/importpipelines_server.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/fake/pipelineruns_server.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/importpipelines_client.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/importpipelines_client_example_test.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/pipelineruns_client.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/pipelineruns_client_example_test.go diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/CHANGELOG.md b/sdk/resourcemanager/containerregistry/armcontainerregistry/CHANGELOG.md index 1d61c6f9adba..2ad3730f7f80 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/CHANGELOG.md +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/CHANGELOG.md @@ -1,5 +1,94 @@ # Release History +## 1.1.0-beta.4 (2023-09-22) +### Breaking Changes + +- Type of `ErrorResponse.Error` has been changed from `*ErrorResponseBody` to `*ErrorDetail` +- Enum `ActivationStatus` has been removed +- Enum `AuditLogStatus` has been removed +- Enum `AzureADAuthenticationAsArmPolicyStatus` has been removed +- Enum `CertificateType` has been removed +- Enum `ConnectedRegistryMode` has been removed +- Enum `ConnectionState` has been removed +- Enum `LogLevel` has been removed +- Enum `PipelineOptions` has been removed +- Enum `PipelineRunSourceType` has been removed +- Enum `PipelineRunTargetType` has been removed +- Enum `PipelineSourceType` has been removed +- Enum `TLSStatus` has been removed +- Function `*ClientFactory.NewConnectedRegistriesClient` has been removed +- Function `*ClientFactory.NewExportPipelinesClient` has been removed +- Function `*ClientFactory.NewImportPipelinesClient` has been removed +- Function `*ClientFactory.NewPipelineRunsClient` has been removed +- Function `NewConnectedRegistriesClient` has been removed +- Function `*ConnectedRegistriesClient.BeginCreate` has been removed +- Function `*ConnectedRegistriesClient.BeginDeactivate` has been removed +- Function `*ConnectedRegistriesClient.BeginDelete` has been removed +- Function `*ConnectedRegistriesClient.Get` has been removed +- Function `*ConnectedRegistriesClient.NewListPager` has been removed +- Function `*ConnectedRegistriesClient.BeginUpdate` has been removed +- Function `NewExportPipelinesClient` has been removed +- Function `*ExportPipelinesClient.BeginCreate` has been removed +- Function `*ExportPipelinesClient.BeginDelete` has been removed +- Function `*ExportPipelinesClient.Get` has been removed +- Function `*ExportPipelinesClient.NewListPager` has been removed +- Function `NewImportPipelinesClient` has been removed +- Function `*ImportPipelinesClient.BeginCreate` has been removed +- Function `*ImportPipelinesClient.BeginDelete` has been removed +- Function `*ImportPipelinesClient.Get` has been removed +- Function `*ImportPipelinesClient.NewListPager` has been removed +- Function `NewPipelineRunsClient` has been removed +- Function `*PipelineRunsClient.BeginCreate` has been removed +- Function `*PipelineRunsClient.BeginDelete` has been removed +- Function `*PipelineRunsClient.Get` has been removed +- Function `*PipelineRunsClient.NewListPager` has been removed +- Struct `ActivationProperties` has been removed +- Struct `AzureADAuthenticationAsArmPolicy` has been removed +- Struct `ConnectedRegistry` has been removed +- Struct `ConnectedRegistryListResult` has been removed +- Struct `ConnectedRegistryProperties` has been removed +- Struct `ConnectedRegistryUpdateParameters` has been removed +- Struct `ConnectedRegistryUpdateProperties` has been removed +- Struct `ExportPipeline` has been removed +- Struct `ExportPipelineListResult` has been removed +- Struct `ExportPipelineProperties` has been removed +- Struct `ExportPipelineTargetProperties` has been removed +- Struct `ImportPipeline` has been removed +- Struct `ImportPipelineListResult` has been removed +- Struct `ImportPipelineProperties` has been removed +- Struct `ImportPipelineSourceProperties` has been removed +- Struct `LoggingProperties` has been removed +- Struct `LoginServerProperties` has been removed +- Struct `ParentProperties` has been removed +- Struct `PipelineRun` has been removed +- Struct `PipelineRunListResult` has been removed +- Struct `PipelineRunProperties` has been removed +- Struct `PipelineRunRequest` has been removed +- Struct `PipelineRunResponse` has been removed +- Struct `PipelineRunSourceProperties` has been removed +- Struct `PipelineRunTargetProperties` has been removed +- Struct `PipelineSourceTriggerDescriptor` has been removed +- Struct `PipelineSourceTriggerProperties` has been removed +- Struct `PipelineTriggerDescriptor` has been removed +- Struct `PipelineTriggerProperties` has been removed +- Struct `ProgressProperties` has been removed +- Struct `SoftDeletePolicy` has been removed +- Struct `StatusDetailProperties` has been removed +- Struct `SyncProperties` has been removed +- Struct `SyncUpdateProperties` has been removed +- Struct `TLSCertificateProperties` has been removed +- Struct `TLSProperties` has been removed +- Field `AzureADAuthenticationAsArmPolicy`, `SoftDeletePolicy` of struct `Policies` has been removed +- Field `AnonymousPullEnabled` of struct `RegistryProperties` has been removed +- Field `AnonymousPullEnabled` of struct `RegistryPropertiesUpdateParameters` has been removed + +### Features Added + +- New struct `ErrorAdditionalInfo` +- New struct `ErrorDetail` +- New struct `ErrorResponseForContainerRegistry` + + ## 1.1.0-beta.3 (2023-07-19) ### Bug Fixes diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/agentpools_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/agentpools_client_example_test.go index 97a427859a0b..b17a83e2dc77 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/agentpools_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/agentpools_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/AgentPoolsGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/AgentPoolsGet.json func ExampleAgentPoolsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -50,7 +50,7 @@ func ExampleAgentPoolsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/AgentPoolsCreate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/AgentPoolsCreate.json func ExampleAgentPoolsClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -96,7 +96,7 @@ func ExampleAgentPoolsClient_BeginCreate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/AgentPoolsDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/AgentPoolsDelete.json func ExampleAgentPoolsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -117,7 +117,7 @@ func ExampleAgentPoolsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/AgentPoolsUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/AgentPoolsUpdate.json func ExampleAgentPoolsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -157,7 +157,7 @@ func ExampleAgentPoolsClient_BeginUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/AgentPoolsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/AgentPoolsList.json func ExampleAgentPoolsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -197,7 +197,7 @@ func ExampleAgentPoolsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/AgentPoolsGetQueueStatus.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/AgentPoolsGetQueueStatus.json func ExampleAgentPoolsClient_GetQueueStatus() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/autorest.md b/sdk/resourcemanager/containerregistry/armcontainerregistry/autorest.md index 7fc47482764d..b82fcccfb0f0 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/autorest.md +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/autorest.md @@ -5,12 +5,13 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION module: github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry -module-version: 1.1.0-beta.3 +module-version: 1.1.0-beta.4 azcore-version: 1.8.0-beta.1 generate-fakes: true inject-spans: true +tag: package-2023-07 ``` diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client.go index 2878954f63a2..fdf45cef1c57 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client.go @@ -46,7 +46,7 @@ func NewCacheRulesClient(subscriptionID string, credential azcore.TokenCredentia // BeginCreate - Creates a cache rule for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - cacheRuleName - The name of the cache rule. @@ -70,7 +70,7 @@ func (client *CacheRulesClient) BeginCreate(ctx context.Context, resourceGroupNa // Create - Creates a cache rule for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *CacheRulesClient) create(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, cacheRuleCreateParameters CacheRule, options *CacheRulesClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "CacheRulesClient.BeginCreate" @@ -113,7 +113,7 @@ func (client *CacheRulesClient) createCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, cacheRuleCreateParameters); err != nil { @@ -125,7 +125,7 @@ func (client *CacheRulesClient) createCreateRequest(ctx context.Context, resourc // BeginDelete - Deletes a cache rule resource from a container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - cacheRuleName - The name of the cache rule. @@ -148,7 +148,7 @@ func (client *CacheRulesClient) BeginDelete(ctx context.Context, resourceGroupNa // Delete - Deletes a cache rule resource from a container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *CacheRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, options *CacheRulesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "CacheRulesClient.BeginDelete" @@ -163,7 +163,7 @@ func (client *CacheRulesClient) deleteOperation(ctx context.Context, resourceGro if err != nil { return nil, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { err = runtime.NewResponseError(httpResp) return nil, err } @@ -191,7 +191,7 @@ func (client *CacheRulesClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -200,7 +200,7 @@ func (client *CacheRulesClient) deleteCreateRequest(ctx context.Context, resourc // Get - Gets the properties of the specified cache rule resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - cacheRuleName - The name of the cache rule. @@ -248,7 +248,7 @@ func (client *CacheRulesClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -265,7 +265,7 @@ func (client *CacheRulesClient) getHandleResponse(resp *http.Response) (CacheRul // NewListPager - Lists all cache rule resources for the specified container registry. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - options - CacheRulesClientListOptions contains the optional parameters for the CacheRulesClient.NewListPager method. @@ -316,7 +316,7 @@ func (client *CacheRulesClient) listCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -334,7 +334,7 @@ func (client *CacheRulesClient) listHandleResponse(resp *http.Response) (CacheRu // BeginUpdate - Updates a cache rule for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - cacheRuleName - The name of the cache rule. @@ -358,7 +358,7 @@ func (client *CacheRulesClient) BeginUpdate(ctx context.Context, resourceGroupNa // Update - Updates a cache rule for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *CacheRulesClient) update(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, cacheRuleUpdateParameters CacheRuleUpdateParameters, options *CacheRulesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "CacheRulesClient.BeginUpdate" @@ -401,7 +401,7 @@ func (client *CacheRulesClient) updateCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, cacheRuleUpdateParameters); err != nil { diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client_example_test.go index 03cfd49e22ca..7ec730c04c61 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/CacheRuleList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/CacheRuleList.json func ExampleCacheRulesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -58,7 +58,7 @@ func ExampleCacheRulesClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/CacheRuleGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/CacheRuleGet.json func ExampleCacheRulesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -90,7 +90,7 @@ func ExampleCacheRulesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/CacheRuleCreate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/CacheRuleCreate.json func ExampleCacheRulesClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -132,7 +132,7 @@ func ExampleCacheRulesClient_BeginCreate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/CacheRuleDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/CacheRuleDelete.json func ExampleCacheRulesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -153,7 +153,7 @@ func ExampleCacheRulesClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/CacheRuleUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/CacheRuleUpdate.json func ExampleCacheRulesClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/client_factory.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/client_factory.go index acfab33500ae..1dc80c7ad9af 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/client_factory.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/client_factory.go @@ -47,36 +47,16 @@ func (c *ClientFactory) NewCacheRulesClient() *CacheRulesClient { return subClient } -func (c *ClientFactory) NewConnectedRegistriesClient() *ConnectedRegistriesClient { - subClient, _ := NewConnectedRegistriesClient(c.subscriptionID, c.credential, c.options) - return subClient -} - func (c *ClientFactory) NewCredentialSetsClient() *CredentialSetsClient { subClient, _ := NewCredentialSetsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewExportPipelinesClient() *ExportPipelinesClient { - subClient, _ := NewExportPipelinesClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -func (c *ClientFactory) NewImportPipelinesClient() *ImportPipelinesClient { - subClient, _ := NewImportPipelinesClient(c.subscriptionID, c.credential, c.options) - return subClient -} - func (c *ClientFactory) NewOperationsClient() *OperationsClient { subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewPipelineRunsClient() *PipelineRunsClient { - subClient, _ := NewPipelineRunsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) return subClient diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/connectedregistries_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/connectedregistries_client.go deleted file mode 100644 index dab2285fd747..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/connectedregistries_client.go +++ /dev/null @@ -1,494 +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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcontainerregistry - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// ConnectedRegistriesClient contains the methods for the ConnectedRegistries group. -// Don't use this type directly, use NewConnectedRegistriesClient() instead. -type ConnectedRegistriesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewConnectedRegistriesClient creates a new instance of ConnectedRegistriesClient with the specified values. -// - subscriptionID - The ID of the target subscription. The value must be an UUID. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewConnectedRegistriesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConnectedRegistriesClient, error) { - cl, err := arm.NewClient(moduleName+".ConnectedRegistriesClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ConnectedRegistriesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginCreate - Creates a connected registry for a container registry with the specified parameters. -// 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. -// - registryName - The name of the container registry. -// - connectedRegistryName - The name of the connected registry. -// - connectedRegistryCreateParameters - The parameters for creating a connectedRegistry. -// - options - ConnectedRegistriesClientBeginCreateOptions contains the optional parameters for the ConnectedRegistriesClient.BeginCreate -// method. -func (client *ConnectedRegistriesClient) BeginCreate(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryCreateParameters ConnectedRegistry, options *ConnectedRegistriesClientBeginCreateOptions) (*runtime.Poller[ConnectedRegistriesClientCreateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, registryName, connectedRegistryName, connectedRegistryCreateParameters, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ConnectedRegistriesClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken[ConnectedRegistriesClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Create - Creates a connected registry for a container registry with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -func (client *ConnectedRegistriesClient) create(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryCreateParameters ConnectedRegistry, options *ConnectedRegistriesClientBeginCreateOptions) (*http.Response, error) { - var err error - const operationName = "ConnectedRegistriesClient.BeginCreate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, connectedRegistryName, connectedRegistryCreateParameters, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// createCreateRequest creates the Create request. -func (client *ConnectedRegistriesClient) createCreateRequest(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryCreateParameters ConnectedRegistry, options *ConnectedRegistriesClientBeginCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}" - 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 registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - if connectedRegistryName == "" { - return nil, errors.New("parameter connectedRegistryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{connectedRegistryName}", url.PathEscape(connectedRegistryName)) - 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", "2023-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, connectedRegistryCreateParameters); err != nil { - return nil, err - } - return req, nil -} - -// BeginDeactivate - Deactivates the connected registry instance. -// 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. -// - registryName - The name of the container registry. -// - connectedRegistryName - The name of the connected registry. -// - options - ConnectedRegistriesClientBeginDeactivateOptions contains the optional parameters for the ConnectedRegistriesClient.BeginDeactivate -// method. -func (client *ConnectedRegistriesClient) BeginDeactivate(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, options *ConnectedRegistriesClientBeginDeactivateOptions) (*runtime.Poller[ConnectedRegistriesClientDeactivateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deactivate(ctx, resourceGroupName, registryName, connectedRegistryName, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ConnectedRegistriesClientDeactivateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken[ConnectedRegistriesClientDeactivateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Deactivate - Deactivates the connected registry instance. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -func (client *ConnectedRegistriesClient) deactivate(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, options *ConnectedRegistriesClientBeginDeactivateOptions) (*http.Response, error) { - var err error - const operationName = "ConnectedRegistriesClient.BeginDeactivate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deactivateCreateRequest(ctx, resourceGroupName, registryName, connectedRegistryName, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// deactivateCreateRequest creates the Deactivate request. -func (client *ConnectedRegistriesClient) deactivateCreateRequest(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, options *ConnectedRegistriesClientBeginDeactivateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}/deactivate" - 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 registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - if connectedRegistryName == "" { - return nil, errors.New("parameter connectedRegistryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{connectedRegistryName}", url.PathEscape(connectedRegistryName)) - 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 -} - -// BeginDelete - Deletes a connected registry from a container registry. -// 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. -// - registryName - The name of the container registry. -// - connectedRegistryName - The name of the connected registry. -// - options - ConnectedRegistriesClientBeginDeleteOptions contains the optional parameters for the ConnectedRegistriesClient.BeginDelete -// method. -func (client *ConnectedRegistriesClient) BeginDelete(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, options *ConnectedRegistriesClientBeginDeleteOptions) (*runtime.Poller[ConnectedRegistriesClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, registryName, connectedRegistryName, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ConnectedRegistriesClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken[ConnectedRegistriesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Delete - Deletes a connected registry from a container registry. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -func (client *ConnectedRegistriesClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, options *ConnectedRegistriesClientBeginDeleteOptions) (*http.Response, error) { - var err error - const operationName = "ConnectedRegistriesClient.BeginDelete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, connectedRegistryName, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *ConnectedRegistriesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, options *ConnectedRegistriesClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}" - 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 registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - if connectedRegistryName == "" { - return nil, errors.New("parameter connectedRegistryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{connectedRegistryName}", url.PathEscape(connectedRegistryName)) - 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", "2023-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Gets the properties of the connected registry. -// 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. -// - registryName - The name of the container registry. -// - connectedRegistryName - The name of the connected registry. -// - options - ConnectedRegistriesClientGetOptions contains the optional parameters for the ConnectedRegistriesClient.Get method. -func (client *ConnectedRegistriesClient) Get(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, options *ConnectedRegistriesClientGetOptions) (ConnectedRegistriesClientGetResponse, error) { - var err error - const operationName = "ConnectedRegistriesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, connectedRegistryName, options) - if err != nil { - return ConnectedRegistriesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ConnectedRegistriesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ConnectedRegistriesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ConnectedRegistriesClient) getCreateRequest(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, options *ConnectedRegistriesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}" - 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 registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - if connectedRegistryName == "" { - return nil, errors.New("parameter connectedRegistryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{connectedRegistryName}", url.PathEscape(connectedRegistryName)) - 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") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ConnectedRegistriesClient) getHandleResponse(resp *http.Response) (ConnectedRegistriesClientGetResponse, error) { - result := ConnectedRegistriesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ConnectedRegistry); err != nil { - return ConnectedRegistriesClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Lists all connected registries for the specified container registry. -// -// Generated from API version 2023-01-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - registryName - The name of the container registry. -// - options - ConnectedRegistriesClientListOptions contains the optional parameters for the ConnectedRegistriesClient.NewListPager -// method. -func (client *ConnectedRegistriesClient) NewListPager(resourceGroupName string, registryName string, options *ConnectedRegistriesClientListOptions) *runtime.Pager[ConnectedRegistriesClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[ConnectedRegistriesClientListResponse]{ - More: func(page ConnectedRegistriesClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ConnectedRegistriesClientListResponse) (ConnectedRegistriesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ConnectedRegistriesClient.NewListPager") - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, resourceGroupName, registryName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ConnectedRegistriesClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ConnectedRegistriesClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ConnectedRegistriesClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *ConnectedRegistriesClient) listCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *ConnectedRegistriesClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries" - 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 registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - 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.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *ConnectedRegistriesClient) listHandleResponse(resp *http.Response) (ConnectedRegistriesClientListResponse, error) { - result := ConnectedRegistriesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ConnectedRegistryListResult); err != nil { - return ConnectedRegistriesClientListResponse{}, err - } - return result, nil -} - -// BeginUpdate - Updates a connected registry with the specified parameters. -// 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. -// - registryName - The name of the container registry. -// - connectedRegistryName - The name of the connected registry. -// - connectedRegistryUpdateParameters - The parameters for updating a connectedRegistry. -// - options - ConnectedRegistriesClientBeginUpdateOptions contains the optional parameters for the ConnectedRegistriesClient.BeginUpdate -// method. -func (client *ConnectedRegistriesClient) BeginUpdate(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryUpdateParameters ConnectedRegistryUpdateParameters, options *ConnectedRegistriesClientBeginUpdateOptions) (*runtime.Poller[ConnectedRegistriesClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, registryName, connectedRegistryName, connectedRegistryUpdateParameters, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ConnectedRegistriesClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken[ConnectedRegistriesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Update - Updates a connected registry with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -func (client *ConnectedRegistriesClient) update(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryUpdateParameters ConnectedRegistryUpdateParameters, options *ConnectedRegistriesClientBeginUpdateOptions) (*http.Response, error) { - var err error - const operationName = "ConnectedRegistriesClient.BeginUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, connectedRegistryName, connectedRegistryUpdateParameters, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// updateCreateRequest creates the Update request. -func (client *ConnectedRegistriesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryUpdateParameters ConnectedRegistryUpdateParameters, options *ConnectedRegistriesClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}" - 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 registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - if connectedRegistryName == "" { - return nil, errors.New("parameter connectedRegistryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{connectedRegistryName}", url.PathEscape(connectedRegistryName)) - 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", "2023-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, connectedRegistryUpdateParameters); err != nil { - return nil, err - } - return req, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/connectedregistries_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/connectedregistries_client_example_test.go deleted file mode 100644 index 680d88753137..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/connectedregistries_client_example_test.go +++ /dev/null @@ -1,302 +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 armcontainerregistry_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/containerregistry/armcontainerregistry" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ConnectedRegistryList.json -func ExampleConnectedRegistriesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewConnectedRegistriesClient().NewListPager("myResourceGroup", "myRegistry", &armcontainerregistry.ConnectedRegistriesClientListOptions{Filter: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ConnectedRegistryListResult = armcontainerregistry.ConnectedRegistryListResult{ - // Value: []*armcontainerregistry.ConnectedRegistry{ - // { - // Name: to.Ptr("myConnectedRegistry"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/connectedRegistries"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/connectedRegistries/myConnectedRegistry"), - // Properties: &armcontainerregistry.ConnectedRegistryProperties{ - // Activation: &armcontainerregistry.ActivationProperties{ - // Status: to.Ptr(armcontainerregistry.ActivationStatusInactive), - // }, - // ClientTokenIDs: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/client1Token")}, - // Logging: &armcontainerregistry.LoggingProperties{ - // AuditLogStatus: to.Ptr(armcontainerregistry.AuditLogStatusDisabled), - // LogLevel: to.Ptr(armcontainerregistry.LogLevelInformation), - // }, - // Mode: to.Ptr(armcontainerregistry.ConnectedRegistryModeReadWrite), - // NotificationsList: []*string{ - // to.Ptr("hello-world:*:*"), - // to.Ptr("sample/repo/*:1.0:*")}, - // Parent: &armcontainerregistry.ParentProperties{ - // SyncProperties: &armcontainerregistry.SyncProperties{ - // MessageTTL: to.Ptr("P2D"), - // Schedule: to.Ptr("0 9 * * *"), - // SyncWindow: to.Ptr("PT3H"), - // TokenID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/syncToken"), - // }, - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ConnectedRegistryGet.json -func ExampleConnectedRegistriesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewConnectedRegistriesClient().Get(ctx, "myResourceGroup", "myRegistry", "myConnectedRegistry", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConnectedRegistry = armcontainerregistry.ConnectedRegistry{ - // Name: to.Ptr("myConnectedRegistry"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/connectedRegistries"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/connectedRegistries/myConnectedRegistry"), - // Properties: &armcontainerregistry.ConnectedRegistryProperties{ - // Activation: &armcontainerregistry.ActivationProperties{ - // Status: to.Ptr(armcontainerregistry.ActivationStatusInactive), - // }, - // ClientTokenIDs: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/client1Token")}, - // Logging: &armcontainerregistry.LoggingProperties{ - // AuditLogStatus: to.Ptr(armcontainerregistry.AuditLogStatusDisabled), - // LogLevel: to.Ptr(armcontainerregistry.LogLevelInformation), - // }, - // Mode: to.Ptr(armcontainerregistry.ConnectedRegistryModeReadWrite), - // NotificationsList: []*string{ - // to.Ptr("hello-world:*:*"), - // to.Ptr("sample/repo/*:1.0:*")}, - // Parent: &armcontainerregistry.ParentProperties{ - // SyncProperties: &armcontainerregistry.SyncProperties{ - // MessageTTL: to.Ptr("P2D"), - // Schedule: to.Ptr("0 9 * * *"), - // SyncWindow: to.Ptr("PT3H"), - // TokenID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/syncToken"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ConnectedRegistryCreate.json -func ExampleConnectedRegistriesClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConnectedRegistriesClient().BeginCreate(ctx, "myResourceGroup", "myRegistry", "myConnectedRegistry", armcontainerregistry.ConnectedRegistry{ - Properties: &armcontainerregistry.ConnectedRegistryProperties{ - ClientTokenIDs: []*string{ - to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/client1Token")}, - Mode: to.Ptr(armcontainerregistry.ConnectedRegistryModeReadWrite), - NotificationsList: []*string{ - to.Ptr("hello-world:*:*"), - to.Ptr("sample/repo/*:1.0:*")}, - Parent: &armcontainerregistry.ParentProperties{ - SyncProperties: &armcontainerregistry.SyncProperties{ - MessageTTL: to.Ptr("P2D"), - Schedule: to.Ptr("0 9 * * *"), - SyncWindow: to.Ptr("PT3H"), - TokenID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/syncToken"), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConnectedRegistry = armcontainerregistry.ConnectedRegistry{ - // Name: to.Ptr("myConnectedRegistry"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/connectedRegistries"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/connectedRegistries/myConnectedRegistry"), - // Properties: &armcontainerregistry.ConnectedRegistryProperties{ - // Activation: &armcontainerregistry.ActivationProperties{ - // Status: to.Ptr(armcontainerregistry.ActivationStatusInactive), - // }, - // ClientTokenIDs: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/client1Token")}, - // Logging: &armcontainerregistry.LoggingProperties{ - // AuditLogStatus: to.Ptr(armcontainerregistry.AuditLogStatusDisabled), - // LogLevel: to.Ptr(armcontainerregistry.LogLevelInformation), - // }, - // Mode: to.Ptr(armcontainerregistry.ConnectedRegistryModeReadWrite), - // NotificationsList: []*string{ - // to.Ptr("hello-world:*:*"), - // to.Ptr("sample/repo/*:1.0:*")}, - // Parent: &armcontainerregistry.ParentProperties{ - // SyncProperties: &armcontainerregistry.SyncProperties{ - // MessageTTL: to.Ptr("P2D"), - // Schedule: to.Ptr("0 9 * * *"), - // SyncWindow: to.Ptr("PT3H"), - // TokenID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/syncToken"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ConnectedRegistryDelete.json -func ExampleConnectedRegistriesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConnectedRegistriesClient().BeginDelete(ctx, "myResourceGroup", "myRegistry", "myConnectedRegistry", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ConnectedRegistryUpdate.json -func ExampleConnectedRegistriesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConnectedRegistriesClient().BeginUpdate(ctx, "myResourceGroup", "myRegistry", "myScopeMap", armcontainerregistry.ConnectedRegistryUpdateParameters{ - Properties: &armcontainerregistry.ConnectedRegistryUpdateProperties{ - ClientTokenIDs: []*string{ - to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/client1Token"), - to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/client2Token")}, - Logging: &armcontainerregistry.LoggingProperties{ - AuditLogStatus: to.Ptr(armcontainerregistry.AuditLogStatusEnabled), - LogLevel: to.Ptr(armcontainerregistry.LogLevelDebug), - }, - NotificationsList: []*string{ - to.Ptr("hello-world:*:*"), - to.Ptr("sample/repo/*:1.0:*")}, - SyncProperties: &armcontainerregistry.SyncUpdateProperties{ - MessageTTL: to.Ptr("P30D"), - Schedule: to.Ptr("0 0 */10 * *"), - SyncWindow: to.Ptr("P2D"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConnectedRegistry = armcontainerregistry.ConnectedRegistry{ - // Name: to.Ptr("myConnectedRegistry"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/connectedRegistries"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/connectedRegistries/myConnectedRegistry"), - // Properties: &armcontainerregistry.ConnectedRegistryProperties{ - // ClientTokenIDs: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/client1Token"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/client2Token")}, - // Logging: &armcontainerregistry.LoggingProperties{ - // AuditLogStatus: to.Ptr(armcontainerregistry.AuditLogStatusEnabled), - // LogLevel: to.Ptr(armcontainerregistry.LogLevelDebug), - // }, - // Mode: to.Ptr(armcontainerregistry.ConnectedRegistryModeReadWrite), - // NotificationsList: []*string{ - // to.Ptr("hello-world:*:*"), - // to.Ptr("sample/repo/*:1.0:*")}, - // Parent: &armcontainerregistry.ParentProperties{ - // SyncProperties: &armcontainerregistry.SyncProperties{ - // MessageTTL: to.Ptr("P30D"), - // Schedule: to.Ptr("0 0 */10 * *"), - // SyncWindow: to.Ptr("P2D"), - // TokenID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/syncToken"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ConnectedRegistryDeactivate.json -func ExampleConnectedRegistriesClient_BeginDeactivate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConnectedRegistriesClient().BeginDeactivate(ctx, "myResourceGroup", "myRegistry", "myConnectedRegistry", 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/containerregistry/armcontainerregistry/constants.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/constants.go index 563a9075534c..d7fa4a1f85c5 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/constants.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/constants.go @@ -10,7 +10,7 @@ package armcontainerregistry const ( moduleName = "armcontainerregistry" - moduleVersion = "v1.1.0-beta.3" + moduleVersion = "v1.1.0-beta.4" ) // Action - The action of IP ACL rule. @@ -43,22 +43,6 @@ func PossibleActionsRequiredValues() []ActionsRequired { } } -// ActivationStatus - The activation status of the connected registry. -type ActivationStatus string - -const ( - ActivationStatusActive ActivationStatus = "Active" - ActivationStatusInactive ActivationStatus = "Inactive" -) - -// PossibleActivationStatusValues returns the possible values for the ActivationStatus const type. -func PossibleActivationStatusValues() []ActivationStatus { - return []ActivationStatus{ - ActivationStatusActive, - ActivationStatusInactive, - } -} - // Architecture - The OS architecture. type Architecture string @@ -81,38 +65,6 @@ func PossibleArchitectureValues() []Architecture { } } -// AuditLogStatus - Indicates whether audit logs are enabled on the connected registry. -type AuditLogStatus string - -const ( - AuditLogStatusDisabled AuditLogStatus = "Disabled" - AuditLogStatusEnabled AuditLogStatus = "Enabled" -) - -// PossibleAuditLogStatusValues returns the possible values for the AuditLogStatus const type. -func PossibleAuditLogStatusValues() []AuditLogStatus { - return []AuditLogStatus{ - AuditLogStatusDisabled, - AuditLogStatusEnabled, - } -} - -// AzureADAuthenticationAsArmPolicyStatus - The value that indicates whether the policy is enabled or not. -type AzureADAuthenticationAsArmPolicyStatus string - -const ( - AzureADAuthenticationAsArmPolicyStatusDisabled AzureADAuthenticationAsArmPolicyStatus = "disabled" - AzureADAuthenticationAsArmPolicyStatusEnabled AzureADAuthenticationAsArmPolicyStatus = "enabled" -) - -// PossibleAzureADAuthenticationAsArmPolicyStatusValues returns the possible values for the AzureADAuthenticationAsArmPolicyStatus const type. -func PossibleAzureADAuthenticationAsArmPolicyStatusValues() []AzureADAuthenticationAsArmPolicyStatus { - return []AzureADAuthenticationAsArmPolicyStatus{ - AzureADAuthenticationAsArmPolicyStatusDisabled, - AzureADAuthenticationAsArmPolicyStatusEnabled, - } -} - // BaseImageDependencyType - The type of the base image dependency. type BaseImageDependencyType string @@ -145,60 +97,6 @@ func PossibleBaseImageTriggerTypeValues() []BaseImageTriggerType { } } -// CertificateType - The type of certificate location. -type CertificateType string - -const ( - CertificateTypeLocalDirectory CertificateType = "LocalDirectory" -) - -// PossibleCertificateTypeValues returns the possible values for the CertificateType const type. -func PossibleCertificateTypeValues() []CertificateType { - return []CertificateType{ - CertificateTypeLocalDirectory, - } -} - -// ConnectedRegistryMode - The mode of the connected registry resource that indicates the permissions of the registry. -type ConnectedRegistryMode string - -const ( - ConnectedRegistryModeMirror ConnectedRegistryMode = "Mirror" - ConnectedRegistryModeReadOnly ConnectedRegistryMode = "ReadOnly" - ConnectedRegistryModeReadWrite ConnectedRegistryMode = "ReadWrite" - ConnectedRegistryModeRegistry ConnectedRegistryMode = "Registry" -) - -// PossibleConnectedRegistryModeValues returns the possible values for the ConnectedRegistryMode const type. -func PossibleConnectedRegistryModeValues() []ConnectedRegistryMode { - return []ConnectedRegistryMode{ - ConnectedRegistryModeMirror, - ConnectedRegistryModeReadOnly, - ConnectedRegistryModeReadWrite, - ConnectedRegistryModeRegistry, - } -} - -// ConnectionState - The current connection state of the connected registry. -type ConnectionState string - -const ( - ConnectionStateOffline ConnectionState = "Offline" - ConnectionStateOnline ConnectionState = "Online" - ConnectionStateSyncing ConnectionState = "Syncing" - ConnectionStateUnhealthy ConnectionState = "Unhealthy" -) - -// PossibleConnectionStateValues returns the possible values for the ConnectionState const type. -func PossibleConnectionStateValues() []ConnectionState { - return []ConnectionState{ - ConnectionStateOffline, - ConnectionStateOnline, - ConnectionStateSyncing, - ConnectionStateUnhealthy, - } -} - // ConnectionStatus - The private link service connection status. type ConnectionStatus string @@ -354,28 +252,6 @@ func PossibleLastModifiedByTypeValues() []LastModifiedByType { } } -// LogLevel - The verbosity of logs persisted on the connected registry. -type LogLevel string - -const ( - LogLevelDebug LogLevel = "Debug" - LogLevelError LogLevel = "Error" - LogLevelInformation LogLevel = "Information" - LogLevelNone LogLevel = "None" - LogLevelWarning LogLevel = "Warning" -) - -// PossibleLogLevelValues returns the possible values for the LogLevel const type. -func PossibleLogLevelValues() []LogLevel { - return []LogLevel{ - LogLevelDebug, - LogLevelError, - LogLevelInformation, - LogLevelNone, - LogLevelWarning, - } -} - // NetworkRuleBypassOptions - Whether to allow trusted Azure services to access a network restricted registry. type NetworkRuleBypassOptions string @@ -424,67 +300,6 @@ func PossiblePasswordNameValues() []PasswordName { } } -type PipelineOptions string - -const ( - PipelineOptionsContinueOnErrors PipelineOptions = "ContinueOnErrors" - PipelineOptionsDeleteSourceBlobOnSuccess PipelineOptions = "DeleteSourceBlobOnSuccess" - PipelineOptionsOverwriteBlobs PipelineOptions = "OverwriteBlobs" - PipelineOptionsOverwriteTags PipelineOptions = "OverwriteTags" -) - -// PossiblePipelineOptionsValues returns the possible values for the PipelineOptions const type. -func PossiblePipelineOptionsValues() []PipelineOptions { - return []PipelineOptions{ - PipelineOptionsContinueOnErrors, - PipelineOptionsDeleteSourceBlobOnSuccess, - PipelineOptionsOverwriteBlobs, - PipelineOptionsOverwriteTags, - } -} - -// PipelineRunSourceType - The type of the source. -type PipelineRunSourceType string - -const ( - PipelineRunSourceTypeAzureStorageBlob PipelineRunSourceType = "AzureStorageBlob" -) - -// PossiblePipelineRunSourceTypeValues returns the possible values for the PipelineRunSourceType const type. -func PossiblePipelineRunSourceTypeValues() []PipelineRunSourceType { - return []PipelineRunSourceType{ - PipelineRunSourceTypeAzureStorageBlob, - } -} - -// PipelineRunTargetType - The type of the target. -type PipelineRunTargetType string - -const ( - PipelineRunTargetTypeAzureStorageBlob PipelineRunTargetType = "AzureStorageBlob" -) - -// PossiblePipelineRunTargetTypeValues returns the possible values for the PipelineRunTargetType const type. -func PossiblePipelineRunTargetTypeValues() []PipelineRunTargetType { - return []PipelineRunTargetType{ - PipelineRunTargetTypeAzureStorageBlob, - } -} - -// PipelineSourceType - The type of source for the import pipeline. -type PipelineSourceType string - -const ( - PipelineSourceTypeAzureStorageBlobContainer PipelineSourceType = "AzureStorageBlobContainer" -) - -// PossiblePipelineSourceTypeValues returns the possible values for the PipelineSourceType const type. -func PossiblePipelineSourceTypeValues() []PipelineSourceType { - return []PipelineSourceType{ - PipelineSourceTypeAzureStorageBlobContainer, - } -} - // PolicyStatus - The value that indicates whether the policy is enabled or not. type PolicyStatus string @@ -748,22 +563,6 @@ func PossibleStepTypeValues() []StepType { } } -// TLSStatus - Indicates whether HTTPS is enabled for the login server. -type TLSStatus string - -const ( - TLSStatusDisabled TLSStatus = "Disabled" - TLSStatusEnabled TLSStatus = "Enabled" -) - -// PossibleTLSStatusValues returns the possible values for the TLSStatus const type. -func PossibleTLSStatusValues() []TLSStatus { - return []TLSStatus{ - TLSStatusDisabled, - TLSStatusEnabled, - } -} - // TaskStatus - The current status of task. type TaskStatus string diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client.go index daf741dfa898..e288d477f411 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client.go @@ -46,7 +46,7 @@ func NewCredentialSetsClient(subscriptionID string, credential azcore.TokenCrede // BeginCreate - Creates a credential set for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - credentialSetName - The name of the credential set. @@ -71,7 +71,7 @@ func (client *CredentialSetsClient) BeginCreate(ctx context.Context, resourceGro // Create - Creates a credential set for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *CredentialSetsClient) create(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, credentialSetCreateParameters CredentialSet, options *CredentialSetsClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "CredentialSetsClient.BeginCreate" @@ -114,7 +114,7 @@ func (client *CredentialSetsClient) createCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, credentialSetCreateParameters); err != nil { @@ -126,7 +126,7 @@ func (client *CredentialSetsClient) createCreateRequest(ctx context.Context, res // BeginDelete - Deletes a credential set from a container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - credentialSetName - The name of the credential set. @@ -150,7 +150,7 @@ func (client *CredentialSetsClient) BeginDelete(ctx context.Context, resourceGro // Delete - Deletes a credential set from a container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *CredentialSetsClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, options *CredentialSetsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "CredentialSetsClient.BeginDelete" @@ -165,7 +165,7 @@ func (client *CredentialSetsClient) deleteOperation(ctx context.Context, resourc if err != nil { return nil, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { err = runtime.NewResponseError(httpResp) return nil, err } @@ -193,7 +193,7 @@ func (client *CredentialSetsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -202,7 +202,7 @@ func (client *CredentialSetsClient) deleteCreateRequest(ctx context.Context, res // Get - Gets the properties of the specified credential set resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - credentialSetName - The name of the credential set. @@ -250,7 +250,7 @@ func (client *CredentialSetsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -267,7 +267,7 @@ func (client *CredentialSetsClient) getHandleResponse(resp *http.Response) (Cred // NewListPager - Lists all credential set resources for the specified container registry. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - options - CredentialSetsClientListOptions contains the optional parameters for the CredentialSetsClient.NewListPager method. @@ -318,7 +318,7 @@ func (client *CredentialSetsClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -336,7 +336,7 @@ func (client *CredentialSetsClient) listHandleResponse(resp *http.Response) (Cre // BeginUpdate - Updates a credential set for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - credentialSetName - The name of the credential set. @@ -361,7 +361,7 @@ func (client *CredentialSetsClient) BeginUpdate(ctx context.Context, resourceGro // Update - Updates a credential set for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *CredentialSetsClient) update(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, credentialSetUpdateParameters CredentialSetUpdateParameters, options *CredentialSetsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "CredentialSetsClient.BeginUpdate" @@ -404,7 +404,7 @@ func (client *CredentialSetsClient) updateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, credentialSetUpdateParameters); err != nil { diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client_example_test.go index a701d815aefa..652a625117a6 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/CredentialSetList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/CredentialSetList.json func ExampleCredentialSetsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -70,7 +70,7 @@ func ExampleCredentialSetsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/CredentialSetGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/CredentialSetGet.json func ExampleCredentialSetsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -114,7 +114,7 @@ func ExampleCredentialSetsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/CredentialSetCreate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/CredentialSetCreate.json func ExampleCredentialSetsClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -175,7 +175,7 @@ func ExampleCredentialSetsClient_BeginCreate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/CredentialSetDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/CredentialSetDelete.json func ExampleCredentialSetsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -196,7 +196,7 @@ func ExampleCredentialSetsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/CredentialSetUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/CredentialSetUpdate.json func ExampleCredentialSetsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/exportpipelines_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/exportpipelines_client.go deleted file mode 100644 index 782b4446aefb..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/exportpipelines_client.go +++ /dev/null @@ -1,335 +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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcontainerregistry - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// ExportPipelinesClient contains the methods for the ExportPipelines group. -// Don't use this type directly, use NewExportPipelinesClient() instead. -type ExportPipelinesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewExportPipelinesClient creates a new instance of ExportPipelinesClient with the specified values. -// - subscriptionID - The ID of the target subscription. The value must be an UUID. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewExportPipelinesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExportPipelinesClient, error) { - cl, err := arm.NewClient(moduleName+".ExportPipelinesClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ExportPipelinesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginCreate - Creates an export pipeline for a container registry with the specified parameters. -// 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. -// - registryName - The name of the container registry. -// - exportPipelineName - The name of the export pipeline. -// - exportPipelineCreateParameters - The parameters for creating an export pipeline. -// - options - ExportPipelinesClientBeginCreateOptions contains the optional parameters for the ExportPipelinesClient.BeginCreate -// method. -func (client *ExportPipelinesClient) BeginCreate(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, exportPipelineCreateParameters ExportPipeline, options *ExportPipelinesClientBeginCreateOptions) (*runtime.Poller[ExportPipelinesClientCreateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, registryName, exportPipelineName, exportPipelineCreateParameters, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExportPipelinesClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken[ExportPipelinesClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Create - Creates an export pipeline for a container registry with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -func (client *ExportPipelinesClient) create(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, exportPipelineCreateParameters ExportPipeline, options *ExportPipelinesClientBeginCreateOptions) (*http.Response, error) { - var err error - const operationName = "ExportPipelinesClient.BeginCreate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, exportPipelineName, exportPipelineCreateParameters, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// createCreateRequest creates the Create request. -func (client *ExportPipelinesClient) createCreateRequest(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, exportPipelineCreateParameters ExportPipeline, options *ExportPipelinesClientBeginCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}" - 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 registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - if exportPipelineName == "" { - return nil, errors.New("parameter exportPipelineName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{exportPipelineName}", url.PathEscape(exportPipelineName)) - 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", "2023-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, exportPipelineCreateParameters); err != nil { - return nil, err - } - return req, nil -} - -// BeginDelete - Deletes an export pipeline from a container registry. -// 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. -// - registryName - The name of the container registry. -// - exportPipelineName - The name of the export pipeline. -// - options - ExportPipelinesClientBeginDeleteOptions contains the optional parameters for the ExportPipelinesClient.BeginDelete -// method. -func (client *ExportPipelinesClient) BeginDelete(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, options *ExportPipelinesClientBeginDeleteOptions) (*runtime.Poller[ExportPipelinesClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, registryName, exportPipelineName, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExportPipelinesClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken[ExportPipelinesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Delete - Deletes an export pipeline from a container registry. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -func (client *ExportPipelinesClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, options *ExportPipelinesClientBeginDeleteOptions) (*http.Response, error) { - var err error - const operationName = "ExportPipelinesClient.BeginDelete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, exportPipelineName, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *ExportPipelinesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, options *ExportPipelinesClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}" - 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 registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - if exportPipelineName == "" { - return nil, errors.New("parameter exportPipelineName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{exportPipelineName}", url.PathEscape(exportPipelineName)) - 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", "2023-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Gets the properties of the export pipeline. -// 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. -// - registryName - The name of the container registry. -// - exportPipelineName - The name of the export pipeline. -// - options - ExportPipelinesClientGetOptions contains the optional parameters for the ExportPipelinesClient.Get method. -func (client *ExportPipelinesClient) Get(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, options *ExportPipelinesClientGetOptions) (ExportPipelinesClientGetResponse, error) { - var err error - const operationName = "ExportPipelinesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, exportPipelineName, options) - if err != nil { - return ExportPipelinesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ExportPipelinesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ExportPipelinesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ExportPipelinesClient) getCreateRequest(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, options *ExportPipelinesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}" - 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 registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - if exportPipelineName == "" { - return nil, errors.New("parameter exportPipelineName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{exportPipelineName}", url.PathEscape(exportPipelineName)) - 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") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ExportPipelinesClient) getHandleResponse(resp *http.Response) (ExportPipelinesClientGetResponse, error) { - result := ExportPipelinesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ExportPipeline); err != nil { - return ExportPipelinesClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Lists all export pipelines for the specified container registry. -// -// Generated from API version 2023-01-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - registryName - The name of the container registry. -// - options - ExportPipelinesClientListOptions contains the optional parameters for the ExportPipelinesClient.NewListPager -// method. -func (client *ExportPipelinesClient) NewListPager(resourceGroupName string, registryName string, options *ExportPipelinesClientListOptions) *runtime.Pager[ExportPipelinesClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[ExportPipelinesClientListResponse]{ - More: func(page ExportPipelinesClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ExportPipelinesClientListResponse) (ExportPipelinesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ExportPipelinesClient.NewListPager") - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, resourceGroupName, registryName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ExportPipelinesClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ExportPipelinesClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ExportPipelinesClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *ExportPipelinesClient) listCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *ExportPipelinesClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines" - 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 registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - 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") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *ExportPipelinesClient) listHandleResponse(resp *http.Response) (ExportPipelinesClientListResponse, error) { - result := ExportPipelinesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ExportPipelineListResult); err != nil { - return ExportPipelinesClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/exportpipelines_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/exportpipelines_client_example_test.go deleted file mode 100644 index a889c62c5891..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/exportpipelines_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. -// DO NOT EDIT. - -package armcontainerregistry_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/containerregistry/armcontainerregistry" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ExportPipelineList.json -func ExampleExportPipelinesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewExportPipelinesClient().NewListPager("myResourceGroup", "myRegistry", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ExportPipelineListResult = armcontainerregistry.ExportPipelineListResult{ - // Value: []*armcontainerregistry.ExportPipeline{ - // { - // Name: to.Ptr("myExportPipeline"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/exportPipelines"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/exportPipelines/myExportPipeline"), - // Identity: &armcontainerregistry.IdentityProperties{ - // Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("fa153151-b9fd-46f4-9088-5e6600f2689v"), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-abu4gm510ccd"), - // }, - // Location: to.Ptr("westus"), - // Properties: &armcontainerregistry.ExportPipelineProperties{ - // Options: []*armcontainerregistry.PipelineOptions{ - // to.Ptr(armcontainerregistry.PipelineOptionsOverwriteBlobs)}, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Target: &armcontainerregistry.ExportPipelineTargetProperties{ - // Type: to.Ptr("AzureStorageBlobContainer"), - // KeyVaultURI: to.Ptr("https://myvault.vault.azure.net/secrets/acrexportsas"), - // URI: to.Ptr("https://accountname.blob.core.windows.net/containername"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ExportPipelineGet.json -func ExampleExportPipelinesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportPipelinesClient().Get(ctx, "myResourceGroup", "myRegistry", "myExportPipeline", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExportPipeline = armcontainerregistry.ExportPipeline{ - // Name: to.Ptr("myExportPipeline"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/exportPipelines"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/exportPipelines/myExportPipeline"), - // Identity: &armcontainerregistry.IdentityProperties{ - // Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("fa153151-b9fd-46f4-9088-5e6600f2689v"), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-abu4gm510ccd"), - // }, - // Location: to.Ptr("westus"), - // Properties: &armcontainerregistry.ExportPipelineProperties{ - // Options: []*armcontainerregistry.PipelineOptions{ - // to.Ptr(armcontainerregistry.PipelineOptionsOverwriteBlobs)}, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Target: &armcontainerregistry.ExportPipelineTargetProperties{ - // Type: to.Ptr("AzureStorageBlobContainer"), - // KeyVaultURI: to.Ptr("https://myvault.vault.azure.net/secrets/acrexportsas"), - // URI: to.Ptr("https://accountname.blob.core.windows.net/containername"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ExportPipelineCreate.json -func ExampleExportPipelinesClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExportPipelinesClient().BeginCreate(ctx, "myResourceGroup", "myRegistry", "myExportPipeline", armcontainerregistry.ExportPipeline{ - Identity: &armcontainerregistry.IdentityProperties{ - Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeSystemAssigned), - }, - Location: to.Ptr("westus"), - Properties: &armcontainerregistry.ExportPipelineProperties{ - Options: []*armcontainerregistry.PipelineOptions{ - to.Ptr(armcontainerregistry.PipelineOptionsOverwriteBlobs)}, - Target: &armcontainerregistry.ExportPipelineTargetProperties{ - Type: to.Ptr("AzureStorageBlobContainer"), - KeyVaultURI: to.Ptr("https://myvault.vault.azure.net/secrets/acrexportsas"), - URI: to.Ptr("https://accountname.blob.core.windows.net/containername"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExportPipeline = armcontainerregistry.ExportPipeline{ - // Name: to.Ptr("myExportPipeline"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/exportPipelines"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/exportPipelines/myExportPipeline"), - // Identity: &armcontainerregistry.IdentityProperties{ - // Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("fa153151-b9fd-46f4-9088-5e6600f2689v"), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-abu4gm510ccd"), - // }, - // Location: to.Ptr("westus"), - // Properties: &armcontainerregistry.ExportPipelineProperties{ - // Options: []*armcontainerregistry.PipelineOptions{ - // to.Ptr(armcontainerregistry.PipelineOptionsOverwriteBlobs)}, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Target: &armcontainerregistry.ExportPipelineTargetProperties{ - // Type: to.Ptr("AzureStorageBlobContainer"), - // KeyVaultURI: to.Ptr("https://myvault.vault.azure.net/secrets/acrexportsas"), - // URI: to.Ptr("https://accountname.blob.core.windows.net/containername"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ExportPipelineDelete.json -func ExampleExportPipelinesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExportPipelinesClient().BeginDelete(ctx, "myResourceGroup", "myRegistry", "myExportPipeline", 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/containerregistry/armcontainerregistry/fake/cacherules_server.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/cacherules_server.go index f0c9bdb72867..a9d1b53df08b 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/cacherules_server.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/cacherules_server.go @@ -29,7 +29,7 @@ type CacheRulesServer struct { BeginCreate func(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, cacheRuleCreateParameters armcontainerregistry.CacheRule, options *armcontainerregistry.CacheRulesClientBeginCreateOptions) (resp azfake.PollerResponder[armcontainerregistry.CacheRulesClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method CacheRulesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, options *armcontainerregistry.CacheRulesClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerregistry.CacheRulesClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method CacheRulesClient.Get @@ -190,9 +190,9 @@ func (c *CacheRulesServerTransport) dispatchBeginDelete(req *http.Request) (*htt return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { c.beginDelete.remove(req) diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/connectedregistries_server.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/connectedregistries_server.go deleted file mode 100644 index 9bccc4a44d73..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/connectedregistries_server.go +++ /dev/null @@ -1,400 +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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" - "net/http" - "net/url" - "regexp" -) - -// ConnectedRegistriesServer is a fake server for instances of the armcontainerregistry.ConnectedRegistriesClient type. -type ConnectedRegistriesServer struct { - // BeginCreate is the fake for method ConnectedRegistriesClient.BeginCreate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryCreateParameters armcontainerregistry.ConnectedRegistry, options *armcontainerregistry.ConnectedRegistriesClientBeginCreateOptions) (resp azfake.PollerResponder[armcontainerregistry.ConnectedRegistriesClientCreateResponse], errResp azfake.ErrorResponder) - - // BeginDeactivate is the fake for method ConnectedRegistriesClient.BeginDeactivate - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginDeactivate func(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, options *armcontainerregistry.ConnectedRegistriesClientBeginDeactivateOptions) (resp azfake.PollerResponder[armcontainerregistry.ConnectedRegistriesClientDeactivateResponse], errResp azfake.ErrorResponder) - - // BeginDelete is the fake for method ConnectedRegistriesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, options *armcontainerregistry.ConnectedRegistriesClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerregistry.ConnectedRegistriesClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method ConnectedRegistriesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, options *armcontainerregistry.ConnectedRegistriesClientGetOptions) (resp azfake.Responder[armcontainerregistry.ConnectedRegistriesClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method ConnectedRegistriesClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, registryName string, options *armcontainerregistry.ConnectedRegistriesClientListOptions) (resp azfake.PagerResponder[armcontainerregistry.ConnectedRegistriesClientListResponse]) - - // BeginUpdate is the fake for method ConnectedRegistriesClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginUpdate func(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryUpdateParameters armcontainerregistry.ConnectedRegistryUpdateParameters, options *armcontainerregistry.ConnectedRegistriesClientBeginUpdateOptions) (resp azfake.PollerResponder[armcontainerregistry.ConnectedRegistriesClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewConnectedRegistriesServerTransport creates a new instance of ConnectedRegistriesServerTransport with the provided implementation. -// The returned ConnectedRegistriesServerTransport instance is connected to an instance of armcontainerregistry.ConnectedRegistriesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewConnectedRegistriesServerTransport(srv *ConnectedRegistriesServer) *ConnectedRegistriesServerTransport { - return &ConnectedRegistriesServerTransport{ - srv: srv, - beginCreate: newTracker[azfake.PollerResponder[armcontainerregistry.ConnectedRegistriesClientCreateResponse]](), - beginDeactivate: newTracker[azfake.PollerResponder[armcontainerregistry.ConnectedRegistriesClientDeactivateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armcontainerregistry.ConnectedRegistriesClientDeleteResponse]](), - newListPager: newTracker[azfake.PagerResponder[armcontainerregistry.ConnectedRegistriesClientListResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armcontainerregistry.ConnectedRegistriesClientUpdateResponse]](), - } -} - -// ConnectedRegistriesServerTransport connects instances of armcontainerregistry.ConnectedRegistriesClient to instances of ConnectedRegistriesServer. -// Don't use this type directly, use NewConnectedRegistriesServerTransport instead. -type ConnectedRegistriesServerTransport struct { - srv *ConnectedRegistriesServer - beginCreate *tracker[azfake.PollerResponder[armcontainerregistry.ConnectedRegistriesClientCreateResponse]] - beginDeactivate *tracker[azfake.PollerResponder[armcontainerregistry.ConnectedRegistriesClientDeactivateResponse]] - beginDelete *tracker[azfake.PollerResponder[armcontainerregistry.ConnectedRegistriesClientDeleteResponse]] - newListPager *tracker[azfake.PagerResponder[armcontainerregistry.ConnectedRegistriesClientListResponse]] - beginUpdate *tracker[azfake.PollerResponder[armcontainerregistry.ConnectedRegistriesClientUpdateResponse]] -} - -// Do implements the policy.Transporter interface for ConnectedRegistriesServerTransport. -func (c *ConnectedRegistriesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ConnectedRegistriesClient.BeginCreate": - resp, err = c.dispatchBeginCreate(req) - case "ConnectedRegistriesClient.BeginDeactivate": - resp, err = c.dispatchBeginDeactivate(req) - case "ConnectedRegistriesClient.BeginDelete": - resp, err = c.dispatchBeginDelete(req) - case "ConnectedRegistriesClient.Get": - resp, err = c.dispatchGet(req) - case "ConnectedRegistriesClient.NewListPager": - resp, err = c.dispatchNewListPager(req) - case "ConnectedRegistriesClient.BeginUpdate": - resp, err = c.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (c *ConnectedRegistriesServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { - if c.srv.BeginCreate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} - } - beginCreate := c.beginCreate.get(req) - if beginCreate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/connectedRegistries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.ConnectedRegistry](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - connectedRegistryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("connectedRegistryName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.BeginCreate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, connectedRegistryNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreate = &respr - c.beginCreate.add(req, beginCreate) - } - - resp, err := server.PollerResponderNext(beginCreate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - c.beginCreate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginCreate) { - c.beginCreate.remove(req) - } - - return resp, nil -} - -func (c *ConnectedRegistriesServerTransport) dispatchBeginDeactivate(req *http.Request) (*http.Response, error) { - if c.srv.BeginDeactivate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDeactivate not implemented")} - } - beginDeactivate := c.beginDeactivate.get(req) - if beginDeactivate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/connectedRegistries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/deactivate` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - connectedRegistryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("connectedRegistryName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.BeginDeactivate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, connectedRegistryNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginDeactivate = &respr - c.beginDeactivate.add(req, beginDeactivate) - } - - resp, err := server.PollerResponderNext(beginDeactivate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - c.beginDeactivate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginDeactivate) { - c.beginDeactivate.remove(req) - } - - return resp, nil -} - -func (c *ConnectedRegistriesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if c.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - beginDelete := c.beginDelete.get(req) - if beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/connectedRegistries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - connectedRegistryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("connectedRegistryName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.BeginDelete(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, connectedRegistryNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginDelete = &respr - c.beginDelete.add(req, beginDelete) - } - - resp, err := server.PollerResponderNext(beginDelete, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - c.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} - } - if !server.PollerResponderMore(beginDelete) { - c.beginDelete.remove(req) - } - - return resp, nil -} - -func (c *ConnectedRegistriesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if c.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/connectedRegistries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - connectedRegistryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("connectedRegistryName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, connectedRegistryNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ConnectedRegistry, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (c *ConnectedRegistriesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if c.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := c.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/connectedRegistries` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - var options *armcontainerregistry.ConnectedRegistriesClientListOptions - if filterParam != nil { - options = &armcontainerregistry.ConnectedRegistriesClientListOptions{ - Filter: filterParam, - } - } - resp := c.srv.NewListPager(resourceGroupNameUnescaped, registryNameUnescaped, options) - newListPager = &resp - c.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcontainerregistry.ConnectedRegistriesClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - c.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - c.newListPager.remove(req) - } - return resp, nil -} - -func (c *ConnectedRegistriesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { - if c.srv.BeginUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} - } - beginUpdate := c.beginUpdate.get(req) - if beginUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/connectedRegistries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.ConnectedRegistryUpdateParameters](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - connectedRegistryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("connectedRegistryName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.BeginUpdate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, connectedRegistryNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginUpdate = &respr - c.beginUpdate.add(req, beginUpdate) - } - - resp, err := server.PollerResponderNext(beginUpdate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - c.beginUpdate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginUpdate) { - c.beginUpdate.remove(req) - } - - return resp, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/credentialsets_server.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/credentialsets_server.go index 42f1614806e7..591efcda35c5 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/credentialsets_server.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/credentialsets_server.go @@ -29,7 +29,7 @@ type CredentialSetsServer struct { BeginCreate func(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, credentialSetCreateParameters armcontainerregistry.CredentialSet, options *armcontainerregistry.CredentialSetsClientBeginCreateOptions) (resp azfake.PollerResponder[armcontainerregistry.CredentialSetsClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method CredentialSetsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, options *armcontainerregistry.CredentialSetsClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerregistry.CredentialSetsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method CredentialSetsClient.Get @@ -190,9 +190,9 @@ func (c *CredentialSetsServerTransport) dispatchBeginDelete(req *http.Request) ( return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { c.beginDelete.remove(req) diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/exportpipelines_server.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/exportpipelines_server.go deleted file mode 100644 index 9930a5bd7c4a..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/exportpipelines_server.go +++ /dev/null @@ -1,272 +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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" - "net/http" - "net/url" - "regexp" -) - -// ExportPipelinesServer is a fake server for instances of the armcontainerregistry.ExportPipelinesClient type. -type ExportPipelinesServer struct { - // BeginCreate is the fake for method ExportPipelinesClient.BeginCreate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, exportPipelineCreateParameters armcontainerregistry.ExportPipeline, options *armcontainerregistry.ExportPipelinesClientBeginCreateOptions) (resp azfake.PollerResponder[armcontainerregistry.ExportPipelinesClientCreateResponse], errResp azfake.ErrorResponder) - - // BeginDelete is the fake for method ExportPipelinesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, options *armcontainerregistry.ExportPipelinesClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerregistry.ExportPipelinesClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method ExportPipelinesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, options *armcontainerregistry.ExportPipelinesClientGetOptions) (resp azfake.Responder[armcontainerregistry.ExportPipelinesClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method ExportPipelinesClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, registryName string, options *armcontainerregistry.ExportPipelinesClientListOptions) (resp azfake.PagerResponder[armcontainerregistry.ExportPipelinesClientListResponse]) -} - -// NewExportPipelinesServerTransport creates a new instance of ExportPipelinesServerTransport with the provided implementation. -// The returned ExportPipelinesServerTransport instance is connected to an instance of armcontainerregistry.ExportPipelinesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewExportPipelinesServerTransport(srv *ExportPipelinesServer) *ExportPipelinesServerTransport { - return &ExportPipelinesServerTransport{ - srv: srv, - beginCreate: newTracker[azfake.PollerResponder[armcontainerregistry.ExportPipelinesClientCreateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armcontainerregistry.ExportPipelinesClientDeleteResponse]](), - newListPager: newTracker[azfake.PagerResponder[armcontainerregistry.ExportPipelinesClientListResponse]](), - } -} - -// ExportPipelinesServerTransport connects instances of armcontainerregistry.ExportPipelinesClient to instances of ExportPipelinesServer. -// Don't use this type directly, use NewExportPipelinesServerTransport instead. -type ExportPipelinesServerTransport struct { - srv *ExportPipelinesServer - beginCreate *tracker[azfake.PollerResponder[armcontainerregistry.ExportPipelinesClientCreateResponse]] - beginDelete *tracker[azfake.PollerResponder[armcontainerregistry.ExportPipelinesClientDeleteResponse]] - newListPager *tracker[azfake.PagerResponder[armcontainerregistry.ExportPipelinesClientListResponse]] -} - -// Do implements the policy.Transporter interface for ExportPipelinesServerTransport. -func (e *ExportPipelinesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ExportPipelinesClient.BeginCreate": - resp, err = e.dispatchBeginCreate(req) - case "ExportPipelinesClient.BeginDelete": - resp, err = e.dispatchBeginDelete(req) - case "ExportPipelinesClient.Get": - resp, err = e.dispatchGet(req) - case "ExportPipelinesClient.NewListPager": - resp, err = e.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (e *ExportPipelinesServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { - if e.srv.BeginCreate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} - } - beginCreate := e.beginCreate.get(req) - if beginCreate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/exportPipelines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.ExportPipeline](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - exportPipelineNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("exportPipelineName")]) - if err != nil { - return nil, err - } - respr, errRespr := e.srv.BeginCreate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, exportPipelineNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreate = &respr - e.beginCreate.add(req, beginCreate) - } - - resp, err := server.PollerResponderNext(beginCreate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - e.beginCreate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginCreate) { - e.beginCreate.remove(req) - } - - return resp, nil -} - -func (e *ExportPipelinesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if e.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - beginDelete := e.beginDelete.get(req) - if beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/exportPipelines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - exportPipelineNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("exportPipelineName")]) - if err != nil { - return nil, err - } - respr, errRespr := e.srv.BeginDelete(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, exportPipelineNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginDelete = &respr - e.beginDelete.add(req, beginDelete) - } - - resp, err := server.PollerResponderNext(beginDelete, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - e.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} - } - if !server.PollerResponderMore(beginDelete) { - e.beginDelete.remove(req) - } - - return resp, nil -} - -func (e *ExportPipelinesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if e.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/exportPipelines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - exportPipelineNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("exportPipelineName")]) - if err != nil { - return nil, err - } - respr, errRespr := e.srv.Get(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, exportPipelineNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ExportPipeline, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (e *ExportPipelinesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if e.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := e.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/exportPipelines` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - resp := e.srv.NewListPager(resourceGroupNameUnescaped, registryNameUnescaped, nil) - newListPager = &resp - e.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcontainerregistry.ExportPipelinesClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - e.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - e.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/importpipelines_server.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/importpipelines_server.go deleted file mode 100644 index f63fa69e1c5d..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/importpipelines_server.go +++ /dev/null @@ -1,272 +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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" - "net/http" - "net/url" - "regexp" -) - -// ImportPipelinesServer is a fake server for instances of the armcontainerregistry.ImportPipelinesClient type. -type ImportPipelinesServer struct { - // BeginCreate is the fake for method ImportPipelinesClient.BeginCreate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, importPipelineCreateParameters armcontainerregistry.ImportPipeline, options *armcontainerregistry.ImportPipelinesClientBeginCreateOptions) (resp azfake.PollerResponder[armcontainerregistry.ImportPipelinesClientCreateResponse], errResp azfake.ErrorResponder) - - // BeginDelete is the fake for method ImportPipelinesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, options *armcontainerregistry.ImportPipelinesClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerregistry.ImportPipelinesClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method ImportPipelinesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, options *armcontainerregistry.ImportPipelinesClientGetOptions) (resp azfake.Responder[armcontainerregistry.ImportPipelinesClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method ImportPipelinesClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, registryName string, options *armcontainerregistry.ImportPipelinesClientListOptions) (resp azfake.PagerResponder[armcontainerregistry.ImportPipelinesClientListResponse]) -} - -// NewImportPipelinesServerTransport creates a new instance of ImportPipelinesServerTransport with the provided implementation. -// The returned ImportPipelinesServerTransport instance is connected to an instance of armcontainerregistry.ImportPipelinesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewImportPipelinesServerTransport(srv *ImportPipelinesServer) *ImportPipelinesServerTransport { - return &ImportPipelinesServerTransport{ - srv: srv, - beginCreate: newTracker[azfake.PollerResponder[armcontainerregistry.ImportPipelinesClientCreateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armcontainerregistry.ImportPipelinesClientDeleteResponse]](), - newListPager: newTracker[azfake.PagerResponder[armcontainerregistry.ImportPipelinesClientListResponse]](), - } -} - -// ImportPipelinesServerTransport connects instances of armcontainerregistry.ImportPipelinesClient to instances of ImportPipelinesServer. -// Don't use this type directly, use NewImportPipelinesServerTransport instead. -type ImportPipelinesServerTransport struct { - srv *ImportPipelinesServer - beginCreate *tracker[azfake.PollerResponder[armcontainerregistry.ImportPipelinesClientCreateResponse]] - beginDelete *tracker[azfake.PollerResponder[armcontainerregistry.ImportPipelinesClientDeleteResponse]] - newListPager *tracker[azfake.PagerResponder[armcontainerregistry.ImportPipelinesClientListResponse]] -} - -// Do implements the policy.Transporter interface for ImportPipelinesServerTransport. -func (i *ImportPipelinesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ImportPipelinesClient.BeginCreate": - resp, err = i.dispatchBeginCreate(req) - case "ImportPipelinesClient.BeginDelete": - resp, err = i.dispatchBeginDelete(req) - case "ImportPipelinesClient.Get": - resp, err = i.dispatchGet(req) - case "ImportPipelinesClient.NewListPager": - resp, err = i.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (i *ImportPipelinesServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { - if i.srv.BeginCreate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} - } - beginCreate := i.beginCreate.get(req) - if beginCreate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/importPipelines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.ImportPipeline](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - importPipelineNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("importPipelineName")]) - if err != nil { - return nil, err - } - respr, errRespr := i.srv.BeginCreate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, importPipelineNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreate = &respr - i.beginCreate.add(req, beginCreate) - } - - resp, err := server.PollerResponderNext(beginCreate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - i.beginCreate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginCreate) { - i.beginCreate.remove(req) - } - - return resp, nil -} - -func (i *ImportPipelinesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if i.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - beginDelete := i.beginDelete.get(req) - if beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/importPipelines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - importPipelineNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("importPipelineName")]) - if err != nil { - return nil, err - } - respr, errRespr := i.srv.BeginDelete(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, importPipelineNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginDelete = &respr - i.beginDelete.add(req, beginDelete) - } - - resp, err := server.PollerResponderNext(beginDelete, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - i.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} - } - if !server.PollerResponderMore(beginDelete) { - i.beginDelete.remove(req) - } - - return resp, nil -} - -func (i *ImportPipelinesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if i.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/importPipelines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - importPipelineNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("importPipelineName")]) - if err != nil { - return nil, err - } - respr, errRespr := i.srv.Get(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, importPipelineNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ImportPipeline, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (i *ImportPipelinesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if i.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := i.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/importPipelines` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - resp := i.srv.NewListPager(resourceGroupNameUnescaped, registryNameUnescaped, nil) - newListPager = &resp - i.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcontainerregistry.ImportPipelinesClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - i.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - i.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/pipelineruns_server.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/pipelineruns_server.go deleted file mode 100644 index c134e5063017..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/pipelineruns_server.go +++ /dev/null @@ -1,272 +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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" - "net/http" - "net/url" - "regexp" -) - -// PipelineRunsServer is a fake server for instances of the armcontainerregistry.PipelineRunsClient type. -type PipelineRunsServer struct { - // BeginCreate is the fake for method PipelineRunsClient.BeginCreate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, pipelineRunCreateParameters armcontainerregistry.PipelineRun, options *armcontainerregistry.PipelineRunsClientBeginCreateOptions) (resp azfake.PollerResponder[armcontainerregistry.PipelineRunsClientCreateResponse], errResp azfake.ErrorResponder) - - // BeginDelete is the fake for method PipelineRunsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, options *armcontainerregistry.PipelineRunsClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerregistry.PipelineRunsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method PipelineRunsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, options *armcontainerregistry.PipelineRunsClientGetOptions) (resp azfake.Responder[armcontainerregistry.PipelineRunsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method PipelineRunsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, registryName string, options *armcontainerregistry.PipelineRunsClientListOptions) (resp azfake.PagerResponder[armcontainerregistry.PipelineRunsClientListResponse]) -} - -// NewPipelineRunsServerTransport creates a new instance of PipelineRunsServerTransport with the provided implementation. -// The returned PipelineRunsServerTransport instance is connected to an instance of armcontainerregistry.PipelineRunsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewPipelineRunsServerTransport(srv *PipelineRunsServer) *PipelineRunsServerTransport { - return &PipelineRunsServerTransport{ - srv: srv, - beginCreate: newTracker[azfake.PollerResponder[armcontainerregistry.PipelineRunsClientCreateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armcontainerregistry.PipelineRunsClientDeleteResponse]](), - newListPager: newTracker[azfake.PagerResponder[armcontainerregistry.PipelineRunsClientListResponse]](), - } -} - -// PipelineRunsServerTransport connects instances of armcontainerregistry.PipelineRunsClient to instances of PipelineRunsServer. -// Don't use this type directly, use NewPipelineRunsServerTransport instead. -type PipelineRunsServerTransport struct { - srv *PipelineRunsServer - beginCreate *tracker[azfake.PollerResponder[armcontainerregistry.PipelineRunsClientCreateResponse]] - beginDelete *tracker[azfake.PollerResponder[armcontainerregistry.PipelineRunsClientDeleteResponse]] - newListPager *tracker[azfake.PagerResponder[armcontainerregistry.PipelineRunsClientListResponse]] -} - -// Do implements the policy.Transporter interface for PipelineRunsServerTransport. -func (p *PipelineRunsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "PipelineRunsClient.BeginCreate": - resp, err = p.dispatchBeginCreate(req) - case "PipelineRunsClient.BeginDelete": - resp, err = p.dispatchBeginDelete(req) - case "PipelineRunsClient.Get": - resp, err = p.dispatchGet(req) - case "PipelineRunsClient.NewListPager": - resp, err = p.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *PipelineRunsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { - if p.srv.BeginCreate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} - } - beginCreate := p.beginCreate.get(req) - if beginCreate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/pipelineRuns/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.PipelineRun](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - pipelineRunNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("pipelineRunName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.BeginCreate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, pipelineRunNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreate = &respr - p.beginCreate.add(req, beginCreate) - } - - resp, err := server.PollerResponderNext(beginCreate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - p.beginCreate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginCreate) { - p.beginCreate.remove(req) - } - - return resp, nil -} - -func (p *PipelineRunsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if p.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - beginDelete := p.beginDelete.get(req) - if beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/pipelineRuns/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - pipelineRunNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("pipelineRunName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, pipelineRunNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginDelete = &respr - p.beginDelete.add(req, beginDelete) - } - - resp, err := server.PollerResponderNext(beginDelete, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - p.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} - } - if !server.PollerResponderMore(beginDelete) { - p.beginDelete.remove(req) - } - - return resp, nil -} - -func (p *PipelineRunsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/pipelineRuns/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - pipelineRunNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("pipelineRunName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, pipelineRunNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PipelineRun, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (p *PipelineRunsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if p.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := p.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/pipelineRuns` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - resp := p.srv.NewListPager(resourceGroupNameUnescaped, registryNameUnescaped, nil) - newListPager = &resp - p.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcontainerregistry.PipelineRunsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - p.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - p.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/go.mod b/sdk/resourcemanager/containerregistry/armcontainerregistry/go.mod index 7475306a0b93..d0ae8296a16a 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/go.mod +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/go.mod @@ -5,12 +5,12 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0-beta.1 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 github.com/stretchr/testify v1.7.0 ) require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/importpipelines_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/importpipelines_client.go deleted file mode 100644 index 9f586ca37df7..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/importpipelines_client.go +++ /dev/null @@ -1,335 +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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcontainerregistry - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// ImportPipelinesClient contains the methods for the ImportPipelines group. -// Don't use this type directly, use NewImportPipelinesClient() instead. -type ImportPipelinesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewImportPipelinesClient creates a new instance of ImportPipelinesClient with the specified values. -// - subscriptionID - The ID of the target subscription. The value must be an UUID. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewImportPipelinesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ImportPipelinesClient, error) { - cl, err := arm.NewClient(moduleName+".ImportPipelinesClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ImportPipelinesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginCreate - Creates an import pipeline for a container registry with the specified parameters. -// 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. -// - registryName - The name of the container registry. -// - importPipelineName - The name of the import pipeline. -// - importPipelineCreateParameters - The parameters for creating an import pipeline. -// - options - ImportPipelinesClientBeginCreateOptions contains the optional parameters for the ImportPipelinesClient.BeginCreate -// method. -func (client *ImportPipelinesClient) BeginCreate(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, importPipelineCreateParameters ImportPipeline, options *ImportPipelinesClientBeginCreateOptions) (*runtime.Poller[ImportPipelinesClientCreateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, registryName, importPipelineName, importPipelineCreateParameters, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ImportPipelinesClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken[ImportPipelinesClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Create - Creates an import pipeline for a container registry with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -func (client *ImportPipelinesClient) create(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, importPipelineCreateParameters ImportPipeline, options *ImportPipelinesClientBeginCreateOptions) (*http.Response, error) { - var err error - const operationName = "ImportPipelinesClient.BeginCreate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, importPipelineName, importPipelineCreateParameters, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// createCreateRequest creates the Create request. -func (client *ImportPipelinesClient) createCreateRequest(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, importPipelineCreateParameters ImportPipeline, options *ImportPipelinesClientBeginCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}" - 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 registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - if importPipelineName == "" { - return nil, errors.New("parameter importPipelineName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{importPipelineName}", url.PathEscape(importPipelineName)) - 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", "2023-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, importPipelineCreateParameters); err != nil { - return nil, err - } - return req, nil -} - -// BeginDelete - Deletes an import pipeline from a container registry. -// 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. -// - registryName - The name of the container registry. -// - importPipelineName - The name of the import pipeline. -// - options - ImportPipelinesClientBeginDeleteOptions contains the optional parameters for the ImportPipelinesClient.BeginDelete -// method. -func (client *ImportPipelinesClient) BeginDelete(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, options *ImportPipelinesClientBeginDeleteOptions) (*runtime.Poller[ImportPipelinesClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, registryName, importPipelineName, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ImportPipelinesClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken[ImportPipelinesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Delete - Deletes an import pipeline from a container registry. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -func (client *ImportPipelinesClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, options *ImportPipelinesClientBeginDeleteOptions) (*http.Response, error) { - var err error - const operationName = "ImportPipelinesClient.BeginDelete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, importPipelineName, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *ImportPipelinesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, options *ImportPipelinesClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}" - 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 registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - if importPipelineName == "" { - return nil, errors.New("parameter importPipelineName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{importPipelineName}", url.PathEscape(importPipelineName)) - 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", "2023-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Gets the properties of the import pipeline. -// 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. -// - registryName - The name of the container registry. -// - importPipelineName - The name of the import pipeline. -// - options - ImportPipelinesClientGetOptions contains the optional parameters for the ImportPipelinesClient.Get method. -func (client *ImportPipelinesClient) Get(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, options *ImportPipelinesClientGetOptions) (ImportPipelinesClientGetResponse, error) { - var err error - const operationName = "ImportPipelinesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, importPipelineName, options) - if err != nil { - return ImportPipelinesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ImportPipelinesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ImportPipelinesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ImportPipelinesClient) getCreateRequest(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, options *ImportPipelinesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}" - 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 registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - if importPipelineName == "" { - return nil, errors.New("parameter importPipelineName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{importPipelineName}", url.PathEscape(importPipelineName)) - 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") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ImportPipelinesClient) getHandleResponse(resp *http.Response) (ImportPipelinesClientGetResponse, error) { - result := ImportPipelinesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ImportPipeline); err != nil { - return ImportPipelinesClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Lists all import pipelines for the specified container registry. -// -// Generated from API version 2023-01-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - registryName - The name of the container registry. -// - options - ImportPipelinesClientListOptions contains the optional parameters for the ImportPipelinesClient.NewListPager -// method. -func (client *ImportPipelinesClient) NewListPager(resourceGroupName string, registryName string, options *ImportPipelinesClientListOptions) *runtime.Pager[ImportPipelinesClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[ImportPipelinesClientListResponse]{ - More: func(page ImportPipelinesClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ImportPipelinesClientListResponse) (ImportPipelinesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ImportPipelinesClient.NewListPager") - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, resourceGroupName, registryName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ImportPipelinesClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ImportPipelinesClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ImportPipelinesClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *ImportPipelinesClient) listCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *ImportPipelinesClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines" - 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 registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - 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") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *ImportPipelinesClient) listHandleResponse(resp *http.Response) (ImportPipelinesClientListResponse, error) { - result := ImportPipelinesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ImportPipelineListResult); err != nil { - return ImportPipelinesClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/importpipelines_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/importpipelines_client_example_test.go deleted file mode 100644 index 835ca0165faa..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/importpipelines_client_example_test.go +++ /dev/null @@ -1,227 +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 armcontainerregistry_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/containerregistry/armcontainerregistry" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ImportPipelineList.json -func ExampleImportPipelinesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewImportPipelinesClient().NewListPager("myResourceGroup", "myRegistry", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ImportPipelineListResult = armcontainerregistry.ImportPipelineListResult{ - // Value: []*armcontainerregistry.ImportPipeline{ - // { - // Name: to.Ptr("myImportPipeline"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/importPipelines"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/importPipelines/myImportPipeline"), - // Identity: &armcontainerregistry.IdentityProperties{ - // Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armcontainerregistry.UserIdentityProperties{ - // "/subscriptions/f9d7ebed-adbd-4cb4-b973-aaf82c136138/resourcegroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity2": &armcontainerregistry.UserIdentityProperties{ - // ClientID: to.Ptr("d3ce1bc2-f7d7-4a5b-9979-950f4e57680e"), - // PrincipalID: to.Ptr("b6p9f58b-6fbf-4efd-a7e0-fvd46911a466"), - // }, - // }, - // }, - // Location: to.Ptr("westus"), - // Properties: &armcontainerregistry.ImportPipelineProperties{ - // Options: []*armcontainerregistry.PipelineOptions{ - // to.Ptr(armcontainerregistry.PipelineOptionsOverwriteTags), - // to.Ptr(armcontainerregistry.PipelineOptionsDeleteSourceBlobOnSuccess), - // to.Ptr(armcontainerregistry.PipelineOptionsContinueOnErrors)}, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Source: &armcontainerregistry.ImportPipelineSourceProperties{ - // Type: to.Ptr(armcontainerregistry.PipelineSourceTypeAzureStorageBlobContainer), - // KeyVaultURI: to.Ptr("https://myvault.vault.azure.net/secrets/acrimportsas"), - // URI: to.Ptr("https://accountname.blob.core.windows.net/containername"), - // }, - // Trigger: &armcontainerregistry.PipelineTriggerProperties{ - // SourceTrigger: &armcontainerregistry.PipelineSourceTriggerProperties{ - // Status: to.Ptr(armcontainerregistry.TriggerStatusEnabled), - // }, - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ImportPipelineGet.json -func ExampleImportPipelinesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewImportPipelinesClient().Get(ctx, "myResourceGroup", "myRegistry", "myImportPipeline", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ImportPipeline = armcontainerregistry.ImportPipeline{ - // Name: to.Ptr("myImportPipeline"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/importPipelines"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/importPipelines/myImportPipeline"), - // Identity: &armcontainerregistry.IdentityProperties{ - // Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armcontainerregistry.UserIdentityProperties{ - // "/subscriptions/f9d7ebed-adbd-4cb4-b973-aaf82c136138/resourcegroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity2": &armcontainerregistry.UserIdentityProperties{ - // ClientID: to.Ptr("d3ce1bc2-f7d7-4a5b-9979-950f4e57680e"), - // PrincipalID: to.Ptr("b6p9f58b-6fbf-4efd-a7e0-fvd46911a466"), - // }, - // }, - // }, - // Location: to.Ptr("westus"), - // Properties: &armcontainerregistry.ImportPipelineProperties{ - // Options: []*armcontainerregistry.PipelineOptions{ - // to.Ptr(armcontainerregistry.PipelineOptionsOverwriteTags), - // to.Ptr(armcontainerregistry.PipelineOptionsDeleteSourceBlobOnSuccess), - // to.Ptr(armcontainerregistry.PipelineOptionsContinueOnErrors)}, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Source: &armcontainerregistry.ImportPipelineSourceProperties{ - // Type: to.Ptr(armcontainerregistry.PipelineSourceTypeAzureStorageBlobContainer), - // KeyVaultURI: to.Ptr("https://myvault.vault.azure.net/secrets/acrimportsas"), - // URI: to.Ptr("https://accountname.blob.core.windows.net/containername"), - // }, - // Trigger: &armcontainerregistry.PipelineTriggerProperties{ - // SourceTrigger: &armcontainerregistry.PipelineSourceTriggerProperties{ - // Status: to.Ptr(armcontainerregistry.TriggerStatusEnabled), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ImportPipelineCreate.json -func ExampleImportPipelinesClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImportPipelinesClient().BeginCreate(ctx, "myResourceGroup", "myRegistry", "myImportPipeline", armcontainerregistry.ImportPipeline{ - Identity: &armcontainerregistry.IdentityProperties{ - Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armcontainerregistry.UserIdentityProperties{ - "/subscriptions/f9d7ebed-adbd-4cb4-b973-aaf82c136138/resourcegroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity2": {}, - }, - }, - Location: to.Ptr("westus"), - Properties: &armcontainerregistry.ImportPipelineProperties{ - Options: []*armcontainerregistry.PipelineOptions{ - to.Ptr(armcontainerregistry.PipelineOptionsOverwriteTags), - to.Ptr(armcontainerregistry.PipelineOptionsDeleteSourceBlobOnSuccess), - to.Ptr(armcontainerregistry.PipelineOptionsContinueOnErrors)}, - Source: &armcontainerregistry.ImportPipelineSourceProperties{ - Type: to.Ptr(armcontainerregistry.PipelineSourceTypeAzureStorageBlobContainer), - KeyVaultURI: to.Ptr("https://myvault.vault.azure.net/secrets/acrimportsas"), - URI: to.Ptr("https://accountname.blob.core.windows.net/containername"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ImportPipeline = armcontainerregistry.ImportPipeline{ - // Name: to.Ptr("myImportPipeline"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/importPipelines"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/importPipelines/myImportPipeline"), - // Identity: &armcontainerregistry.IdentityProperties{ - // Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armcontainerregistry.UserIdentityProperties{ - // "/subscriptions/f9d7ebed-adbd-4cb4-b973-aaf82c136138/resourcegroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity2": &armcontainerregistry.UserIdentityProperties{ - // ClientID: to.Ptr("d3ce1bc2-f7d7-4a5b-9979-950f4e57680e"), - // PrincipalID: to.Ptr("b6p9f58b-6fbf-4efd-a7e0-fvd46911a466"), - // }, - // }, - // }, - // Location: to.Ptr("westus"), - // Properties: &armcontainerregistry.ImportPipelineProperties{ - // Options: []*armcontainerregistry.PipelineOptions{ - // to.Ptr(armcontainerregistry.PipelineOptionsOverwriteTags), - // to.Ptr(armcontainerregistry.PipelineOptionsDeleteSourceBlobOnSuccess), - // to.Ptr(armcontainerregistry.PipelineOptionsContinueOnErrors)}, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Source: &armcontainerregistry.ImportPipelineSourceProperties{ - // Type: to.Ptr(armcontainerregistry.PipelineSourceTypeAzureStorageBlobContainer), - // KeyVaultURI: to.Ptr("https://myvault.vault.azure.net/secrets/acrimportsas"), - // URI: to.Ptr("https://accountname.blob.core.windows.net/containername"), - // }, - // Trigger: &armcontainerregistry.PipelineTriggerProperties{ - // SourceTrigger: &armcontainerregistry.PipelineSourceTriggerProperties{ - // Status: to.Ptr(armcontainerregistry.TriggerStatusEnabled), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ImportPipelineDelete.json -func ExampleImportPipelinesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImportPipelinesClient().BeginDelete(ctx, "myResourceGroup", "myRegistry", "myImportPipeline", 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/containerregistry/armcontainerregistry/models.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/models.go index 01a5f7d680ee..dd92af5b7b9d 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/models.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/models.go @@ -10,12 +10,6 @@ package armcontainerregistry import "time" -// ActivationProperties - The activation properties of the connected registry. -type ActivationProperties struct { - // READ-ONLY; The activation status of the connected registry. - Status *ActivationStatus -} - // ActiveDirectoryObject - The Active Directory Object that will be used for authenticating the token of a container registry. type ActiveDirectoryObject struct { // The user/group/application object ID for Active Directory Object that will be used for authenticating the token of a container @@ -174,12 +168,6 @@ type AuthInfoUpdateParameters struct { TokenType *TokenType } -// AzureADAuthenticationAsArmPolicy - The policy for using ARM audience token for a container registry. -type AzureADAuthenticationAsArmPolicy struct { - // The value that indicates whether the policy is enabled or not. - Status *AzureADAuthenticationAsArmPolicyStatus -} - // BaseImageDependency - Properties that describe a base image dependency. type BaseImageDependency struct { // The sha256-based digest of the image manifest. @@ -300,94 +288,6 @@ type CallbackConfig struct { CustomHeaders map[string]*string } -// ConnectedRegistry - An object that represents a connected registry for a container registry. -type ConnectedRegistry struct { - // The properties of the connected registry. - Properties *ConnectedRegistryProperties - - // READ-ONLY; The resource ID. - ID *string - - // READ-ONLY; The name of the resource. - Name *string - - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData - - // READ-ONLY; The type of the resource. - Type *string -} - -// ConnectedRegistryListResult - The result of a request to list connected registries for a container registry. -type ConnectedRegistryListResult struct { - // The URI that can be used to request the next list of connected registries. - NextLink *string - - // The list of connected registries. Since this list may be incomplete, the nextLink field should be used to request the next - // list of connected registries. - Value []*ConnectedRegistry -} - -// ConnectedRegistryProperties - The properties of a connected registry. -type ConnectedRegistryProperties struct { - // REQUIRED; The mode of the connected registry resource that indicates the permissions of the registry. - Mode *ConnectedRegistryMode - - // REQUIRED; The parent of the connected registry. - Parent *ParentProperties - - // The list of the ACR token resource IDs used to authenticate clients to the connected registry. - ClientTokenIDs []*string - - // The logging properties of the connected registry. - Logging *LoggingProperties - - // The login server properties of the connected registry. - LoginServer *LoginServerProperties - - // The list of notifications subscription information for the connected registry. - NotificationsList []*string - - // READ-ONLY; The activation properties of the connected registry. - Activation *ActivationProperties - - // READ-ONLY; The current connection state of the connected registry. - ConnectionState *ConnectionState - - // READ-ONLY; The last activity time of the connected registry. - LastActivityTime *time.Time - - // READ-ONLY; Provisioning state of the resource. - ProvisioningState *ProvisioningState - - // READ-ONLY; The list of current statuses of the connected registry. - StatusDetails []*StatusDetailProperties - - // READ-ONLY; The current version of ACR runtime on the connected registry. - Version *string -} - -// ConnectedRegistryUpdateParameters - The parameters for updating a connected registry. -type ConnectedRegistryUpdateParameters struct { - // The properties of the connected registry update parameters. - Properties *ConnectedRegistryUpdateProperties -} - -// ConnectedRegistryUpdateProperties - The parameters for updating token properties. -type ConnectedRegistryUpdateProperties struct { - // The list of the ACR token resource IDs used to authenticate clients to the connected registry. - ClientTokenIDs []*string - - // The logging properties of the connected registry. - Logging *LoggingProperties - - // The list of notifications subscription information for the connected registry. - NotificationsList []*string - - // The sync properties of the connected registry with its parent. - SyncProperties *SyncUpdateProperties -} - // CredentialHealth - The health of the auth credential. type CredentialHealth struct { // Error code representing the health check error. @@ -752,10 +652,38 @@ type EncryptionProperty struct { Status *EncryptionStatus } -// ErrorResponse - An error response from the Azure Container Registry service. +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info any + + // READ-ONLY; The additional info type. + Type *string +} + +// ErrorDetail - The error detail. +type ErrorDetail struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo + + // READ-ONLY; The error code. + Code *string + + // READ-ONLY; The error details. + Details []*ErrorDetail + + // READ-ONLY; The error message. + Message *string + + // READ-ONLY; The error target. + Target *string +} + +// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. +// (This also follows the OData error response format.). type ErrorResponse struct { - // Azure container registry build API error body. - Error *ErrorResponseBody + // The error object. + Error *ErrorDetail } // ErrorResponseBody - An error response from the Azure Container Registry service. @@ -773,6 +701,12 @@ type ErrorResponseBody struct { Target *string } +// ErrorResponseForContainerRegistry - An error response from the Azure Container Registry service. +type ErrorResponseForContainerRegistry struct { + // Azure container registry build API error body. + Error *ErrorResponseBody +} + // Event - The event for a webhook. type Event struct { // The event request message sent to the service URI. @@ -861,66 +795,6 @@ type EventResponseMessage struct { Version *string } -// ExportPipeline - An object that represents an export pipeline for a container registry. -type ExportPipeline struct { - // The identity of the export pipeline. - Identity *IdentityProperties - - // The location of the export pipeline. - Location *string - - // The properties of the export pipeline. - Properties *ExportPipelineProperties - - // READ-ONLY; The resource ID. - ID *string - - // READ-ONLY; The name of the resource. - Name *string - - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData - - // READ-ONLY; The type of the resource. - Type *string -} - -// ExportPipelineListResult - The result of a request to list export pipelines for a container registry. -type ExportPipelineListResult struct { - // The URI that can be used to request the next list of pipeline runs. - NextLink *string - - // The list of export pipelines. Since this list may be incomplete, the nextLink field should be used to request the next - // list of export pipelines. - Value []*ExportPipeline -} - -// ExportPipelineProperties - The properties of an export pipeline. -type ExportPipelineProperties struct { - // REQUIRED; The target properties of the export pipeline. - Target *ExportPipelineTargetProperties - - // The list of all options configured for the pipeline. - Options []*PipelineOptions - - // READ-ONLY; The provisioning state of the pipeline at the time the operation was called. - ProvisioningState *ProvisioningState -} - -// ExportPipelineTargetProperties - The properties of the export pipeline target. -type ExportPipelineTargetProperties struct { - // REQUIRED; They key vault secret uri to obtain the target storage SAS token. - KeyVaultURI *string - - // The type of target for the export pipeline. - Type *string - - // The target uri of the export pipeline. When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" - // When 'AzureStorageBlobContainer': - // "https://accountName.blob.core.windows.net/containerName" - URI *string -} - // ExportPolicy - The export policy for a container registry. type ExportPolicy struct { // The value that indicates whether the policy is enabled or not. @@ -1074,12 +948,6 @@ type IPRule struct { // IdentityProperties - Managed identity for the resource. type IdentityProperties struct { - // The principal ID of resource identity. - PrincipalID *string - - // The tenant ID of resource. - TenantID *string - // The identity type. Type *ResourceIdentityType @@ -1087,6 +955,12 @@ type IdentityProperties struct { // ids in the form: // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. UserAssignedIdentities map[string]*UserIdentityProperties + + // READ-ONLY; The principal ID of resource identity. + PrincipalID *string + + // READ-ONLY; The tenant ID of resource. + TenantID *string } // ImageDescriptor - Properties for a registry image. @@ -1132,69 +1006,6 @@ type ImportImageParameters struct { UntaggedTargetRepositories []*string } -// ImportPipeline - An object that represents an import pipeline for a container registry. -type ImportPipeline struct { - // The identity of the import pipeline. - Identity *IdentityProperties - - // The location of the import pipeline. - Location *string - - // The properties of the import pipeline. - Properties *ImportPipelineProperties - - // READ-ONLY; The resource ID. - ID *string - - // READ-ONLY; The name of the resource. - Name *string - - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData - - // READ-ONLY; The type of the resource. - Type *string -} - -// ImportPipelineListResult - The result of a request to list import pipelines for a container registry. -type ImportPipelineListResult struct { - // The URI that can be used to request the next list of pipeline runs. - NextLink *string - - // The list of import pipelines. Since this list may be incomplete, the nextLink field should be used to request the next - // list of import pipelines. - Value []*ImportPipeline -} - -// ImportPipelineProperties - The properties of an import pipeline. -type ImportPipelineProperties struct { - // REQUIRED; The source properties of the import pipeline. - Source *ImportPipelineSourceProperties - - // The list of all options configured for the pipeline. - Options []*PipelineOptions - - // The properties that describe the trigger of the import pipeline. - Trigger *PipelineTriggerProperties - - // READ-ONLY; The provisioning state of the pipeline at the time the operation was called. - ProvisioningState *ProvisioningState -} - -// ImportPipelineSourceProperties - The properties of the import pipeline source. -type ImportPipelineSourceProperties struct { - // REQUIRED; They key vault secret uri to obtain the source storage SAS token. - KeyVaultURI *string - - // The type of source for the import pipeline. - Type *PipelineSourceType - - // The source uri of the import pipeline. When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" - // When 'AzureStorageBlobContainer': - // "https://accountName.blob.core.windows.net/containerName" - URI *string -} - type ImportSource struct { // REQUIRED; Repository name of the source image. Specify an image by repository ('hello-world'). This will use the 'latest' // tag. Specify an image by tag ('hello-world:latest'). Specify an image by sha256-based @@ -1248,24 +1059,6 @@ type KeyVaultProperties struct { VersionedKeyIdentifier *string } -// LoggingProperties - The logging properties of the connected registry. -type LoggingProperties struct { - // Indicates whether audit logs are enabled on the connected registry. - AuditLogStatus *AuditLogStatus - - // The verbosity of logs persisted on the connected registry. - LogLevel *LogLevel -} - -// LoginServerProperties - The login server properties of the connected registry. -type LoginServerProperties struct { - // READ-ONLY; The host of the connected registry. Can be FQDN or IP. - Host *string - - // READ-ONLY; The TLS properties of the connected registry login server. - TLS *TLSProperties -} - // NetworkRuleSet - The network rule set for a container registry. type NetworkRuleSet struct { // REQUIRED; The default action of allow or deny when no other rules match. @@ -1395,147 +1188,6 @@ type PackageType struct { Endpoint *string } -// ParentProperties - The properties of the connected registry parent. -type ParentProperties struct { - // REQUIRED; The sync properties of the connected registry with its parent. - SyncProperties *SyncProperties - - // The resource ID of the parent to which the connected registry will be associated. - ID *string -} - -// PipelineRun - An object that represents a pipeline run for a container registry. -type PipelineRun struct { - // The properties of a pipeline run. - Properties *PipelineRunProperties - - // READ-ONLY; The resource ID. - ID *string - - // READ-ONLY; The name of the resource. - Name *string - - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData - - // READ-ONLY; The type of the resource. - Type *string -} - -// PipelineRunListResult - The result of a request to list pipeline runs for a container registry. -type PipelineRunListResult struct { - // The URI that can be used to request the next list of pipeline runs. - NextLink *string - - // The list of pipeline runs. Since this list may be incomplete, the nextLink field should be used to request the next list - // of pipeline runs. - Value []*PipelineRun -} - -// PipelineRunProperties - The properties of a pipeline run. -type PipelineRunProperties struct { - // How the pipeline run should be forced to recreate even if the pipeline run configuration has not changed. - ForceUpdateTag *string - - // The request parameters for a pipeline run. - Request *PipelineRunRequest - - // READ-ONLY; The provisioning state of a pipeline run. - ProvisioningState *ProvisioningState - - // READ-ONLY; The response of a pipeline run. - Response *PipelineRunResponse -} - -// PipelineRunRequest - The request properties provided for a pipeline run. -type PipelineRunRequest struct { - // List of source artifacts to be transferred by the pipeline. Specify an image by repository ('hello-world'). This will use - // the 'latest' tag. Specify an image by tag ('hello-world:latest'). Specify an - // image by sha256-based manifest digest ('hello-world@sha256:abc123'). - Artifacts []*string - - // The digest of the tar used to transfer the artifacts. - CatalogDigest *string - - // The resource ID of the pipeline to run. - PipelineResourceID *string - - // The source properties of the pipeline run. - Source *PipelineRunSourceProperties - - // The target properties of the pipeline run. - Target *PipelineRunTargetProperties -} - -// PipelineRunResponse - The response properties returned for a pipeline run. -type PipelineRunResponse struct { - // The digest of the tar used to transfer the artifacts. - CatalogDigest *string - - // The time the pipeline run finished. - FinishTime *time.Time - - // The artifacts imported in the pipeline run. - ImportedArtifacts []*string - - // The detailed error message for the pipeline run in the case of failure. - PipelineRunErrorMessage *string - - // The current progress of the copy operation. - Progress *ProgressProperties - - // The source of the pipeline run. - Source *ImportPipelineSourceProperties - - // The time the pipeline run started. - StartTime *time.Time - - // The current status of the pipeline run. - Status *string - - // The target of the pipeline run. - Target *ExportPipelineTargetProperties - - // The trigger that caused the pipeline run. - Trigger *PipelineTriggerDescriptor -} - -type PipelineRunSourceProperties struct { - // The name of the source. - Name *string - - // The type of the source. - Type *PipelineRunSourceType -} - -type PipelineRunTargetProperties struct { - // The name of the target. - Name *string - - // The type of the target. - Type *PipelineRunTargetType -} - -type PipelineSourceTriggerDescriptor struct { - // The timestamp when the source update happened. - Timestamp *time.Time -} - -type PipelineSourceTriggerProperties struct { - // REQUIRED; The current status of the source trigger. - Status *TriggerStatus -} - -type PipelineTriggerDescriptor struct { - // The source trigger that caused the pipeline run. - SourceTrigger *PipelineSourceTriggerDescriptor -} - -type PipelineTriggerProperties struct { - // The source trigger properties of the pipeline. - SourceTrigger *PipelineSourceTriggerProperties -} - // PlatformProperties - The platform properties against which the run has to happen. type PlatformProperties struct { // REQUIRED; The operating system type required for the run. @@ -1562,9 +1214,6 @@ type PlatformUpdateParameters struct { // Policies - The policies for a container registry. type Policies struct { - // The policy for using ARM audience token for a container registry. - AzureADAuthenticationAsArmPolicy *AzureADAuthenticationAsArmPolicy - // The export policy for a container registry. ExportPolicy *ExportPolicy @@ -1574,9 +1223,6 @@ type Policies struct { // The retention policy for a container registry. RetentionPolicy *RetentionPolicy - // The soft delete policy for a container registry. - SoftDeletePolicy *SoftDeletePolicy - // The content trust policy for a container registry. TrustPolicy *TrustPolicy } @@ -1676,11 +1322,6 @@ type PrivateLinkServiceConnectionState struct { Status *ConnectionStatus } -type ProgressProperties struct { - // The percentage complete of the copy operation. - Percentage *string -} - // ProxyResource - The resource model definition for a ARM proxy resource. It will have everything other than required location // and tags. type ProxyResource struct { @@ -1794,9 +1435,6 @@ type RegistryProperties struct { // The value that indicates whether the admin user is enabled. AdminUserEnabled *bool - // Enables registry-wide pull from unauthenticated clients. - AnonymousPullEnabled *bool - // Enable a single data endpoint per region for serving data. DataEndpointEnabled *bool @@ -1842,9 +1480,6 @@ type RegistryPropertiesUpdateParameters struct { // The value that indicates whether the admin user is enabled. AdminUserEnabled *bool - // Enables registry-wide pull from unauthenticated clients. - AnonymousPullEnabled *bool - // Enable a single data endpoint per region for serving data. DataEndpointEnabled *bool @@ -2271,18 +1906,6 @@ type SetValue struct { IsSecret *bool } -// SoftDeletePolicy - The soft delete policy for a container registry -type SoftDeletePolicy struct { - // The number of days after which a soft-deleted item is permanently deleted. - RetentionDays *int32 - - // The value that indicates whether the policy is enabled or not. - Status *PolicyStatus - - // READ-ONLY; The timestamp when the policy was last updated. - LastUpdatedTime *time.Time -} - // Source - The registry node that generated the event. Put differently, while the actor initiates the event, the source generates // it. type Source struct { @@ -2407,67 +2030,12 @@ type Status struct { Timestamp *time.Time } -// StatusDetailProperties - The status detail properties of the connected registry. -type StatusDetailProperties struct { - // READ-ONLY; The code of the status. - Code *string - - // READ-ONLY; The correlation ID of the status. - CorrelationID *string - - // READ-ONLY; The description of the status. - Description *string - - // READ-ONLY; The timestamp of the status. - Timestamp *time.Time - - // READ-ONLY; The component of the connected registry corresponding to the status. - Type *string -} - // StorageAccountProperties - The properties of a storage account for a container registry. Only applicable to Classic SKU. type StorageAccountProperties struct { // REQUIRED; The resource ID of the storage account. ID *string } -// SyncProperties - The sync properties of the connected registry with its parent. -type SyncProperties struct { - // REQUIRED; The period of time for which a message is available to sync before it is expired. Specify the duration using - // the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. - MessageTTL *string - - // REQUIRED; The resource ID of the ACR token used to authenticate the connected registry to its parent during sync. - TokenID *string - - // The cron expression indicating the schedule that the connected registry will sync with its parent. - Schedule *string - - // The time window during which sync is enabled for each schedule occurrence. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S - // as per ISO8601. - SyncWindow *string - - // READ-ONLY; The gateway endpoint used by the connected registry to communicate with its parent. - GatewayEndpoint *string - - // READ-ONLY; The last time a sync occurred between the connected registry and its parent. - LastSyncTime *time.Time -} - -// SyncUpdateProperties - The parameters for updating the sync properties of the connected registry with its parent. -type SyncUpdateProperties struct { - // The period of time for which a message is available to sync before it is expired. Specify the duration using the format - // P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. - MessageTTL *string - - // The cron expression indicating the schedule that the connected registry will sync with its parent. - Schedule *string - - // The time window during which sync is enabled for each schedule occurrence. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S - // as per ISO8601. - SyncWindow *string -} - // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // The timestamp of resource creation (UTC). @@ -2489,24 +2057,6 @@ type SystemData struct { LastModifiedByType *LastModifiedByType } -// TLSCertificateProperties - The TLS certificate properties of the connected registry login server. -type TLSCertificateProperties struct { - // READ-ONLY; Indicates the location of the certificates. - Location *string - - // READ-ONLY; The type of certificate location. - Type *CertificateType -} - -// TLSProperties - The TLS properties of the connected registry login server. -type TLSProperties struct { - // READ-ONLY; The certificate used to configure HTTPS for the login server. - Certificate *TLSCertificateProperties - - // READ-ONLY; Indicates whether HTTPS is enabled for the login server. - Status *TLSStatus -} - // Target - The target of the event. type Target struct { // The digest of the content, as defined by the Registry V2 HTTP API Specification. @@ -2955,10 +2505,10 @@ type TrustPolicy struct { } type UserIdentityProperties struct { - // The client id of user assigned identity. + // READ-ONLY; The client id of user assigned identity. ClientID *string - // The principal id of user assigned identity. + // READ-ONLY; The principal id of user assigned identity. PrincipalID *string } diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/models_serde.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/models_serde.go index 7f686e4b2b96..c445fdd690cd 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/models_serde.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/models_serde.go @@ -15,33 +15,6 @@ import ( "reflect" ) -// MarshalJSON implements the json.Marshaller interface for type ActivationProperties. -func (a ActivationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "status", a.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ActivationProperties. -func (a *ActivationProperties) 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", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "status": - err = unpopulate(val, "Status", &a.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type ActiveDirectoryObject. func (a ActiveDirectoryObject) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -497,33 +470,6 @@ func (a *AuthInfoUpdateParameters) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureADAuthenticationAsArmPolicy. -func (a AzureADAuthenticationAsArmPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "status", a.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureADAuthenticationAsArmPolicy. -func (a *AzureADAuthenticationAsArmPolicy) 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", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "status": - err = unpopulate(val, "Status", &a.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type BaseImageDependency. func (b BaseImageDependency) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -855,217 +801,6 @@ func (c *CallbackConfig) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ConnectedRegistry. -func (c ConnectedRegistry) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", c.ID) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "systemData", c.SystemData) - populate(objectMap, "type", c.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedRegistry. -func (c *ConnectedRegistry) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &c.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &c.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &c.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &c.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ConnectedRegistryListResult. -func (c ConnectedRegistryListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", c.NextLink) - populate(objectMap, "value", c.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedRegistryListResult. -func (c *ConnectedRegistryListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &c.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &c.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ConnectedRegistryProperties. -func (c ConnectedRegistryProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "activation", c.Activation) - populate(objectMap, "clientTokenIds", c.ClientTokenIDs) - populate(objectMap, "connectionState", c.ConnectionState) - populateTimeRFC3339(objectMap, "lastActivityTime", c.LastActivityTime) - populate(objectMap, "logging", c.Logging) - populate(objectMap, "loginServer", c.LoginServer) - populate(objectMap, "mode", c.Mode) - populate(objectMap, "notificationsList", c.NotificationsList) - populate(objectMap, "parent", c.Parent) - populate(objectMap, "provisioningState", c.ProvisioningState) - populate(objectMap, "statusDetails", c.StatusDetails) - populate(objectMap, "version", c.Version) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedRegistryProperties. -func (c *ConnectedRegistryProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "activation": - err = unpopulate(val, "Activation", &c.Activation) - delete(rawMsg, key) - case "clientTokenIds": - err = unpopulate(val, "ClientTokenIDs", &c.ClientTokenIDs) - delete(rawMsg, key) - case "connectionState": - err = unpopulate(val, "ConnectionState", &c.ConnectionState) - delete(rawMsg, key) - case "lastActivityTime": - err = unpopulateTimeRFC3339(val, "LastActivityTime", &c.LastActivityTime) - delete(rawMsg, key) - case "logging": - err = unpopulate(val, "Logging", &c.Logging) - delete(rawMsg, key) - case "loginServer": - err = unpopulate(val, "LoginServer", &c.LoginServer) - delete(rawMsg, key) - case "mode": - err = unpopulate(val, "Mode", &c.Mode) - delete(rawMsg, key) - case "notificationsList": - err = unpopulate(val, "NotificationsList", &c.NotificationsList) - delete(rawMsg, key) - case "parent": - err = unpopulate(val, "Parent", &c.Parent) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) - delete(rawMsg, key) - case "statusDetails": - err = unpopulate(val, "StatusDetails", &c.StatusDetails) - delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &c.Version) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ConnectedRegistryUpdateParameters. -func (c ConnectedRegistryUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "properties", c.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedRegistryUpdateParameters. -func (c *ConnectedRegistryUpdateParameters) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "properties": - err = unpopulate(val, "Properties", &c.Properties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ConnectedRegistryUpdateProperties. -func (c ConnectedRegistryUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "clientTokenIds", c.ClientTokenIDs) - populate(objectMap, "logging", c.Logging) - populate(objectMap, "notificationsList", c.NotificationsList) - populate(objectMap, "syncProperties", c.SyncProperties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedRegistryUpdateProperties. -func (c *ConnectedRegistryUpdateProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "clientTokenIds": - err = unpopulate(val, "ClientTokenIDs", &c.ClientTokenIDs) - delete(rawMsg, key) - case "logging": - err = unpopulate(val, "Logging", &c.Logging) - delete(rawMsg, key) - case "notificationsList": - err = unpopulate(val, "NotificationsList", &c.NotificationsList) - delete(rawMsg, key) - case "syncProperties": - err = unpopulate(val, "SyncProperties", &c.SyncProperties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type CredentialHealth. func (c CredentialHealth) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1747,15 +1482,16 @@ func (e *EncryptionProperty) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. -func (e ErrorResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "error", e.Error) + populateAny(objectMap, "info", e.Info) + populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. -func (e *ErrorResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) 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) @@ -1763,8 +1499,11 @@ func (e *ErrorResponse) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) + case "info": + err = unpopulate(val, "Info", &e.Info) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { @@ -1774,9 +1513,10 @@ func (e *ErrorResponse) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponseBody. -func (e ErrorResponseBody) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "additionalInfo", e.AdditionalInfo) populate(objectMap, "code", e.Code) populate(objectMap, "details", e.Details) populate(objectMap, "message", e.Message) @@ -1784,8 +1524,8 @@ func (e ErrorResponseBody) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseBody. -func (e *ErrorResponseBody) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) 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) @@ -1793,6 +1533,9 @@ func (e *ErrorResponseBody) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) case "code": err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) @@ -1813,17 +1556,15 @@ func (e *ErrorResponseBody) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Event. -func (e Event) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eventRequestMessage", e.EventRequestMessage) - populate(objectMap, "eventResponseMessage", e.EventResponseMessage) - populate(objectMap, "id", e.ID) + populate(objectMap, "error", e.Error) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Event. -func (e *Event) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) 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) @@ -1831,14 +1572,8 @@ func (e *Event) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "eventRequestMessage": - err = unpopulate(val, "EventRequestMessage", &e.EventRequestMessage) - delete(rawMsg, key) - case "eventResponseMessage": - err = unpopulate(val, "EventResponseMessage", &e.EventResponseMessage) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &e.ID) + case "error": + err = unpopulate(val, "Error", &e.Error) delete(rawMsg, key) } if err != nil { @@ -1848,21 +1583,18 @@ func (e *Event) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type EventContent. -func (e EventContent) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseBody. +func (e ErrorResponseBody) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "action", e.Action) - populate(objectMap, "actor", e.Actor) - populate(objectMap, "id", e.ID) - populate(objectMap, "request", e.Request) - populate(objectMap, "source", e.Source) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) populate(objectMap, "target", e.Target) - populateTimeRFC3339(objectMap, "timestamp", e.Timestamp) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EventContent. -func (e *EventContent) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseBody. +func (e *ErrorResponseBody) 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) @@ -1870,27 +1602,18 @@ func (e *EventContent) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "action": - err = unpopulate(val, "Action", &e.Action) + case "code": + err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) - case "actor": - err = unpopulate(val, "Actor", &e.Actor) + case "details": + err = unpopulate(val, "Details", &e.Details) delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &e.ID) - delete(rawMsg, key) - case "request": - err = unpopulate(val, "Request", &e.Request) - delete(rawMsg, key) - case "source": - err = unpopulate(val, "Source", &e.Source) + case "message": + err = unpopulate(val, "Message", &e.Message) delete(rawMsg, key) case "target": err = unpopulate(val, "Target", &e.Target) delete(rawMsg, key) - case "timestamp": - err = unpopulateTimeRFC3339(val, "Timestamp", &e.Timestamp) - delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) @@ -1899,15 +1622,15 @@ func (e *EventContent) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type EventInfo. -func (e EventInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseForContainerRegistry. +func (e ErrorResponseForContainerRegistry) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", e.ID) + populate(objectMap, "error", e.Error) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EventInfo. -func (e *EventInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseForContainerRegistry. +func (e *ErrorResponseForContainerRegistry) 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) @@ -1915,8 +1638,8 @@ func (e *EventInfo) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &e.ID) + case "error": + err = unpopulate(val, "Error", &e.Error) delete(rawMsg, key) } if err != nil { @@ -1926,16 +1649,17 @@ func (e *EventInfo) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type EventListResult. -func (e EventListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Event. +func (e Event) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", e.NextLink) - populate(objectMap, "value", e.Value) + populate(objectMap, "eventRequestMessage", e.EventRequestMessage) + populate(objectMap, "eventResponseMessage", e.EventResponseMessage) + populate(objectMap, "id", e.ID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EventListResult. -func (e *EventListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Event. +func (e *Event) 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) @@ -1943,11 +1667,14 @@ func (e *EventListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &e.NextLink) + case "eventRequestMessage": + err = unpopulate(val, "EventRequestMessage", &e.EventRequestMessage) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &e.Value) + case "eventResponseMessage": + err = unpopulate(val, "EventResponseMessage", &e.EventResponseMessage) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) delete(rawMsg, key) } if err != nil { @@ -1957,19 +1684,21 @@ func (e *EventListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type EventRequestMessage. -func (e EventRequestMessage) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EventContent. +func (e EventContent) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "content", e.Content) - populate(objectMap, "headers", e.Headers) - populate(objectMap, "method", e.Method) - populate(objectMap, "requestUri", e.RequestURI) - populate(objectMap, "version", e.Version) + populate(objectMap, "action", e.Action) + populate(objectMap, "actor", e.Actor) + populate(objectMap, "id", e.ID) + populate(objectMap, "request", e.Request) + populate(objectMap, "source", e.Source) + populate(objectMap, "target", e.Target) + populateTimeRFC3339(objectMap, "timestamp", e.Timestamp) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EventRequestMessage. -func (e *EventRequestMessage) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EventContent. +func (e *EventContent) 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) @@ -1977,63 +1706,26 @@ func (e *EventRequestMessage) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "content": - err = unpopulate(val, "Content", &e.Content) - delete(rawMsg, key) - case "headers": - err = unpopulate(val, "Headers", &e.Headers) - delete(rawMsg, key) - case "method": - err = unpopulate(val, "Method", &e.Method) - delete(rawMsg, key) - case "requestUri": - err = unpopulate(val, "RequestURI", &e.RequestURI) + case "action": + err = unpopulate(val, "Action", &e.Action) delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &e.Version) + case "actor": + err = unpopulate(val, "Actor", &e.Actor) 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 EventResponseMessage. -func (e EventResponseMessage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "content", e.Content) - populate(objectMap, "headers", e.Headers) - populate(objectMap, "reasonPhrase", e.ReasonPhrase) - populate(objectMap, "statusCode", e.StatusCode) - populate(objectMap, "version", e.Version) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EventResponseMessage. -func (e *EventResponseMessage) 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 "content": - err = unpopulate(val, "Content", &e.Content) + case "id": + err = unpopulate(val, "ID", &e.ID) delete(rawMsg, key) - case "headers": - err = unpopulate(val, "Headers", &e.Headers) + case "request": + err = unpopulate(val, "Request", &e.Request) delete(rawMsg, key) - case "reasonPhrase": - err = unpopulate(val, "ReasonPhrase", &e.ReasonPhrase) + case "source": + err = unpopulate(val, "Source", &e.Source) delete(rawMsg, key) - case "statusCode": - err = unpopulate(val, "StatusCode", &e.StatusCode) + case "target": + err = unpopulate(val, "Target", &e.Target) delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &e.Version) + case "timestamp": + err = unpopulateTimeRFC3339(val, "Timestamp", &e.Timestamp) delete(rawMsg, key) } if err != nil { @@ -2043,21 +1735,15 @@ func (e *EventResponseMessage) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ExportPipeline. -func (e ExportPipeline) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EventInfo. +func (e EventInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", e.ID) - populate(objectMap, "identity", e.Identity) - populate(objectMap, "location", e.Location) - populate(objectMap, "name", e.Name) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "systemData", e.SystemData) - populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExportPipeline. -func (e *ExportPipeline) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EventInfo. +func (e *EventInfo) 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) @@ -2068,24 +1754,6 @@ func (e *ExportPipeline) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &e.ID) delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &e.Identity) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &e.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &e.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &e.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) - delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) @@ -2094,16 +1762,16 @@ func (e *ExportPipeline) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ExportPipelineListResult. -func (e ExportPipelineListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EventListResult. +func (e EventListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", e.NextLink) populate(objectMap, "value", e.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExportPipelineListResult. -func (e *ExportPipelineListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EventListResult. +func (e *EventListResult) 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) @@ -2125,17 +1793,19 @@ func (e *ExportPipelineListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ExportPipelineProperties. -func (e ExportPipelineProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EventRequestMessage. +func (e EventRequestMessage) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "options", e.Options) - populate(objectMap, "provisioningState", e.ProvisioningState) - populate(objectMap, "target", e.Target) + populate(objectMap, "content", e.Content) + populate(objectMap, "headers", e.Headers) + populate(objectMap, "method", e.Method) + populate(objectMap, "requestUri", e.RequestURI) + populate(objectMap, "version", e.Version) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExportPipelineProperties. -func (e *ExportPipelineProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EventRequestMessage. +func (e *EventRequestMessage) 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) @@ -2143,14 +1813,20 @@ func (e *ExportPipelineProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "options": - err = unpopulate(val, "Options", &e.Options) + case "content": + err = unpopulate(val, "Content", &e.Content) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + case "headers": + err = unpopulate(val, "Headers", &e.Headers) delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &e.Target) + case "method": + err = unpopulate(val, "Method", &e.Method) + delete(rawMsg, key) + case "requestUri": + err = unpopulate(val, "RequestURI", &e.RequestURI) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &e.Version) delete(rawMsg, key) } if err != nil { @@ -2160,17 +1836,19 @@ func (e *ExportPipelineProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ExportPipelineTargetProperties. -func (e ExportPipelineTargetProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EventResponseMessage. +func (e EventResponseMessage) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "keyVaultUri", e.KeyVaultURI) - populate(objectMap, "type", e.Type) - populate(objectMap, "uri", e.URI) + populate(objectMap, "content", e.Content) + populate(objectMap, "headers", e.Headers) + populate(objectMap, "reasonPhrase", e.ReasonPhrase) + populate(objectMap, "statusCode", e.StatusCode) + populate(objectMap, "version", e.Version) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExportPipelineTargetProperties. -func (e *ExportPipelineTargetProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EventResponseMessage. +func (e *EventResponseMessage) 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) @@ -2178,14 +1856,20 @@ func (e *ExportPipelineTargetProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "keyVaultUri": - err = unpopulate(val, "KeyVaultURI", &e.KeyVaultURI) + case "content": + err = unpopulate(val, "Content", &e.Content) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) + case "headers": + err = unpopulate(val, "Headers", &e.Headers) + delete(rawMsg, key) + case "reasonPhrase": + err = unpopulate(val, "ReasonPhrase", &e.ReasonPhrase) + delete(rawMsg, key) + case "statusCode": + err = unpopulate(val, "StatusCode", &e.StatusCode) delete(rawMsg, key) - case "uri": - err = unpopulate(val, "URI", &e.URI) + case "version": + err = unpopulate(val, "Version", &e.Version) delete(rawMsg, key) } if err != nil { @@ -2640,21 +2324,18 @@ func (i *ImportImageParameters) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ImportPipeline. -func (i ImportPipeline) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ImportSource. +func (i ImportSource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", i.ID) - populate(objectMap, "identity", i.Identity) - populate(objectMap, "location", i.Location) - populate(objectMap, "name", i.Name) - populate(objectMap, "properties", i.Properties) - populate(objectMap, "systemData", i.SystemData) - populate(objectMap, "type", i.Type) + populate(objectMap, "credentials", i.Credentials) + populate(objectMap, "registryUri", i.RegistryURI) + populate(objectMap, "resourceId", i.ResourceID) + populate(objectMap, "sourceImage", i.SourceImage) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ImportPipeline. -func (i *ImportPipeline) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ImportSource. +func (i *ImportSource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", i, err) @@ -2662,26 +2343,17 @@ func (i *ImportPipeline) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &i.ID) - delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &i.Identity) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &i.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &i.Name) + case "credentials": + err = unpopulate(val, "Credentials", &i.Credentials) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &i.Properties) + case "registryUri": + err = unpopulate(val, "RegistryURI", &i.RegistryURI) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &i.SystemData) + case "resourceId": + err = unpopulate(val, "ResourceID", &i.ResourceID) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) + case "sourceImage": + err = unpopulate(val, "SourceImage", &i.SourceImage) delete(rawMsg, key) } if err != nil { @@ -2691,16 +2363,16 @@ func (i *ImportPipeline) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ImportPipelineListResult. -func (i ImportPipelineListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ImportSourceCredentials. +func (i ImportSourceCredentials) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", i.NextLink) - populate(objectMap, "value", i.Value) + populate(objectMap, "password", i.Password) + populate(objectMap, "username", i.Username) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ImportPipelineListResult. -func (i *ImportPipelineListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ImportSourceCredentials. +func (i *ImportSourceCredentials) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", i, err) @@ -2708,11 +2380,11 @@ func (i *ImportPipelineListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &i.NextLink) + case "password": + err = unpopulate(val, "Password", &i.Password) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &i.Value) + case "username": + err = unpopulate(val, "Username", &i.Username) delete(rawMsg, key) } if err != nil { @@ -2722,18 +2394,17 @@ func (i *ImportPipelineListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ImportPipelineProperties. -func (i ImportPipelineProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type InnerErrorDescription. +func (i InnerErrorDescription) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "options", i.Options) - populate(objectMap, "provisioningState", i.ProvisioningState) - populate(objectMap, "source", i.Source) - populate(objectMap, "trigger", i.Trigger) + populate(objectMap, "code", i.Code) + populate(objectMap, "message", i.Message) + populate(objectMap, "target", i.Target) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ImportPipelineProperties. -func (i *ImportPipelineProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type InnerErrorDescription. +func (i *InnerErrorDescription) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", i, err) @@ -2741,151 +2412,8 @@ func (i *ImportPipelineProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "options": - err = unpopulate(val, "Options", &i.Options) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &i.ProvisioningState) - delete(rawMsg, key) - case "source": - err = unpopulate(val, "Source", &i.Source) - delete(rawMsg, key) - case "trigger": - err = unpopulate(val, "Trigger", &i.Trigger) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ImportPipelineSourceProperties. -func (i ImportPipelineSourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "keyVaultUri", i.KeyVaultURI) - populate(objectMap, "type", i.Type) - populate(objectMap, "uri", i.URI) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ImportPipelineSourceProperties. -func (i *ImportPipelineSourceProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "keyVaultUri": - err = unpopulate(val, "KeyVaultURI", &i.KeyVaultURI) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) - delete(rawMsg, key) - case "uri": - err = unpopulate(val, "URI", &i.URI) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ImportSource. -func (i ImportSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "credentials", i.Credentials) - populate(objectMap, "registryUri", i.RegistryURI) - populate(objectMap, "resourceId", i.ResourceID) - populate(objectMap, "sourceImage", i.SourceImage) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ImportSource. -func (i *ImportSource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "credentials": - err = unpopulate(val, "Credentials", &i.Credentials) - delete(rawMsg, key) - case "registryUri": - err = unpopulate(val, "RegistryURI", &i.RegistryURI) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &i.ResourceID) - delete(rawMsg, key) - case "sourceImage": - err = unpopulate(val, "SourceImage", &i.SourceImage) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ImportSourceCredentials. -func (i ImportSourceCredentials) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "password", i.Password) - populate(objectMap, "username", i.Username) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ImportSourceCredentials. -func (i *ImportSourceCredentials) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "password": - err = unpopulate(val, "Password", &i.Password) - delete(rawMsg, key) - case "username": - err = unpopulate(val, "Username", &i.Username) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type InnerErrorDescription. -func (i InnerErrorDescription) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "code", i.Code) - populate(objectMap, "message", i.Message) - populate(objectMap, "target", i.Target) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type InnerErrorDescription. -func (i *InnerErrorDescription) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "code": - err = unpopulate(val, "Code", &i.Code) + case "code": + err = unpopulate(val, "Code", &i.Code) delete(rawMsg, key) case "message": err = unpopulate(val, "Message", &i.Message) @@ -2944,68 +2472,6 @@ func (k *KeyVaultProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type LoggingProperties. -func (l LoggingProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "auditLogStatus", l.AuditLogStatus) - populate(objectMap, "logLevel", l.LogLevel) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LoggingProperties. -func (l *LoggingProperties) 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 "auditLogStatus": - err = unpopulate(val, "AuditLogStatus", &l.AuditLogStatus) - delete(rawMsg, key) - case "logLevel": - err = unpopulate(val, "LogLevel", &l.LogLevel) - 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 LoginServerProperties. -func (l LoginServerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "host", l.Host) - populate(objectMap, "tls", l.TLS) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LoginServerProperties. -func (l *LoginServerProperties) 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 "host": - err = unpopulate(val, "Host", &l.Host) - delete(rawMsg, key) - case "tls": - err = unpopulate(val, "TLS", &l.TLS) - 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 NetworkRuleSet. func (n NetworkRuleSet) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3253,523 +2719,100 @@ func (o *OperationPropertiesDefinition) UnmarshalJSON(data []byte) error { 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 OperationServiceSpecificationDefinition. -func (o OperationServiceSpecificationDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "logSpecifications", o.LogSpecifications) - populate(objectMap, "metricSpecifications", o.MetricSpecifications) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationServiceSpecificationDefinition. -func (o *OperationServiceSpecificationDefinition) 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 "logSpecifications": - err = unpopulate(val, "LogSpecifications", &o.LogSpecifications) - delete(rawMsg, key) - case "metricSpecifications": - err = unpopulate(val, "MetricSpecifications", &o.MetricSpecifications) - 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 OverrideTaskStepProperties. -func (o OverrideTaskStepProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "arguments", o.Arguments) - populate(objectMap, "contextPath", o.ContextPath) - populate(objectMap, "file", o.File) - populate(objectMap, "target", o.Target) - populate(objectMap, "updateTriggerToken", o.UpdateTriggerToken) - populate(objectMap, "values", o.Values) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OverrideTaskStepProperties. -func (o *OverrideTaskStepProperties) 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 "arguments": - err = unpopulate(val, "Arguments", &o.Arguments) - delete(rawMsg, key) - case "contextPath": - err = unpopulate(val, "ContextPath", &o.ContextPath) - delete(rawMsg, key) - case "file": - err = unpopulate(val, "File", &o.File) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &o.Target) - delete(rawMsg, key) - case "updateTriggerToken": - err = unpopulate(val, "UpdateTriggerToken", &o.UpdateTriggerToken) - delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &o.Values) - 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 PackageType. -func (p PackageType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "endpoint", p.Endpoint) - populate(objectMap, "name", p.Name) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PackageType. -func (p *PackageType) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endpoint": - err = unpopulate(val, "Endpoint", &p.Endpoint) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ParentProperties. -func (p ParentProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "syncProperties", p.SyncProperties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ParentProperties. -func (p *ParentProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "syncProperties": - err = unpopulate(val, "SyncProperties", &p.SyncProperties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PipelineRun. -func (p PipelineRun) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "systemData", p.SystemData) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineRun. -func (p *PipelineRun) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &p.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PipelineRunListResult. -func (p PipelineRunListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineRunListResult. -func (p *PipelineRunListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PipelineRunProperties. -func (p PipelineRunProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "forceUpdateTag", p.ForceUpdateTag) - populate(objectMap, "provisioningState", p.ProvisioningState) - populate(objectMap, "request", p.Request) - populate(objectMap, "response", p.Response) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineRunProperties. -func (p *PipelineRunProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "forceUpdateTag": - err = unpopulate(val, "ForceUpdateTag", &p.ForceUpdateTag) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) - delete(rawMsg, key) - case "request": - err = unpopulate(val, "Request", &p.Request) - delete(rawMsg, key) - case "response": - err = unpopulate(val, "Response", &p.Response) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PipelineRunRequest. -func (p PipelineRunRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "artifacts", p.Artifacts) - populate(objectMap, "catalogDigest", p.CatalogDigest) - populate(objectMap, "pipelineResourceId", p.PipelineResourceID) - populate(objectMap, "source", p.Source) - populate(objectMap, "target", p.Target) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineRunRequest. -func (p *PipelineRunRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "artifacts": - err = unpopulate(val, "Artifacts", &p.Artifacts) - delete(rawMsg, key) - case "catalogDigest": - err = unpopulate(val, "CatalogDigest", &p.CatalogDigest) - delete(rawMsg, key) - case "pipelineResourceId": - err = unpopulate(val, "PipelineResourceID", &p.PipelineResourceID) - delete(rawMsg, key) - case "source": - err = unpopulate(val, "Source", &p.Source) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &p.Target) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PipelineRunResponse. -func (p PipelineRunResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "catalogDigest", p.CatalogDigest) - populateTimeRFC3339(objectMap, "finishTime", p.FinishTime) - populate(objectMap, "importedArtifacts", p.ImportedArtifacts) - populate(objectMap, "pipelineRunErrorMessage", p.PipelineRunErrorMessage) - populate(objectMap, "progress", p.Progress) - populate(objectMap, "source", p.Source) - populateTimeRFC3339(objectMap, "startTime", p.StartTime) - populate(objectMap, "status", p.Status) - populate(objectMap, "target", p.Target) - populate(objectMap, "trigger", p.Trigger) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineRunResponse. -func (p *PipelineRunResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "catalogDigest": - err = unpopulate(val, "CatalogDigest", &p.CatalogDigest) - delete(rawMsg, key) - case "finishTime": - err = unpopulateTimeRFC3339(val, "FinishTime", &p.FinishTime) - delete(rawMsg, key) - case "importedArtifacts": - err = unpopulate(val, "ImportedArtifacts", &p.ImportedArtifacts) - delete(rawMsg, key) - case "pipelineRunErrorMessage": - err = unpopulate(val, "PipelineRunErrorMessage", &p.PipelineRunErrorMessage) - delete(rawMsg, key) - case "progress": - err = unpopulate(val, "Progress", &p.Progress) - delete(rawMsg, key) - case "source": - err = unpopulate(val, "Source", &p.Source) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, "StartTime", &p.StartTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &p.Status) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &p.Target) - delete(rawMsg, key) - case "trigger": - err = unpopulate(val, "Trigger", &p.Trigger) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PipelineRunSourceProperties. -func (p PipelineRunSourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", p.Name) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineRunSourceProperties. -func (p *PipelineRunSourceProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PipelineRunTargetProperties. -func (p PipelineRunTargetProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", p.Name) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineRunTargetProperties. -func (p *PipelineRunTargetProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PipelineSourceTriggerDescriptor. -func (p PipelineSourceTriggerDescriptor) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "timestamp", p.Timestamp) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineSourceTriggerDescriptor. -func (p *PipelineSourceTriggerDescriptor) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "timestamp": - err = unpopulateTimeRFC3339(val, "Timestamp", &p.Timestamp) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PipelineSourceTriggerProperties. -func (p PipelineSourceTriggerProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationServiceSpecificationDefinition. +func (o OperationServiceSpecificationDefinition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "status", p.Status) + populate(objectMap, "logSpecifications", o.LogSpecifications) + populate(objectMap, "metricSpecifications", o.MetricSpecifications) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineSourceTriggerProperties. -func (p *PipelineSourceTriggerProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationServiceSpecificationDefinition. +func (o *OperationServiceSpecificationDefinition) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "status": - err = unpopulate(val, "Status", &p.Status) + case "logSpecifications": + err = unpopulate(val, "LogSpecifications", &o.LogSpecifications) + delete(rawMsg, key) + case "metricSpecifications": + err = unpopulate(val, "MetricSpecifications", &o.MetricSpecifications) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PipelineTriggerDescriptor. -func (p PipelineTriggerDescriptor) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OverrideTaskStepProperties. +func (o OverrideTaskStepProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "sourceTrigger", p.SourceTrigger) + populate(objectMap, "arguments", o.Arguments) + populate(objectMap, "contextPath", o.ContextPath) + populate(objectMap, "file", o.File) + populate(objectMap, "target", o.Target) + populate(objectMap, "updateTriggerToken", o.UpdateTriggerToken) + populate(objectMap, "values", o.Values) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineTriggerDescriptor. -func (p *PipelineTriggerDescriptor) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OverrideTaskStepProperties. +func (o *OverrideTaskStepProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "sourceTrigger": - err = unpopulate(val, "SourceTrigger", &p.SourceTrigger) + case "arguments": + err = unpopulate(val, "Arguments", &o.Arguments) + delete(rawMsg, key) + case "contextPath": + err = unpopulate(val, "ContextPath", &o.ContextPath) + delete(rawMsg, key) + case "file": + err = unpopulate(val, "File", &o.File) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &o.Target) + delete(rawMsg, key) + case "updateTriggerToken": + err = unpopulate(val, "UpdateTriggerToken", &o.UpdateTriggerToken) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &o.Values) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PipelineTriggerProperties. -func (p PipelineTriggerProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PackageType. +func (p PackageType) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "sourceTrigger", p.SourceTrigger) + populate(objectMap, "endpoint", p.Endpoint) + populate(objectMap, "name", p.Name) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineTriggerProperties. -func (p *PipelineTriggerProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PackageType. +func (p *PackageType) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -3777,8 +2820,11 @@ func (p *PipelineTriggerProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "sourceTrigger": - err = unpopulate(val, "SourceTrigger", &p.SourceTrigger) + case "endpoint": + err = unpopulate(val, "Endpoint", &p.Endpoint) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) } if err != nil { @@ -3861,11 +2907,9 @@ func (p *PlatformUpdateParameters) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Policies. func (p Policies) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "azureADAuthenticationAsArmPolicy", p.AzureADAuthenticationAsArmPolicy) populate(objectMap, "exportPolicy", p.ExportPolicy) populate(objectMap, "quarantinePolicy", p.QuarantinePolicy) populate(objectMap, "retentionPolicy", p.RetentionPolicy) - populate(objectMap, "softDeletePolicy", p.SoftDeletePolicy) populate(objectMap, "trustPolicy", p.TrustPolicy) return json.Marshal(objectMap) } @@ -3879,9 +2923,6 @@ func (p *Policies) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "azureADAuthenticationAsArmPolicy": - err = unpopulate(val, "AzureADAuthenticationAsArmPolicy", &p.AzureADAuthenticationAsArmPolicy) - delete(rawMsg, key) case "exportPolicy": err = unpopulate(val, "ExportPolicy", &p.ExportPolicy) delete(rawMsg, key) @@ -3891,9 +2932,6 @@ func (p *Policies) UnmarshalJSON(data []byte) error { case "retentionPolicy": err = unpopulate(val, "RetentionPolicy", &p.RetentionPolicy) delete(rawMsg, key) - case "softDeletePolicy": - err = unpopulate(val, "SoftDeletePolicy", &p.SoftDeletePolicy) - delete(rawMsg, key) case "trustPolicy": err = unpopulate(val, "TrustPolicy", &p.TrustPolicy) delete(rawMsg, key) @@ -4181,33 +3219,6 @@ func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ProgressProperties. -func (p ProgressProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "percentage", p.Percentage) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProgressProperties. -func (p *ProgressProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "percentage": - err = unpopulate(val, "Percentage", &p.Percentage) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type ProxyResource. func (p ProxyResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -4523,7 +3534,6 @@ func (r *RegistryPassword) UnmarshalJSON(data []byte) error { func (r RegistryProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "adminUserEnabled", r.AdminUserEnabled) - populate(objectMap, "anonymousPullEnabled", r.AnonymousPullEnabled) populateTimeRFC3339(objectMap, "creationDate", r.CreationDate) populate(objectMap, "dataEndpointEnabled", r.DataEndpointEnabled) populate(objectMap, "dataEndpointHostNames", r.DataEndpointHostNames) @@ -4552,9 +3562,6 @@ func (r *RegistryProperties) UnmarshalJSON(data []byte) error { case "adminUserEnabled": err = unpopulate(val, "AdminUserEnabled", &r.AdminUserEnabled) delete(rawMsg, key) - case "anonymousPullEnabled": - err = unpopulate(val, "AnonymousPullEnabled", &r.AnonymousPullEnabled) - delete(rawMsg, key) case "creationDate": err = unpopulateTimeRFC3339(val, "CreationDate", &r.CreationDate) delete(rawMsg, key) @@ -4606,7 +3613,6 @@ func (r *RegistryProperties) UnmarshalJSON(data []byte) error { func (r RegistryPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "adminUserEnabled", r.AdminUserEnabled) - populate(objectMap, "anonymousPullEnabled", r.AnonymousPullEnabled) populate(objectMap, "dataEndpointEnabled", r.DataEndpointEnabled) populate(objectMap, "encryption", r.Encryption) populate(objectMap, "networkRuleBypassOptions", r.NetworkRuleBypassOptions) @@ -4628,9 +3634,6 @@ func (r *RegistryPropertiesUpdateParameters) UnmarshalJSON(data []byte) error { case "adminUserEnabled": err = unpopulate(val, "AdminUserEnabled", &r.AdminUserEnabled) delete(rawMsg, key) - case "anonymousPullEnabled": - err = unpopulate(val, "AnonymousPullEnabled", &r.AnonymousPullEnabled) - delete(rawMsg, key) case "dataEndpointEnabled": err = unpopulate(val, "DataEndpointEnabled", &r.DataEndpointEnabled) delete(rawMsg, key) @@ -5679,41 +4682,6 @@ func (s *SetValue) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SoftDeletePolicy. -func (s SoftDeletePolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "lastUpdatedTime", s.LastUpdatedTime) - populate(objectMap, "retentionDays", s.RetentionDays) - populate(objectMap, "status", s.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SoftDeletePolicy. -func (s *SoftDeletePolicy) 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 "lastUpdatedTime": - err = unpopulateTimeRFC3339(val, "LastUpdatedTime", &s.LastUpdatedTime) - delete(rawMsg, key) - case "retentionDays": - err = unpopulate(val, "RetentionDays", &s.RetentionDays) - 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 Source. func (s Source) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -6045,49 +5013,6 @@ func (s *Status) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type StatusDetailProperties. -func (s StatusDetailProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "code", s.Code) - populate(objectMap, "correlationId", s.CorrelationID) - populate(objectMap, "description", s.Description) - populateTimeRFC3339(objectMap, "timestamp", s.Timestamp) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StatusDetailProperties. -func (s *StatusDetailProperties) 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 "code": - err = unpopulate(val, "Code", &s.Code) - delete(rawMsg, key) - case "correlationId": - err = unpopulate(val, "CorrelationID", &s.CorrelationID) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &s.Description) - delete(rawMsg, key) - case "timestamp": - err = unpopulateTimeRFC3339(val, "Timestamp", &s.Timestamp) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - 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 StorageAccountProperties. func (s StorageAccountProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -6115,88 +5040,6 @@ func (s *StorageAccountProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SyncProperties. -func (s SyncProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "gatewayEndpoint", s.GatewayEndpoint) - populateTimeRFC3339(objectMap, "lastSyncTime", s.LastSyncTime) - populate(objectMap, "messageTtl", s.MessageTTL) - populate(objectMap, "schedule", s.Schedule) - populate(objectMap, "syncWindow", s.SyncWindow) - populate(objectMap, "tokenId", s.TokenID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SyncProperties. -func (s *SyncProperties) 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 "gatewayEndpoint": - err = unpopulate(val, "GatewayEndpoint", &s.GatewayEndpoint) - delete(rawMsg, key) - case "lastSyncTime": - err = unpopulateTimeRFC3339(val, "LastSyncTime", &s.LastSyncTime) - delete(rawMsg, key) - case "messageTtl": - err = unpopulate(val, "MessageTTL", &s.MessageTTL) - delete(rawMsg, key) - case "schedule": - err = unpopulate(val, "Schedule", &s.Schedule) - delete(rawMsg, key) - case "syncWindow": - err = unpopulate(val, "SyncWindow", &s.SyncWindow) - delete(rawMsg, key) - case "tokenId": - err = unpopulate(val, "TokenID", &s.TokenID) - 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 SyncUpdateProperties. -func (s SyncUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "messageTtl", s.MessageTTL) - populate(objectMap, "schedule", s.Schedule) - populate(objectMap, "syncWindow", s.SyncWindow) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SyncUpdateProperties. -func (s *SyncUpdateProperties) 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 "messageTtl": - err = unpopulate(val, "MessageTTL", &s.MessageTTL) - delete(rawMsg, key) - case "schedule": - err = unpopulate(val, "Schedule", &s.Schedule) - delete(rawMsg, key) - case "syncWindow": - err = unpopulate(val, "SyncWindow", &s.SyncWindow) - 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]any) @@ -6244,68 +5087,6 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TLSCertificateProperties. -func (t TLSCertificateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "location", t.Location) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TLSCertificateProperties. -func (t *TLSCertificateProperties) 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", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "location": - err = unpopulate(val, "Location", &t.Location) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TLSProperties. -func (t TLSProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "certificate", t.Certificate) - populate(objectMap, "status", t.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TLSProperties. -func (t *TLSProperties) 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", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "certificate": - err = unpopulate(val, "Certificate", &t.Certificate) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &t.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type Target. func (t Target) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -7732,6 +6513,16 @@ func populate(m map[string]any, k string, v any) { } } +func populateAny(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else { + m[k] = v + } +} + func unpopulate(data json.RawMessage, fn string, v any) error { if data == nil { return nil diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/operations_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/operations_client.go index cfb61b3985e1..c4678791fc15 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/operations_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/operations_client.go @@ -39,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available Azure Container Registry REST API operations. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - 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]{ @@ -79,7 +79,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/operations_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/operations_client_example_test.go index b7c60317b641..fc0b639b934d 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/operations_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/operations_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/OperationList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/OperationList.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/options.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/options.go index 1ea8a0f2fb24..8571ed3a4244 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/options.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/options.go @@ -69,47 +69,6 @@ type CacheRulesClientListOptions struct { // placeholder for future optional parameters } -// ConnectedRegistriesClientBeginCreateOptions contains the optional parameters for the ConnectedRegistriesClient.BeginCreate -// method. -type ConnectedRegistriesClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ConnectedRegistriesClientBeginDeactivateOptions contains the optional parameters for the ConnectedRegistriesClient.BeginDeactivate -// method. -type ConnectedRegistriesClientBeginDeactivateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ConnectedRegistriesClientBeginDeleteOptions contains the optional parameters for the ConnectedRegistriesClient.BeginDelete -// method. -type ConnectedRegistriesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ConnectedRegistriesClientBeginUpdateOptions contains the optional parameters for the ConnectedRegistriesClient.BeginUpdate -// method. -type ConnectedRegistriesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ConnectedRegistriesClientGetOptions contains the optional parameters for the ConnectedRegistriesClient.Get method. -type ConnectedRegistriesClientGetOptions struct { - // placeholder for future optional parameters -} - -// ConnectedRegistriesClientListOptions contains the optional parameters for the ConnectedRegistriesClient.NewListPager method. -type ConnectedRegistriesClientListOptions struct { - // An OData filter expression that describes a subset of connectedRegistries to return. The parameters that can be filtered - // are parent.id (the resource id of the connectedRegistry parent), mode, and - // connectionState. The supported operator is eq. - Filter *string -} - // CredentialSetsClientBeginCreateOptions contains the optional parameters for the CredentialSetsClient.BeginCreate method. type CredentialSetsClientBeginCreateOptions struct { // Resumes the LRO from the provided token. @@ -138,77 +97,11 @@ type CredentialSetsClientListOptions struct { // placeholder for future optional parameters } -// ExportPipelinesClientBeginCreateOptions contains the optional parameters for the ExportPipelinesClient.BeginCreate method. -type ExportPipelinesClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ExportPipelinesClientBeginDeleteOptions contains the optional parameters for the ExportPipelinesClient.BeginDelete method. -type ExportPipelinesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ExportPipelinesClientGetOptions contains the optional parameters for the ExportPipelinesClient.Get method. -type ExportPipelinesClientGetOptions struct { - // placeholder for future optional parameters -} - -// ExportPipelinesClientListOptions contains the optional parameters for the ExportPipelinesClient.NewListPager method. -type ExportPipelinesClientListOptions struct { - // placeholder for future optional parameters -} - -// ImportPipelinesClientBeginCreateOptions contains the optional parameters for the ImportPipelinesClient.BeginCreate method. -type ImportPipelinesClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ImportPipelinesClientBeginDeleteOptions contains the optional parameters for the ImportPipelinesClient.BeginDelete method. -type ImportPipelinesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ImportPipelinesClientGetOptions contains the optional parameters for the ImportPipelinesClient.Get method. -type ImportPipelinesClientGetOptions struct { - // placeholder for future optional parameters -} - -// ImportPipelinesClientListOptions contains the optional parameters for the ImportPipelinesClient.NewListPager method. -type ImportPipelinesClientListOptions struct { - // placeholder for future optional parameters -} - // OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. type OperationsClientListOptions struct { // placeholder for future optional parameters } -// PipelineRunsClientBeginCreateOptions contains the optional parameters for the PipelineRunsClient.BeginCreate method. -type PipelineRunsClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PipelineRunsClientBeginDeleteOptions contains the optional parameters for the PipelineRunsClient.BeginDelete method. -type PipelineRunsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PipelineRunsClientGetOptions contains the optional parameters for the PipelineRunsClient.Get method. -type PipelineRunsClientGetOptions struct { - // placeholder for future optional parameters -} - -// PipelineRunsClientListOptions contains the optional parameters for the PipelineRunsClient.NewListPager method. -type PipelineRunsClientListOptions struct { - // placeholder for future optional parameters -} - // PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate // method. type PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions struct { diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/pipelineruns_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/pipelineruns_client.go deleted file mode 100644 index 142b438a75bc..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/pipelineruns_client.go +++ /dev/null @@ -1,334 +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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcontainerregistry - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// PipelineRunsClient contains the methods for the PipelineRuns group. -// Don't use this type directly, use NewPipelineRunsClient() instead. -type PipelineRunsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewPipelineRunsClient creates a new instance of PipelineRunsClient with the specified values. -// - subscriptionID - The ID of the target subscription. The value must be an UUID. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewPipelineRunsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PipelineRunsClient, error) { - cl, err := arm.NewClient(moduleName+".PipelineRunsClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &PipelineRunsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginCreate - Creates a pipeline run for a container registry with the specified parameters -// 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. -// - registryName - The name of the container registry. -// - pipelineRunName - The name of the pipeline run. -// - pipelineRunCreateParameters - The parameters for creating a pipeline run. -// - options - PipelineRunsClientBeginCreateOptions contains the optional parameters for the PipelineRunsClient.BeginCreate -// method. -func (client *PipelineRunsClient) BeginCreate(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, pipelineRunCreateParameters PipelineRun, options *PipelineRunsClientBeginCreateOptions) (*runtime.Poller[PipelineRunsClientCreateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, registryName, pipelineRunName, pipelineRunCreateParameters, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PipelineRunsClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken[PipelineRunsClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Create - Creates a pipeline run for a container registry with the specified parameters -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -func (client *PipelineRunsClient) create(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, pipelineRunCreateParameters PipelineRun, options *PipelineRunsClientBeginCreateOptions) (*http.Response, error) { - var err error - const operationName = "PipelineRunsClient.BeginCreate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, pipelineRunName, pipelineRunCreateParameters, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// createCreateRequest creates the Create request. -func (client *PipelineRunsClient) createCreateRequest(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, pipelineRunCreateParameters PipelineRun, options *PipelineRunsClientBeginCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}" - 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 registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - if pipelineRunName == "" { - return nil, errors.New("parameter pipelineRunName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{pipelineRunName}", url.PathEscape(pipelineRunName)) - 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", "2023-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, pipelineRunCreateParameters); err != nil { - return nil, err - } - return req, nil -} - -// BeginDelete - Deletes a pipeline run from a container registry. -// 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. -// - registryName - The name of the container registry. -// - pipelineRunName - The name of the pipeline run. -// - options - PipelineRunsClientBeginDeleteOptions contains the optional parameters for the PipelineRunsClient.BeginDelete -// method. -func (client *PipelineRunsClient) BeginDelete(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, options *PipelineRunsClientBeginDeleteOptions) (*runtime.Poller[PipelineRunsClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, registryName, pipelineRunName, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PipelineRunsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken[PipelineRunsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Delete - Deletes a pipeline run from a container registry. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -func (client *PipelineRunsClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, options *PipelineRunsClientBeginDeleteOptions) (*http.Response, error) { - var err error - const operationName = "PipelineRunsClient.BeginDelete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, pipelineRunName, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *PipelineRunsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, options *PipelineRunsClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}" - 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 registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - if pipelineRunName == "" { - return nil, errors.New("parameter pipelineRunName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{pipelineRunName}", url.PathEscape(pipelineRunName)) - 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", "2023-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Gets the detailed information for a given pipeline run. -// 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. -// - registryName - The name of the container registry. -// - pipelineRunName - The name of the pipeline run. -// - options - PipelineRunsClientGetOptions contains the optional parameters for the PipelineRunsClient.Get method. -func (client *PipelineRunsClient) Get(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, options *PipelineRunsClientGetOptions) (PipelineRunsClientGetResponse, error) { - var err error - const operationName = "PipelineRunsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, pipelineRunName, options) - if err != nil { - return PipelineRunsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PipelineRunsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PipelineRunsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *PipelineRunsClient) getCreateRequest(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, options *PipelineRunsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}" - 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 registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - if pipelineRunName == "" { - return nil, errors.New("parameter pipelineRunName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{pipelineRunName}", url.PathEscape(pipelineRunName)) - 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") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *PipelineRunsClient) getHandleResponse(resp *http.Response) (PipelineRunsClientGetResponse, error) { - result := PipelineRunsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PipelineRun); err != nil { - return PipelineRunsClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Lists all the pipeline runs for the specified container registry. -// -// Generated from API version 2023-01-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - registryName - The name of the container registry. -// - options - PipelineRunsClientListOptions contains the optional parameters for the PipelineRunsClient.NewListPager method. -func (client *PipelineRunsClient) NewListPager(resourceGroupName string, registryName string, options *PipelineRunsClientListOptions) *runtime.Pager[PipelineRunsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[PipelineRunsClientListResponse]{ - More: func(page PipelineRunsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *PipelineRunsClientListResponse) (PipelineRunsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PipelineRunsClient.NewListPager") - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, resourceGroupName, registryName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return PipelineRunsClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PipelineRunsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PipelineRunsClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *PipelineRunsClient) listCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *PipelineRunsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns" - 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 registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - 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") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *PipelineRunsClient) listHandleResponse(resp *http.Response) (PipelineRunsClientListResponse, error) { - result := PipelineRunsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PipelineRunListResult); err != nil { - return PipelineRunsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/pipelineruns_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/pipelineruns_client_example_test.go deleted file mode 100644 index 8c93423998cc..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/pipelineruns_client_example_test.go +++ /dev/null @@ -1,296 +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 armcontainerregistry_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/containerregistry/armcontainerregistry" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/PipelineRunList.json -func ExamplePipelineRunsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPipelineRunsClient().NewListPager("myResourceGroup", "myRegistry", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PipelineRunListResult = armcontainerregistry.PipelineRunListResult{ - // Value: []*armcontainerregistry.PipelineRun{ - // { - // Name: to.Ptr("myPipelineRun"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/pipelineRuns"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/pipelineRuns/myPipelineRun"), - // Properties: &armcontainerregistry.PipelineRunProperties{ - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Response: &armcontainerregistry.PipelineRunResponse{ - // CatalogDigest: to.Ptr("sha256@"), - // Progress: &armcontainerregistry.ProgressProperties{ - // Percentage: to.Ptr("20"), - // }, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-04T17:23:21.9261521+00:00"); return t}()), - // Status: to.Ptr("Running"), - // Target: &armcontainerregistry.ExportPipelineTargetProperties{ - // Type: to.Ptr("AzureStorageBlob"), - // KeyVaultURI: to.Ptr("https://myvault.vault.azure.net/secrets/acrexportsas"), - // URI: to.Ptr("https://accountname.blob.core.windows.net/containername/myblob.tar.gz"), - // }, - // }, - // Request: &armcontainerregistry.PipelineRunRequest{ - // Artifacts: []*string{ - // to.Ptr("sourceRepository/hello-world"), - // to.Ptr("sourceRepository2@sha256:00000000000000000000000000000000000")}, - // PipelineResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/exportPipelines/myExportPipeline"), - // }, - // }, - // }, - // { - // Name: to.Ptr("myPipelineRun"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/pipelineRuns"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/pipelineRuns/myPipelineRun"), - // Properties: &armcontainerregistry.PipelineRunProperties{ - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Response: &armcontainerregistry.PipelineRunResponse{ - // CatalogDigest: to.Ptr("sha256@"), - // ImportedArtifacts: []*string{ - // to.Ptr("sourceRepository/hello-world"), - // to.Ptr("sourceRepository2@sha256:00000000000000000000000000000000000")}, - // Progress: &armcontainerregistry.ProgressProperties{ - // Percentage: to.Ptr("100"), - // }, - // Source: &armcontainerregistry.ImportPipelineSourceProperties{ - // Type: to.Ptr(armcontainerregistry.PipelineSourceType("AzureStorageBlob")), - // KeyVaultURI: to.Ptr("https://myvault.vault.azure.net/secrets/acrimportsas"), - // URI: to.Ptr("https://accountname.blob.core.windows.net/containername/myblob.tar.gz"), - // }, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-03T17:23:21.9261521+00:00"); return t}()), - // Status: to.Ptr("Succeeded"), - // }, - // Request: &armcontainerregistry.PipelineRunRequest{ - // PipelineResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/importPipelines/myImportPipeline"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/PipelineRunGet.json -func ExamplePipelineRunsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPipelineRunsClient().Get(ctx, "myResourceGroup", "myRegistry", "myPipelineRun", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PipelineRun = armcontainerregistry.PipelineRun{ - // Name: to.Ptr("myPipelineRun"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/pipelineRuns"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/pipelineRuns/myPipelineRun"), - // Properties: &armcontainerregistry.PipelineRunProperties{ - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Response: &armcontainerregistry.PipelineRunResponse{ - // CatalogDigest: to.Ptr("sha256@"), - // Progress: &armcontainerregistry.ProgressProperties{ - // Percentage: to.Ptr("20"), - // }, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-04T17:23:21.9261521+00:00"); return t}()), - // Status: to.Ptr("Running"), - // Target: &armcontainerregistry.ExportPipelineTargetProperties{ - // Type: to.Ptr("AzureStorageBlob"), - // KeyVaultURI: to.Ptr("https://myvault.vault.azure.net/secrets/acrexportsas"), - // URI: to.Ptr("https://accountname.blob.core.windows.net/containername/myblob.tar.gz"), - // }, - // }, - // Request: &armcontainerregistry.PipelineRunRequest{ - // Artifacts: []*string{ - // to.Ptr("sourceRepository/hello-world"), - // to.Ptr("sourceRepository2@sha256:00000000000000000000000000000000000")}, - // PipelineResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/exportPipelines/myExportPipeline"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/PipelineRunCreate_Export.json -func ExamplePipelineRunsClient_BeginCreate_pipelineRunCreateExport() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPipelineRunsClient().BeginCreate(ctx, "myResourceGroup", "myRegistry", "myPipelineRun", armcontainerregistry.PipelineRun{ - Properties: &armcontainerregistry.PipelineRunProperties{ - Request: &armcontainerregistry.PipelineRunRequest{ - Artifacts: []*string{ - to.Ptr("sourceRepository/hello-world"), - to.Ptr("sourceRepository2@sha256:00000000000000000000000000000000000")}, - PipelineResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/exportPipelines/myExportPipeline"), - Target: &armcontainerregistry.PipelineRunTargetProperties{ - Name: to.Ptr("myblob.tar.gz"), - Type: to.Ptr(armcontainerregistry.PipelineRunTargetTypeAzureStorageBlob), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PipelineRun = armcontainerregistry.PipelineRun{ - // Name: to.Ptr("myPipelineRun"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/pipelineRuns"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/pipelineRuns/myPipelineRun"), - // Properties: &armcontainerregistry.PipelineRunProperties{ - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Response: &armcontainerregistry.PipelineRunResponse{ - // CatalogDigest: to.Ptr("sha256@"), - // Progress: &armcontainerregistry.ProgressProperties{ - // Percentage: to.Ptr("20"), - // }, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-04T17:23:21.9261521+00:00"); return t}()), - // Status: to.Ptr("Running"), - // Target: &armcontainerregistry.ExportPipelineTargetProperties{ - // Type: to.Ptr("AzureStorageBlob"), - // KeyVaultURI: to.Ptr("https://myvault.vault.azure.net/secrets/acrexportsas"), - // URI: to.Ptr("https://accountname.blob.core.windows.net/containername/myblob.tar.gz"), - // }, - // }, - // Request: &armcontainerregistry.PipelineRunRequest{ - // Artifacts: []*string{ - // to.Ptr("sourceRepository/hello-world"), - // to.Ptr("sourceRepository2@sha256:00000000000000000000000000000000000")}, - // PipelineResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/exportPipelines/myExportPipeline"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/PipelineRunCreate_Import.json -func ExamplePipelineRunsClient_BeginCreate_pipelineRunCreateImport() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPipelineRunsClient().BeginCreate(ctx, "myResourceGroup", "myRegistry", "myPipelineRun", armcontainerregistry.PipelineRun{ - Properties: &armcontainerregistry.PipelineRunProperties{ - ForceUpdateTag: to.Ptr("2020-03-04T17:23:21.9261521+00:00"), - Request: &armcontainerregistry.PipelineRunRequest{ - CatalogDigest: to.Ptr("sha256@"), - PipelineResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/importPipelines/myImportPipeline"), - Source: &armcontainerregistry.PipelineRunSourceProperties{ - Name: to.Ptr("myblob.tar.gz"), - Type: to.Ptr(armcontainerregistry.PipelineRunSourceTypeAzureStorageBlob), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PipelineRun = armcontainerregistry.PipelineRun{ - // Name: to.Ptr("myPipelineRun"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/pipelineRuns"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/pipelineRuns/myPipelineRun"), - // Properties: &armcontainerregistry.PipelineRunProperties{ - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Response: &armcontainerregistry.PipelineRunResponse{ - // CatalogDigest: to.Ptr("sha256@"), - // ImportedArtifacts: []*string{ - // to.Ptr("sourceRepository/hello-world"), - // to.Ptr("sourceRepository2@sha256:00000000000000000000000000000000000")}, - // Progress: &armcontainerregistry.ProgressProperties{ - // Percentage: to.Ptr("100"), - // }, - // Source: &armcontainerregistry.ImportPipelineSourceProperties{ - // Type: to.Ptr(armcontainerregistry.PipelineSourceType("AzureStorageBlob")), - // KeyVaultURI: to.Ptr("https://myvault.vault.azure.net/secrets/acrimportsas"), - // URI: to.Ptr("https://accountname.blob.core.windows.net/containername/myblob.tar.gz"), - // }, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-04T17:23:21.9261521+00:00"); return t}()), - // Status: to.Ptr("Succeeded"), - // }, - // Request: &armcontainerregistry.PipelineRunRequest{ - // PipelineResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/importPipelines/myImportPipeline"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/PipelineRunDelete.json -func ExamplePipelineRunsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPipelineRunsClient().BeginDelete(ctx, "myResourceGroup", "myRegistry", "myPipelineRun", 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/containerregistry/armcontainerregistry/privateendpointconnections_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_client.go index f1cd21dc359a..8104965436f8 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_client.go @@ -46,7 +46,7 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // BeginCreateOrUpdate - Update the state of specified private endpoint connection associated with the container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - privateEndpointConnectionName - The name of the private endpoint connection. @@ -71,7 +71,7 @@ func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context. // CreateOrUpdate - Update the state of specified private endpoint connection associated with the container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginCreateOrUpdate" @@ -114,7 +114,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, privateEndpointConnection); err != nil { @@ -126,7 +126,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx // BeginDelete - Deletes the specified private endpoint connection associated with the container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - privateEndpointConnectionName - The name of the private endpoint connection. @@ -150,7 +150,7 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Deletes the specified private endpoint connection associated with the container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginDelete" @@ -193,7 +193,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -201,7 +201,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Get the specified private endpoint connection associated with the container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - privateEndpointConnectionName - The name of the private endpoint connection. @@ -250,7 +250,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -267,7 +267,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // NewListPager - List all private endpoint connections in a container registry. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - options - PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager @@ -319,7 +319,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_client_example_test.go index 5da6c619f819..49407e2e37ca 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/PrivateEndpointConnectionList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/PrivateEndpointConnectionList.json func ExamplePrivateEndpointConnectionsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -62,7 +62,7 @@ func ExamplePrivateEndpointConnectionsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/PrivateEndpointConnectionGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/PrivateEndpointConnectionGet.json func ExamplePrivateEndpointConnectionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -98,7 +98,7 @@ func ExamplePrivateEndpointConnectionsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/PrivateEndpointConnectionCreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/PrivateEndpointConnectionCreateOrUpdate.json func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -145,7 +145,7 @@ func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/PrivateEndpointConnectionDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/PrivateEndpointConnectionDelete.json func ExamplePrivateEndpointConnectionsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/registries_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/registries_client.go index 9221d6f8b7d1..444bdbcc118b 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/registries_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/registries_client.go @@ -47,7 +47,7 @@ func NewRegistriesClient(subscriptionID string, credential azcore.TokenCredentia // characters, be globally unique, and between 5 and 50 characters in length. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - registryNameCheckRequest - The object containing information for the availability request. // - options - RegistriesClientCheckNameAvailabilityOptions contains the optional parameters for the RegistriesClient.CheckNameAvailability // method. @@ -82,7 +82,7 @@ func (client *RegistriesClient) checkNameAvailabilityCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, registryNameCheckRequest); err != nil { @@ -103,7 +103,7 @@ func (client *RegistriesClient) checkNameAvailabilityHandleResponse(resp *http.R // BeginCreate - Creates a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - registry - The parameters for creating a container registry. @@ -126,7 +126,7 @@ func (client *RegistriesClient) BeginCreate(ctx context.Context, resourceGroupNa // Create - Creates a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *RegistriesClient) create(ctx context.Context, resourceGroupName string, registryName string, registry Registry, options *RegistriesClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "RegistriesClient.BeginCreate" @@ -165,7 +165,7 @@ func (client *RegistriesClient) createCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, registry); err != nil { @@ -177,7 +177,7 @@ func (client *RegistriesClient) createCreateRequest(ctx context.Context, resourc // BeginDelete - Deletes a container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - options - RegistriesClientBeginDeleteOptions contains the optional parameters for the RegistriesClient.BeginDelete method. @@ -199,7 +199,7 @@ func (client *RegistriesClient) BeginDelete(ctx context.Context, resourceGroupNa // Delete - Deletes a container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *RegistriesClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, options *RegistriesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "RegistriesClient.BeginDelete" @@ -238,7 +238,7 @@ func (client *RegistriesClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -246,7 +246,7 @@ func (client *RegistriesClient) deleteCreateRequest(ctx context.Context, resourc // BeginGenerateCredentials - Generate keys for a token of a specified container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - generateCredentialsParameters - The parameters for generating credentials. @@ -270,7 +270,7 @@ func (client *RegistriesClient) BeginGenerateCredentials(ctx context.Context, re // GenerateCredentials - Generate keys for a token of a specified container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *RegistriesClient) generateCredentials(ctx context.Context, resourceGroupName string, registryName string, generateCredentialsParameters GenerateCredentialsParameters, options *RegistriesClientBeginGenerateCredentialsOptions) (*http.Response, error) { var err error const operationName = "RegistriesClient.BeginGenerateCredentials" @@ -309,7 +309,7 @@ func (client *RegistriesClient) generateCredentialsCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, generateCredentialsParameters); err != nil { @@ -321,7 +321,7 @@ func (client *RegistriesClient) generateCredentialsCreateRequest(ctx context.Con // Get - Gets the properties of the specified container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - options - RegistriesClientGetOptions contains the optional parameters for the RegistriesClient.Get method. @@ -364,7 +364,7 @@ func (client *RegistriesClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -444,7 +444,7 @@ func (client *RegistriesClient) getBuildSourceUploadURLHandleResponse(resp *http // GetPrivateLinkResource - Gets a private link resource by a specified group name for a container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - groupName - The name of the private link resource. @@ -493,7 +493,7 @@ func (client *RegistriesClient) getPrivateLinkResourceCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -511,7 +511,7 @@ func (client *RegistriesClient) getPrivateLinkResourceHandleResponse(resp *http. // BeginImportImage - Copies an image to this container registry from the specified container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - parameters - The parameters specifying the image to copy and the source container registry. @@ -535,7 +535,7 @@ func (client *RegistriesClient) BeginImportImage(ctx context.Context, resourceGr // ImportImage - Copies an image to this container registry from the specified container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *RegistriesClient) importImage(ctx context.Context, resourceGroupName string, registryName string, parameters ImportImageParameters, options *RegistriesClientBeginImportImageOptions) (*http.Response, error) { var err error const operationName = "RegistriesClient.BeginImportImage" @@ -574,7 +574,7 @@ func (client *RegistriesClient) importImageCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err @@ -584,7 +584,7 @@ func (client *RegistriesClient) importImageCreateRequest(ctx context.Context, re // NewListPager - Lists all the container registries under the specified subscription. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - options - RegistriesClientListOptions contains the optional parameters for the RegistriesClient.NewListPager method. func (client *RegistriesClient) NewListPager(options *RegistriesClientListOptions) *runtime.Pager[RegistriesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[RegistriesClientListResponse]{ @@ -625,7 +625,7 @@ func (client *RegistriesClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -642,7 +642,7 @@ func (client *RegistriesClient) listHandleResponse(resp *http.Response) (Registr // NewListByResourceGroupPager - Lists all the container registries under the specified resource group. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - RegistriesClientListByResourceGroupOptions contains the optional parameters for the RegistriesClient.NewListByResourceGroupPager // method. @@ -689,7 +689,7 @@ func (client *RegistriesClient) listByResourceGroupCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -707,7 +707,7 @@ func (client *RegistriesClient) listByResourceGroupHandleResponse(resp *http.Res // ListCredentials - Lists the login credentials for the specified container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - options - RegistriesClientListCredentialsOptions contains the optional parameters for the RegistriesClient.ListCredentials @@ -751,7 +751,7 @@ func (client *RegistriesClient) listCredentialsCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -768,7 +768,7 @@ func (client *RegistriesClient) listCredentialsHandleResponse(resp *http.Respons // NewListPrivateLinkResourcesPager - Lists the private link resources for a container registry. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - options - RegistriesClientListPrivateLinkResourcesOptions contains the optional parameters for the RegistriesClient.NewListPrivateLinkResourcesPager @@ -820,7 +820,7 @@ func (client *RegistriesClient) listPrivateLinkResourcesCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -838,7 +838,7 @@ func (client *RegistriesClient) listPrivateLinkResourcesHandleResponse(resp *htt // ListUsages - Gets the quota usages for the specified container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - options - RegistriesClientListUsagesOptions contains the optional parameters for the RegistriesClient.ListUsages method. @@ -881,7 +881,7 @@ func (client *RegistriesClient) listUsagesCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -899,7 +899,7 @@ func (client *RegistriesClient) listUsagesHandleResponse(resp *http.Response) (R // RegenerateCredential - Regenerates one of the login credentials for the specified container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - regenerateCredentialParameters - Specifies name of the password which should be regenerated -- password or password2. @@ -944,7 +944,7 @@ func (client *RegistriesClient) regenerateCredentialCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, regenerateCredentialParameters); err != nil { @@ -1038,7 +1038,7 @@ func (client *RegistriesClient) scheduleRunCreateRequest(ctx context.Context, re // BeginUpdate - Updates a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - registryUpdateParameters - The parameters for updating a container registry. @@ -1061,7 +1061,7 @@ func (client *RegistriesClient) BeginUpdate(ctx context.Context, resourceGroupNa // Update - Updates a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *RegistriesClient) update(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters, options *RegistriesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "RegistriesClient.BeginUpdate" @@ -1100,7 +1100,7 @@ func (client *RegistriesClient) updateCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, registryUpdateParameters); err != nil { diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/registries_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/registries_client_example_test.go index 9b0992bca8d8..3940cb330a4c 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/registries_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/registries_client_example_test.go @@ -20,7 +20,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ImportImageByManifestDigest.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/ImportImageByManifestDigest.json func ExampleRegistriesClient_BeginImportImage_importImageByManifestDigest() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -51,7 +51,7 @@ func ExampleRegistriesClient_BeginImportImage_importImageByManifestDigest() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ImportImageByTag.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/ImportImageByTag.json func ExampleRegistriesClient_BeginImportImage_importImageByTag() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -82,7 +82,7 @@ func ExampleRegistriesClient_BeginImportImage_importImageByTag() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ImportImageFromPublicRegistry.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/ImportImageFromPublicRegistry.json func ExampleRegistriesClient_BeginImportImage_importImageFromPublicRegistry() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -113,7 +113,7 @@ func ExampleRegistriesClient_BeginImportImage_importImageFromPublicRegistry() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/RegistryCheckNameAvailable.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/RegistryCheckNameAvailable.json func ExampleRegistriesClient_CheckNameAvailability_registryCheckNameAvailable() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -139,7 +139,7 @@ func ExampleRegistriesClient_CheckNameAvailability_registryCheckNameAvailable() // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/RegistryCheckNameNotAvailable.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/RegistryCheckNameNotAvailable.json func ExampleRegistriesClient_CheckNameAvailability_registryCheckNameNotAvailable() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -167,7 +167,7 @@ func ExampleRegistriesClient_CheckNameAvailability_registryCheckNameNotAvailable // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/RegistryList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/RegistryList.json func ExampleRegistriesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -201,7 +201,6 @@ func ExampleRegistriesClient_NewListPager() { // }, // Properties: &armcontainerregistry.RegistryProperties{ // AdminUserEnabled: to.Ptr(false), - // AnonymousPullEnabled: to.Ptr(false), // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-15T21:38:26.1537861Z"); return t}()), // DataEndpointEnabled: to.Ptr(false), // DataEndpointHostNames: []*string{ @@ -248,7 +247,7 @@ func ExampleRegistriesClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/RegistryListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/RegistryListByResourceGroup.json func ExampleRegistriesClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -282,7 +281,6 @@ func ExampleRegistriesClient_NewListByResourceGroupPager() { // }, // Properties: &armcontainerregistry.RegistryProperties{ // AdminUserEnabled: to.Ptr(false), - // AnonymousPullEnabled: to.Ptr(false), // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-15T21:38:26.1537861Z"); return t}()), // DataEndpointEnabled: to.Ptr(false), // DataEndpointHostNames: []*string{ @@ -329,7 +327,7 @@ func ExampleRegistriesClient_NewListByResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/RegistryGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/RegistryGet.json func ExampleRegistriesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -357,7 +355,6 @@ func ExampleRegistriesClient_Get() { // }, // Properties: &armcontainerregistry.RegistryProperties{ // AdminUserEnabled: to.Ptr(false), - // AnonymousPullEnabled: to.Ptr(false), // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-15T21:38:26.1537861Z"); return t}()), // DataEndpointEnabled: to.Ptr(false), // DataEndpointHostNames: []*string{ @@ -402,7 +399,7 @@ func ExampleRegistriesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/RegistryCreate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/RegistryCreate.json func ExampleRegistriesClient_BeginCreate_registryCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -445,7 +442,6 @@ func ExampleRegistriesClient_BeginCreate_registryCreate() { // }, // Properties: &armcontainerregistry.RegistryProperties{ // AdminUserEnabled: to.Ptr(true), - // AnonymousPullEnabled: to.Ptr(false), // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-15T21:38:26.1537861Z"); return t}()), // DataEndpointEnabled: to.Ptr(false), // DataEndpointHostNames: []*string{ @@ -490,7 +486,7 @@ func ExampleRegistriesClient_BeginCreate_registryCreate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/RegistryCreateZoneRedundant.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/RegistryCreateZoneRedundant.json func ExampleRegistriesClient_BeginCreate_registryCreateZoneRedundant() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -533,7 +529,6 @@ func ExampleRegistriesClient_BeginCreate_registryCreateZoneRedundant() { // }, // Properties: &armcontainerregistry.RegistryProperties{ // AdminUserEnabled: to.Ptr(false), - // AnonymousPullEnabled: to.Ptr(false), // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-15T21:38:26.1537861Z"); return t}()), // DataEndpointEnabled: to.Ptr(false), // DataEndpointHostNames: []*string{ @@ -578,7 +573,7 @@ func ExampleRegistriesClient_BeginCreate_registryCreateZoneRedundant() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/RegistryDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/RegistryDelete.json func ExampleRegistriesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -599,7 +594,7 @@ func ExampleRegistriesClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/RegistryUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/RegistryUpdate.json func ExampleRegistriesClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -641,7 +636,6 @@ func ExampleRegistriesClient_BeginUpdate() { // }, // Properties: &armcontainerregistry.RegistryProperties{ // AdminUserEnabled: to.Ptr(true), - // AnonymousPullEnabled: to.Ptr(false), // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-15T21:38:26.1537861Z"); return t}()), // DataEndpointEnabled: to.Ptr(false), // DataEndpointHostNames: []*string{ @@ -686,7 +680,7 @@ func ExampleRegistriesClient_BeginUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/RegistryListUsages.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/RegistryListUsages.json func ExampleRegistriesClient_ListUsages() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -721,7 +715,7 @@ func ExampleRegistriesClient_ListUsages() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/RegistryListPrivateLinkResources.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/RegistryListPrivateLinkResources.json func ExampleRegistriesClient_NewListPrivateLinkResourcesPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -762,7 +756,7 @@ func ExampleRegistriesClient_NewListPrivateLinkResourcesPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/RegistryGetPrivateLinkResource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/RegistryGetPrivateLinkResource.json func ExampleRegistriesClient_GetPrivateLinkResource() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -795,7 +789,7 @@ func ExampleRegistriesClient_GetPrivateLinkResource() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/RegistryListCredentials.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/RegistryListCredentials.json func ExampleRegistriesClient_ListCredentials() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -827,7 +821,7 @@ func ExampleRegistriesClient_ListCredentials() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/RegistryRegenerateCredential.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/RegistryRegenerateCredential.json func ExampleRegistriesClient_RegenerateCredential() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -861,7 +855,7 @@ func ExampleRegistriesClient_RegenerateCredential() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/RegistryGenerateCredentials.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/RegistryGenerateCredentials.json func ExampleRegistriesClient_BeginGenerateCredentials() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -902,7 +896,7 @@ func ExampleRegistriesClient_BeginGenerateCredentials() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RegistriesScheduleRun.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RegistriesScheduleRun.json func ExampleRegistriesClient_BeginScheduleRun_registriesScheduleRun() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -964,7 +958,7 @@ func ExampleRegistriesClient_BeginScheduleRun_registriesScheduleRun() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RegistriesScheduleRun_EncodedTaskRun.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RegistriesScheduleRun_EncodedTaskRun.json func ExampleRegistriesClient_BeginScheduleRun_registriesScheduleRunEncodedTaskRun() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1020,7 +1014,7 @@ func ExampleRegistriesClient_BeginScheduleRun_registriesScheduleRunEncodedTaskRu // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RegistriesScheduleRun_FileTaskRun.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RegistriesScheduleRun_FileTaskRun.json func ExampleRegistriesClient_BeginScheduleRun_registriesScheduleRunFileTaskRun() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1077,7 +1071,7 @@ func ExampleRegistriesClient_BeginScheduleRun_registriesScheduleRunFileTaskRun() // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RegistriesScheduleRun_Task.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RegistriesScheduleRun_Task.json func ExampleRegistriesClient_BeginScheduleRun_registriesScheduleRunTask() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1142,7 +1136,7 @@ func ExampleRegistriesClient_BeginScheduleRun_registriesScheduleRunTask() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RegistriesScheduleRun_FileTask_WithCustomCredentials.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RegistriesScheduleRun_FileTask_WithCustomCredentials.json func ExampleRegistriesClient_BeginScheduleRun_registriesScheduleRunTaskWithCustomCredentials() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1211,7 +1205,7 @@ func ExampleRegistriesClient_BeginScheduleRun_registriesScheduleRunTaskWithCusto // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RegistriesScheduleRun_WithCustomCredentials.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RegistriesScheduleRun_WithCustomCredentials.json func ExampleRegistriesClient_BeginScheduleRun_registriesScheduleRunWithCustomCredentials() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1301,7 +1295,7 @@ func ExampleRegistriesClient_BeginScheduleRun_registriesScheduleRunWithCustomCre // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RegistriesScheduleRun_WithLogTemplate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RegistriesScheduleRun_WithLogTemplate.json func ExampleRegistriesClient_BeginScheduleRun_registriesScheduleRunWithLogTemplate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1364,7 +1358,7 @@ func ExampleRegistriesClient_BeginScheduleRun_registriesScheduleRunWithLogTempla // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RegistriesGetBuildSourceUploadUrl.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RegistriesGetBuildSourceUploadUrl.json func ExampleRegistriesClient_GetBuildSourceUploadURL() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client.go index 10164bc4722c..d2ea869ac7cb 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client.go @@ -46,7 +46,7 @@ func NewReplicationsClient(subscriptionID string, credential azcore.TokenCredent // BeginCreate - Creates a replication for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - replicationName - The name of the replication. @@ -71,7 +71,7 @@ func (client *ReplicationsClient) BeginCreate(ctx context.Context, resourceGroup // Create - Creates a replication for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *ReplicationsClient) create(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replication Replication, options *ReplicationsClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "ReplicationsClient.BeginCreate" @@ -114,7 +114,7 @@ func (client *ReplicationsClient) createCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, replication); err != nil { @@ -126,7 +126,7 @@ func (client *ReplicationsClient) createCreateRequest(ctx context.Context, resou // BeginDelete - Deletes a replication from a container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - replicationName - The name of the replication. @@ -150,7 +150,7 @@ func (client *ReplicationsClient) BeginDelete(ctx context.Context, resourceGroup // Delete - Deletes a replication from a container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *ReplicationsClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, replicationName string, options *ReplicationsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ReplicationsClient.BeginDelete" @@ -193,7 +193,7 @@ func (client *ReplicationsClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -201,7 +201,7 @@ func (client *ReplicationsClient) deleteCreateRequest(ctx context.Context, resou // Get - Gets the properties of the specified replication. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - replicationName - The name of the replication. @@ -249,7 +249,7 @@ func (client *ReplicationsClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -266,7 +266,7 @@ func (client *ReplicationsClient) getHandleResponse(resp *http.Response) (Replic // NewListPager - Lists all the replications for the specified container registry. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - options - ReplicationsClientListOptions contains the optional parameters for the ReplicationsClient.NewListPager method. @@ -317,7 +317,7 @@ func (client *ReplicationsClient) listCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -335,7 +335,7 @@ func (client *ReplicationsClient) listHandleResponse(resp *http.Response) (Repli // BeginUpdate - Updates a replication for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - replicationName - The name of the replication. @@ -360,7 +360,7 @@ func (client *ReplicationsClient) BeginUpdate(ctx context.Context, resourceGroup // Update - Updates a replication for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *ReplicationsClient) update(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters ReplicationUpdateParameters, options *ReplicationsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "ReplicationsClient.BeginUpdate" @@ -403,7 +403,7 @@ func (client *ReplicationsClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, replicationUpdateParameters); err != nil { diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client_example_test.go index 2829a153c6d5..4787d2f6b7e2 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ReplicationList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/ReplicationList.json func ExampleReplicationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -65,7 +65,7 @@ func ExampleReplicationsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ReplicationGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/ReplicationGet.json func ExampleReplicationsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -104,7 +104,7 @@ func ExampleReplicationsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ReplicationCreate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/ReplicationCreate.json func ExampleReplicationsClient_BeginCreate_replicationCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -152,7 +152,7 @@ func ExampleReplicationsClient_BeginCreate_replicationCreate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ReplicationCreateZoneRedundant.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/ReplicationCreateZoneRedundant.json func ExampleReplicationsClient_BeginCreate_replicationCreateZoneRedundant() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -204,7 +204,7 @@ func ExampleReplicationsClient_BeginCreate_replicationCreateZoneRedundant() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ReplicationDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/ReplicationDelete.json func ExampleReplicationsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -225,7 +225,7 @@ func ExampleReplicationsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ReplicationUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/ReplicationUpdate.json func ExampleReplicationsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/response_types.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/response_types.go index bea783b0e839..08ed39340769 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/response_types.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/response_types.go @@ -75,40 +75,6 @@ type CacheRulesClientUpdateResponse struct { CacheRule } -// ConnectedRegistriesClientCreateResponse contains the response from method ConnectedRegistriesClient.BeginCreate. -type ConnectedRegistriesClientCreateResponse struct { - // An object that represents a connected registry for a container registry. - ConnectedRegistry -} - -// ConnectedRegistriesClientDeactivateResponse contains the response from method ConnectedRegistriesClient.BeginDeactivate. -type ConnectedRegistriesClientDeactivateResponse struct { - // placeholder for future response values -} - -// ConnectedRegistriesClientDeleteResponse contains the response from method ConnectedRegistriesClient.BeginDelete. -type ConnectedRegistriesClientDeleteResponse struct { - // placeholder for future response values -} - -// ConnectedRegistriesClientGetResponse contains the response from method ConnectedRegistriesClient.Get. -type ConnectedRegistriesClientGetResponse struct { - // An object that represents a connected registry for a container registry. - ConnectedRegistry -} - -// ConnectedRegistriesClientListResponse contains the response from method ConnectedRegistriesClient.NewListPager. -type ConnectedRegistriesClientListResponse struct { - // The result of a request to list connected registries for a container registry. - ConnectedRegistryListResult -} - -// ConnectedRegistriesClientUpdateResponse contains the response from method ConnectedRegistriesClient.BeginUpdate. -type ConnectedRegistriesClientUpdateResponse struct { - // An object that represents a connected registry for a container registry. - ConnectedRegistry -} - // CredentialSetsClientCreateResponse contains the response from method CredentialSetsClient.BeginCreate. type CredentialSetsClientCreateResponse struct { // An object that represents a credential set resource for a container registry. @@ -138,81 +104,12 @@ type CredentialSetsClientUpdateResponse struct { CredentialSet } -// ExportPipelinesClientCreateResponse contains the response from method ExportPipelinesClient.BeginCreate. -type ExportPipelinesClientCreateResponse struct { - // An object that represents an export pipeline for a container registry. - ExportPipeline -} - -// ExportPipelinesClientDeleteResponse contains the response from method ExportPipelinesClient.BeginDelete. -type ExportPipelinesClientDeleteResponse struct { - // placeholder for future response values -} - -// ExportPipelinesClientGetResponse contains the response from method ExportPipelinesClient.Get. -type ExportPipelinesClientGetResponse struct { - // An object that represents an export pipeline for a container registry. - ExportPipeline -} - -// ExportPipelinesClientListResponse contains the response from method ExportPipelinesClient.NewListPager. -type ExportPipelinesClientListResponse struct { - // The result of a request to list export pipelines for a container registry. - ExportPipelineListResult -} - -// ImportPipelinesClientCreateResponse contains the response from method ImportPipelinesClient.BeginCreate. -type ImportPipelinesClientCreateResponse struct { - // An object that represents an import pipeline for a container registry. - ImportPipeline -} - -// ImportPipelinesClientDeleteResponse contains the response from method ImportPipelinesClient.BeginDelete. -type ImportPipelinesClientDeleteResponse struct { - // placeholder for future response values -} - -// ImportPipelinesClientGetResponse contains the response from method ImportPipelinesClient.Get. -type ImportPipelinesClientGetResponse struct { - // An object that represents an import pipeline for a container registry. - ImportPipeline -} - -// ImportPipelinesClientListResponse contains the response from method ImportPipelinesClient.NewListPager. -type ImportPipelinesClientListResponse struct { - // The result of a request to list import pipelines for a container registry. - ImportPipelineListResult -} - // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { // The result of a request to list container registry operations. OperationListResult } -// PipelineRunsClientCreateResponse contains the response from method PipelineRunsClient.BeginCreate. -type PipelineRunsClientCreateResponse struct { - // An object that represents a pipeline run for a container registry. - PipelineRun -} - -// PipelineRunsClientDeleteResponse contains the response from method PipelineRunsClient.BeginDelete. -type PipelineRunsClientDeleteResponse struct { - // placeholder for future response values -} - -// PipelineRunsClientGetResponse contains the response from method PipelineRunsClient.Get. -type PipelineRunsClientGetResponse struct { - // An object that represents a pipeline run for a container registry. - PipelineRun -} - -// PipelineRunsClientListResponse contains the response from method PipelineRunsClient.NewListPager. -type PipelineRunsClientListResponse struct { - // The result of a request to list pipeline runs for a container registry. - PipelineRunListResult -} - // PrivateEndpointConnectionsClientCreateOrUpdateResponse contains the response from method PrivateEndpointConnectionsClient.BeginCreateOrUpdate. type PrivateEndpointConnectionsClientCreateOrUpdateResponse struct { // An object that represents a private endpoint connection for a container registry. diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/runs_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/runs_client_example_test.go index 5b3e40647ba9..868202be0cc7 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/runs_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/runs_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RunsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RunsList.json func ExampleRunsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -96,7 +96,7 @@ func ExampleRunsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RunsGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RunsGet.json func ExampleRunsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -164,7 +164,7 @@ func ExampleRunsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RunsUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RunsUpdate.json func ExampleRunsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -238,7 +238,7 @@ func ExampleRunsClient_BeginUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RunsGetLogSasUrl.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RunsGetLogSasUrl.json func ExampleRunsClient_GetLogSasURL() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -261,7 +261,7 @@ func ExampleRunsClient_GetLogSasURL() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RunsCancel.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RunsCancel.json func ExampleRunsClient_BeginCancel() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_client.go index 0b9ef2bb561d..9ab3d6cf1faf 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_client.go @@ -46,7 +46,7 @@ func NewScopeMapsClient(subscriptionID string, credential azcore.TokenCredential // BeginCreate - Creates a scope map for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - scopeMapName - The name of the scope map. @@ -70,7 +70,7 @@ func (client *ScopeMapsClient) BeginCreate(ctx context.Context, resourceGroupNam // Create - Creates a scope map for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *ScopeMapsClient) create(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapCreateParameters ScopeMap, options *ScopeMapsClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "ScopeMapsClient.BeginCreate" @@ -113,7 +113,7 @@ func (client *ScopeMapsClient) createCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, scopeMapCreateParameters); err != nil { @@ -125,7 +125,7 @@ func (client *ScopeMapsClient) createCreateRequest(ctx context.Context, resource // BeginDelete - Deletes a scope map from a container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - scopeMapName - The name of the scope map. @@ -148,7 +148,7 @@ func (client *ScopeMapsClient) BeginDelete(ctx context.Context, resourceGroupNam // Delete - Deletes a scope map from a container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *ScopeMapsClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, options *ScopeMapsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ScopeMapsClient.BeginDelete" @@ -191,7 +191,7 @@ func (client *ScopeMapsClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -200,7 +200,7 @@ func (client *ScopeMapsClient) deleteCreateRequest(ctx context.Context, resource // Get - Gets the properties of the specified scope map. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - scopeMapName - The name of the scope map. @@ -248,7 +248,7 @@ func (client *ScopeMapsClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -265,7 +265,7 @@ func (client *ScopeMapsClient) getHandleResponse(resp *http.Response) (ScopeMaps // NewListPager - Lists all the scope maps for the specified container registry. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - options - ScopeMapsClientListOptions contains the optional parameters for the ScopeMapsClient.NewListPager method. @@ -316,7 +316,7 @@ func (client *ScopeMapsClient) listCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -334,7 +334,7 @@ func (client *ScopeMapsClient) listHandleResponse(resp *http.Response) (ScopeMap // BeginUpdate - Updates a scope map with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - scopeMapName - The name of the scope map. @@ -358,7 +358,7 @@ func (client *ScopeMapsClient) BeginUpdate(ctx context.Context, resourceGroupNam // Update - Updates a scope map with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *ScopeMapsClient) update(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapUpdateParameters ScopeMapUpdateParameters, options *ScopeMapsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "ScopeMapsClient.BeginUpdate" @@ -401,7 +401,7 @@ func (client *ScopeMapsClient) updateCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, scopeMapUpdateParameters); err != nil { diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_client_example_test.go index 099746cb6619..568231271457 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ScopeMapList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/ScopeMapList.json func ExampleScopeMapsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -59,7 +59,7 @@ func ExampleScopeMapsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ScopeMapGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/ScopeMapGet.json func ExampleScopeMapsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -92,7 +92,7 @@ func ExampleScopeMapsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ScopeMapCreate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/ScopeMapCreate.json func ExampleScopeMapsClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -136,7 +136,7 @@ func ExampleScopeMapsClient_BeginCreate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ScopeMapDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/ScopeMapDelete.json func ExampleScopeMapsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -157,7 +157,7 @@ func ExampleScopeMapsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ScopeMapUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/ScopeMapUpdate.json func ExampleScopeMapsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/taskruns_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/taskruns_client_example_test.go index 4ec6b2012a69..30f75a1846a0 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/taskruns_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/taskruns_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TaskRunsGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TaskRunsGet.json func ExampleTaskRunsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -83,7 +83,7 @@ func ExampleTaskRunsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TaskRunsCreate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TaskRunsCreate.json func ExampleTaskRunsClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -165,7 +165,7 @@ func ExampleTaskRunsClient_BeginCreate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TaskRunsDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TaskRunsDelete.json func ExampleTaskRunsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -186,7 +186,7 @@ func ExampleTaskRunsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TaskRunsUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TaskRunsUpdate.json func ExampleTaskRunsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -269,7 +269,7 @@ func ExampleTaskRunsClient_BeginUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TaskRunsGetDetails.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TaskRunsGetDetails.json func ExampleTaskRunsClient_GetDetails() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -334,7 +334,7 @@ func ExampleTaskRunsClient_GetDetails() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TaskRunsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TaskRunsList.json func ExampleTaskRunsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/tasks_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/tasks_client_example_test.go index 09c531205fd1..7f9cdaa7f972 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/tasks_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/tasks_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksList.json func ExampleTasksClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -119,7 +119,7 @@ func ExampleTasksClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksGet.json func ExampleTasksClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -212,7 +212,7 @@ func ExampleTasksClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksCreate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksCreate.json func ExampleTasksClient_BeginCreate_tasksCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -373,7 +373,7 @@ func ExampleTasksClient_BeginCreate_tasksCreate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksCreate_QuickTask.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksCreate_QuickTask.json func ExampleTasksClient_BeginCreate_tasksCreateQuickTask() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -423,7 +423,7 @@ func ExampleTasksClient_BeginCreate_tasksCreateQuickTask() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/ManagedIdentity/TasksCreate_WithSystemAndUserIdentities.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/ManagedIdentity/TasksCreate_WithSystemAndUserIdentities.json func ExampleTasksClient_BeginCreate_tasksCreateWithSystemAndUserIdentities() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -591,7 +591,7 @@ func ExampleTasksClient_BeginCreate_tasksCreateWithSystemAndUserIdentities() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/ManagedIdentity/TasksCreate_WithUserIdentities.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/ManagedIdentity/TasksCreate_WithUserIdentities.json func ExampleTasksClient_BeginCreate_tasksCreateWithUserIdentities() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -762,7 +762,7 @@ func ExampleTasksClient_BeginCreate_tasksCreateWithUserIdentities() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/ManagedIdentity/TasksCreate_WithSystemIdentity.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/ManagedIdentity/TasksCreate_WithSystemIdentity.json func ExampleTasksClient_BeginCreate_tasksCreateWithUserIdentitiesWithSystemIdentity() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -918,7 +918,7 @@ func ExampleTasksClient_BeginCreate_tasksCreateWithUserIdentitiesWithSystemIdent // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksDelete.json func ExampleTasksClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -939,7 +939,7 @@ func ExampleTasksClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksUpdate.json func ExampleTasksClient_BeginUpdate_tasksUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1082,7 +1082,7 @@ func ExampleTasksClient_BeginUpdate_tasksUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksUpdate_QuickTask.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksUpdate_QuickTask.json func ExampleTasksClient_BeginUpdate_tasksUpdateQuickTask() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1129,7 +1129,7 @@ func ExampleTasksClient_BeginUpdate_tasksUpdateQuickTask() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/ManagedIdentity/TasksUpdate_WithKeyVaultCustomCredentials.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/ManagedIdentity/TasksUpdate_WithKeyVaultCustomCredentials.json func ExampleTasksClient_BeginUpdate_tasksUpdateWithKeyVaultCustomCredentials() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1271,7 +1271,7 @@ func ExampleTasksClient_BeginUpdate_tasksUpdateWithKeyVaultCustomCredentials() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/ManagedIdentity/TasksUpdate_WithMSICustomCredentials.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/ManagedIdentity/TasksUpdate_WithMSICustomCredentials.json func ExampleTasksClient_BeginUpdate_tasksUpdateWithMsiCustomCredentials() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1403,7 +1403,7 @@ func ExampleTasksClient_BeginUpdate_tasksUpdateWithMsiCustomCredentials() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksUpdate_WithOpaqueCustomCredentials.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksUpdate_WithOpaqueCustomCredentials.json func ExampleTasksClient_BeginUpdate_tasksUpdateWithOpaqueCustomCredentials() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1542,7 +1542,7 @@ func ExampleTasksClient_BeginUpdate_tasksUpdateWithOpaqueCustomCredentials() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksGetDetails.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksGetDetails.json func ExampleTasksClient_GetDetails() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_client.go index 3ad86fab3896..2ea54d84d433 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_client.go @@ -46,7 +46,7 @@ func NewTokensClient(subscriptionID string, credential azcore.TokenCredential, o // BeginCreate - Creates a token for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - tokenName - The name of the token. @@ -70,7 +70,7 @@ func (client *TokensClient) BeginCreate(ctx context.Context, resourceGroupName s // Create - Creates a token for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *TokensClient) create(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenCreateParameters Token, options *TokensClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "TokensClient.BeginCreate" @@ -113,7 +113,7 @@ func (client *TokensClient) createCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, tokenCreateParameters); err != nil { @@ -125,7 +125,7 @@ func (client *TokensClient) createCreateRequest(ctx context.Context, resourceGro // BeginDelete - Deletes a token from a container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - tokenName - The name of the token. @@ -148,7 +148,7 @@ func (client *TokensClient) BeginDelete(ctx context.Context, resourceGroupName s // Delete - Deletes a token from a container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *TokensClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, tokenName string, options *TokensClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "TokensClient.BeginDelete" @@ -191,7 +191,7 @@ func (client *TokensClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -200,7 +200,7 @@ func (client *TokensClient) deleteCreateRequest(ctx context.Context, resourceGro // Get - Gets the properties of the specified token. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - tokenName - The name of the token. @@ -248,7 +248,7 @@ func (client *TokensClient) getCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -265,7 +265,7 @@ func (client *TokensClient) getHandleResponse(resp *http.Response) (TokensClient // NewListPager - Lists all the tokens for the specified container registry. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - options - TokensClientListOptions contains the optional parameters for the TokensClient.NewListPager method. @@ -316,7 +316,7 @@ func (client *TokensClient) listCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -334,7 +334,7 @@ func (client *TokensClient) listHandleResponse(resp *http.Response) (TokensClien // BeginUpdate - Updates a token with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - tokenName - The name of the token. @@ -358,7 +358,7 @@ func (client *TokensClient) BeginUpdate(ctx context.Context, resourceGroupName s // Update - Updates a token with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *TokensClient) update(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenUpdateParameters TokenUpdateParameters, options *TokensClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "TokensClient.BeginUpdate" @@ -401,7 +401,7 @@ func (client *TokensClient) updateCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, tokenUpdateParameters); err != nil { diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_client_example_test.go index 5dcabaafeffc..ab3d8d7ff284 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/TokenList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/TokenList.json func ExampleTokensClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -57,7 +57,7 @@ func ExampleTokensClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/TokenGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/TokenGet.json func ExampleTokensClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -88,7 +88,7 @@ func ExampleTokensClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/TokenCreate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/TokenCreate.json func ExampleTokensClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -143,7 +143,7 @@ func ExampleTokensClient_BeginCreate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/TokenDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/TokenDelete.json func ExampleTokensClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -164,7 +164,7 @@ func ExampleTokensClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/TokenUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/TokenUpdate.json func ExampleTokensClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client.go index 1b42729b4388..796dbfe3a63e 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client.go @@ -46,7 +46,7 @@ func NewWebhooksClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreate - Creates a webhook for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - webhookName - The name of the webhook. @@ -70,7 +70,7 @@ func (client *WebhooksClient) BeginCreate(ctx context.Context, resourceGroupName // Create - Creates a webhook for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *WebhooksClient) create(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookCreateParameters WebhookCreateParameters, options *WebhooksClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "WebhooksClient.BeginCreate" @@ -113,7 +113,7 @@ func (client *WebhooksClient) createCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, webhookCreateParameters); err != nil { @@ -125,7 +125,7 @@ func (client *WebhooksClient) createCreateRequest(ctx context.Context, resourceG // BeginDelete - Deletes a webhook from a container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - webhookName - The name of the webhook. @@ -148,7 +148,7 @@ func (client *WebhooksClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Deletes a webhook from a container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *WebhooksClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, webhookName string, options *WebhooksClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "WebhooksClient.BeginDelete" @@ -191,7 +191,7 @@ func (client *WebhooksClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -199,7 +199,7 @@ func (client *WebhooksClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Gets the properties of the specified webhook. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - webhookName - The name of the webhook. @@ -247,7 +247,7 @@ func (client *WebhooksClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -265,7 +265,7 @@ func (client *WebhooksClient) getHandleResponse(resp *http.Response) (WebhooksCl // GetCallbackConfig - Gets the configuration of service URI and custom headers for the webhook. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - webhookName - The name of the webhook. @@ -314,7 +314,7 @@ func (client *WebhooksClient) getCallbackConfigCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -331,7 +331,7 @@ func (client *WebhooksClient) getCallbackConfigHandleResponse(resp *http.Respons // NewListPager - Lists all the webhooks for the specified container registry. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - options - WebhooksClientListOptions contains the optional parameters for the WebhooksClient.NewListPager method. @@ -382,7 +382,7 @@ func (client *WebhooksClient) listCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -399,7 +399,7 @@ func (client *WebhooksClient) listHandleResponse(resp *http.Response) (WebhooksC // NewListEventsPager - Lists recent events for the specified webhook. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - webhookName - The name of the webhook. @@ -455,7 +455,7 @@ func (client *WebhooksClient) listEventsCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -473,7 +473,7 @@ func (client *WebhooksClient) listEventsHandleResponse(resp *http.Response) (Web // Ping - Triggers a ping event to be sent to the webhook. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - webhookName - The name of the webhook. @@ -521,7 +521,7 @@ func (client *WebhooksClient) pingCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -539,7 +539,7 @@ func (client *WebhooksClient) pingHandleResponse(resp *http.Response) (WebhooksC // BeginUpdate - Updates a webhook with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - webhookName - The name of the webhook. @@ -563,7 +563,7 @@ func (client *WebhooksClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Updates a webhook with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *WebhooksClient) update(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookUpdateParameters WebhookUpdateParameters, options *WebhooksClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "WebhooksClient.BeginUpdate" @@ -606,7 +606,7 @@ func (client *WebhooksClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, webhookUpdateParameters); err != nil { diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client_example_test.go index bb2a36ce200d..caae854ea64d 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/WebhookList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/WebhookList.json func ExampleWebhooksClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -62,7 +62,7 @@ func ExampleWebhooksClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/WebhookGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/WebhookGet.json func ExampleWebhooksClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -98,7 +98,7 @@ func ExampleWebhooksClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/WebhookCreate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/WebhookCreate.json func ExampleWebhooksClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -115,7 +115,7 @@ func ExampleWebhooksClient_BeginCreate() { Actions: []*armcontainerregistry.WebhookAction{ to.Ptr(armcontainerregistry.WebhookActionPush)}, CustomHeaders: map[string]*string{ - "Authorization": to.Ptr("Basic 000000000000000000000000000000000000000000000000000"), + "Authorization": to.Ptr("******"), }, Scope: to.Ptr("myRepository"), ServiceURI: to.Ptr("http://myservice.com"), @@ -153,7 +153,7 @@ func ExampleWebhooksClient_BeginCreate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/WebhookDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/WebhookDelete.json func ExampleWebhooksClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -174,7 +174,7 @@ func ExampleWebhooksClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/WebhookUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/WebhookUpdate.json func ExampleWebhooksClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -190,7 +190,7 @@ func ExampleWebhooksClient_BeginUpdate() { Actions: []*armcontainerregistry.WebhookAction{ to.Ptr(armcontainerregistry.WebhookActionPush)}, CustomHeaders: map[string]*string{ - "Authorization": to.Ptr("Basic 000000000000000000000000000000000000000000000000000"), + "Authorization": to.Ptr("******"), }, Scope: to.Ptr("myRepository"), ServiceURI: to.Ptr("http://myservice.com"), @@ -228,7 +228,7 @@ func ExampleWebhooksClient_BeginUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/WebhookPing.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/WebhookPing.json func ExampleWebhooksClient_Ping() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -251,7 +251,7 @@ func ExampleWebhooksClient_Ping() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/WebhookListEvents.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/WebhookListEvents.json func ExampleWebhooksClient_NewListEventsPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -326,7 +326,7 @@ func ExampleWebhooksClient_NewListEventsPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/WebhookGetCallbackConfig.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/WebhookGetCallbackConfig.json func ExampleWebhooksClient_GetCallbackConfig() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -346,7 +346,7 @@ func ExampleWebhooksClient_GetCallbackConfig() { // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. // res.CallbackConfig = armcontainerregistry.CallbackConfig{ // CustomHeaders: map[string]*string{ - // "Authorization": to.Ptr("Basic 000000000000000000000000000000000000000000000000000"), + // "Authorization": to.Ptr("******"), // }, // ServiceURI: to.Ptr("http://myservice.com"), // } From c7baeae3e0b9cd98bc41969faeb603342d99585e Mon Sep 17 00:00:00 2001 From: Alancere <804873052@qq.com> Date: Wed, 13 Sep 2023 13:57:43 +0800 Subject: [PATCH 2/6] update assets.json --- .../containerregistry/armcontainerregistry/assets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/assets.json b/sdk/resourcemanager/containerregistry/armcontainerregistry/assets.json index 9164699f4ab9..f358a10a1d75 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/assets.json +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "go", "TagPrefix": "go/resourcemanager/containerregistry/armcontainerregistry", - "Tag": "go/resourcemanager/containerregistry/armcontainerregistry_3829c8ffd6" + "Tag": "go/resourcemanager/containerregistry/armcontainerregistry_1018fd58ac" } From 7cd2eab1d2f767352b0ee5878b202a8464408ba7 Mon Sep 17 00:00:00 2001 From: Alancere <804873052@qq.com> Date: Mon, 18 Sep 2023 15:17:03 +0800 Subject: [PATCH 3/6] release stable --- .../armcontainerregistry/CHANGELOG.md | 186 +--- .../armcontainerregistry/agentpools_client.go | 22 - .../agentpools_client_example_test.go | 2 +- .../armcontainerregistry/autorest.md | 6 +- .../armcontainerregistry/build.go | 2 +- .../armcontainerregistry/cacherules_client.go | 18 - .../cacherules_client_example_test.go | 2 +- .../armcontainerregistry/constants.go | 2 +- .../credentialsets_client.go | 18 - .../credentialsets_client_example_test.go | 2 +- .../fake/agentpools_server.go | 375 -------- .../fake/cacherules_server.go | 332 ------- .../fake/credentialsets_server.go | 332 ------- .../armcontainerregistry/fake/internal.go | 123 --- .../fake/operations_server.go | 96 --- .../fake/polymorphic_helpers.go | 91 -- .../fake/privateendpointconnections_server.go | 272 ------ .../fake/registries_server.go | 812 ------------------ .../fake/replications_server.go | 332 ------- .../armcontainerregistry/fake/runs_server.go | 343 -------- .../fake/scopemaps_server.go | 332 ------- .../fake/taskruns_server.go | 375 -------- .../armcontainerregistry/fake/tasks_server.go | 375 -------- .../armcontainerregistry/fake/time_rfc3339.go | 86 -- .../fake/tokens_server.go | 332 ------- .../fake/webhooks_server.go | 471 ---------- .../armcontainerregistry/fake_example_test.go | 79 -- .../armcontainerregistry/go.mod | 3 +- .../armcontainerregistry/go.sum | 2 + .../armcontainerregistry/models.go | 130 --- .../armcontainerregistry/models_serde.go | 387 --------- .../armcontainerregistry/operations_client.go | 2 - .../operations_client_example_test.go | 2 +- .../privateendpointconnections_client.go | 14 - ...endpointconnections_client_example_test.go | 2 +- .../armcontainerregistry/registries_client.go | 58 -- .../registries_client_example_test.go | 2 +- .../replications_client.go | 18 - .../replications_client_example_test.go | 2 +- .../armcontainerregistry/runs_client.go | 18 - .../runs_client_example_test.go | 2 +- .../armcontainerregistry/scopemaps_client.go | 18 - .../scopemaps_client_example_test.go | 2 +- .../armcontainerregistry/taskruns_client.go | 22 - .../taskruns_client_example_test.go | 2 +- .../armcontainerregistry/tasks_client.go | 22 - .../tasks_client_example_test.go | 2 +- .../armcontainerregistry/tokens_client.go | 18 - .../tokens_client_example_test.go | 2 +- .../armcontainerregistry/webhooks_client.go | 28 - .../webhooks_client_example_test.go | 2 +- 51 files changed, 29 insertions(+), 6149 deletions(-) delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/fake/agentpools_server.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/fake/cacherules_server.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/fake/credentialsets_server.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/fake/internal.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/fake/operations_server.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/fake/polymorphic_helpers.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/fake/privateendpointconnections_server.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/fake/registries_server.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/fake/replications_server.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/fake/runs_server.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/fake/scopemaps_server.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/fake/taskruns_server.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/fake/tasks_server.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/fake/time_rfc3339.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/fake/tokens_server.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/fake/webhooks_server.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/fake_example_test.go diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/CHANGELOG.md b/sdk/resourcemanager/containerregistry/armcontainerregistry/CHANGELOG.md index 2ad3730f7f80..44500c66b46e 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/CHANGELOG.md +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/CHANGELOG.md @@ -1,123 +1,21 @@ # Release History -## 1.1.0-beta.4 (2023-09-22) +## 2.0.0 (2023-09-22) ### Breaking Changes -- Type of `ErrorResponse.Error` has been changed from `*ErrorResponseBody` to `*ErrorDetail` -- Enum `ActivationStatus` has been removed -- Enum `AuditLogStatus` has been removed -- Enum `AzureADAuthenticationAsArmPolicyStatus` has been removed -- Enum `CertificateType` has been removed -- Enum `ConnectedRegistryMode` has been removed -- Enum `ConnectionState` has been removed -- Enum `LogLevel` has been removed -- Enum `PipelineOptions` has been removed -- Enum `PipelineRunSourceType` has been removed -- Enum `PipelineRunTargetType` has been removed -- Enum `PipelineSourceType` has been removed -- Enum `TLSStatus` has been removed -- Function `*ClientFactory.NewConnectedRegistriesClient` has been removed -- Function `*ClientFactory.NewExportPipelinesClient` has been removed -- Function `*ClientFactory.NewImportPipelinesClient` has been removed -- Function `*ClientFactory.NewPipelineRunsClient` has been removed -- Function `NewConnectedRegistriesClient` has been removed -- Function `*ConnectedRegistriesClient.BeginCreate` has been removed -- Function `*ConnectedRegistriesClient.BeginDeactivate` has been removed -- Function `*ConnectedRegistriesClient.BeginDelete` has been removed -- Function `*ConnectedRegistriesClient.Get` has been removed -- Function `*ConnectedRegistriesClient.NewListPager` has been removed -- Function `*ConnectedRegistriesClient.BeginUpdate` has been removed -- Function `NewExportPipelinesClient` has been removed -- Function `*ExportPipelinesClient.BeginCreate` has been removed -- Function `*ExportPipelinesClient.BeginDelete` has been removed -- Function `*ExportPipelinesClient.Get` has been removed -- Function `*ExportPipelinesClient.NewListPager` has been removed -- Function `NewImportPipelinesClient` has been removed -- Function `*ImportPipelinesClient.BeginCreate` has been removed -- Function `*ImportPipelinesClient.BeginDelete` has been removed -- Function `*ImportPipelinesClient.Get` has been removed -- Function `*ImportPipelinesClient.NewListPager` has been removed -- Function `NewPipelineRunsClient` has been removed -- Function `*PipelineRunsClient.BeginCreate` has been removed -- Function `*PipelineRunsClient.BeginDelete` has been removed -- Function `*PipelineRunsClient.Get` has been removed -- Function `*PipelineRunsClient.NewListPager` has been removed -- Struct `ActivationProperties` has been removed -- Struct `AzureADAuthenticationAsArmPolicy` has been removed -- Struct `ConnectedRegistry` has been removed -- Struct `ConnectedRegistryListResult` has been removed -- Struct `ConnectedRegistryProperties` has been removed -- Struct `ConnectedRegistryUpdateParameters` has been removed -- Struct `ConnectedRegistryUpdateProperties` has been removed -- Struct `ExportPipeline` has been removed -- Struct `ExportPipelineListResult` has been removed -- Struct `ExportPipelineProperties` has been removed -- Struct `ExportPipelineTargetProperties` has been removed -- Struct `ImportPipeline` has been removed -- Struct `ImportPipelineListResult` has been removed -- Struct `ImportPipelineProperties` has been removed -- Struct `ImportPipelineSourceProperties` has been removed -- Struct `LoggingProperties` has been removed -- Struct `LoginServerProperties` has been removed -- Struct `ParentProperties` has been removed -- Struct `PipelineRun` has been removed -- Struct `PipelineRunListResult` has been removed -- Struct `PipelineRunProperties` has been removed -- Struct `PipelineRunRequest` has been removed -- Struct `PipelineRunResponse` has been removed -- Struct `PipelineRunSourceProperties` has been removed -- Struct `PipelineRunTargetProperties` has been removed -- Struct `PipelineSourceTriggerDescriptor` has been removed -- Struct `PipelineSourceTriggerProperties` has been removed -- Struct `PipelineTriggerDescriptor` has been removed -- Struct `PipelineTriggerProperties` has been removed -- Struct `ProgressProperties` has been removed -- Struct `SoftDeletePolicy` has been removed -- Struct `StatusDetailProperties` has been removed -- Struct `SyncProperties` has been removed -- Struct `SyncUpdateProperties` has been removed -- Struct `TLSCertificateProperties` has been removed -- Struct `TLSProperties` has been removed -- Field `AzureADAuthenticationAsArmPolicy`, `SoftDeletePolicy` of struct `Policies` has been removed -- Field `AnonymousPullEnabled` of struct `RegistryProperties` has been removed -- Field `AnonymousPullEnabled` of struct `RegistryPropertiesUpdateParameters` has been removed - -### Features Added - -- New struct `ErrorAdditionalInfo` -- New struct `ErrorDetail` -- New struct `ErrorResponseForContainerRegistry` - - -## 1.1.0-beta.3 (2023-07-19) - -### Bug Fixes - -- Fixed a potential panic in faked paged and long-running operations. - -## 1.1.0-beta.2 (2023-06-12) - -### Features Added - -- Support for test fakes and OpenTelemetry trace spans. +- Struct `ActiveDirectoryObject` has been removed +- Struct `ErrorResponse` has been removed +- Struct `ErrorResponseBody` has been removed +- Struct `InnerErrorDescription` has been removed +- Struct `PackageType` has been removed +- Struct `ProxyResource` has been removed +- Struct `Resource` has been removed +- Struct `StorageAccountProperties` has been removed -## 1.1.0-beta.1 (2023-03-27) ### Features Added -- New enum type `ActivationStatus` with values `ActivationStatusActive`, `ActivationStatusInactive` -- New enum type `AuditLogStatus` with values `AuditLogStatusDisabled`, `AuditLogStatusEnabled` -- New enum type `AzureADAuthenticationAsArmPolicyStatus` with values `AzureADAuthenticationAsArmPolicyStatusDisabled`, `AzureADAuthenticationAsArmPolicyStatusEnabled` -- New enum type `CertificateType` with values `CertificateTypeLocalDirectory` -- New enum type `ConnectedRegistryMode` with values `ConnectedRegistryModeMirror`, `ConnectedRegistryModeReadOnly`, `ConnectedRegistryModeReadWrite`, `ConnectedRegistryModeRegistry` -- New enum type `ConnectionState` with values `ConnectionStateOffline`, `ConnectionStateOnline`, `ConnectionStateSyncing`, `ConnectionStateUnhealthy` - New enum type `CredentialHealthStatus` with values `CredentialHealthStatusHealthy`, `CredentialHealthStatusUnhealthy` - New enum type `CredentialName` with values `CredentialNameCredential1` -- New enum type `LogLevel` with values `LogLevelDebug`, `LogLevelError`, `LogLevelInformation`, `LogLevelNone`, `LogLevelWarning` -- New enum type `PipelineOptions` with values `PipelineOptionsContinueOnErrors`, `PipelineOptionsDeleteSourceBlobOnSuccess`, `PipelineOptionsOverwriteBlobs`, `PipelineOptionsOverwriteTags` -- New enum type `PipelineRunSourceType` with values `PipelineRunSourceTypeAzureStorageBlob` -- New enum type `PipelineRunTargetType` with values `PipelineRunTargetTypeAzureStorageBlob` -- New enum type `PipelineSourceType` with values `PipelineSourceTypeAzureStorageBlobContainer` -- New enum type `TLSStatus` with values `TLSStatusDisabled`, `TLSStatusEnabled` - New function `NewCacheRulesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CacheRulesClient, error)` - New function `*CacheRulesClient.BeginCreate(context.Context, string, string, string, CacheRule, *CacheRulesClientBeginCreateOptions) (*runtime.Poller[CacheRulesClientCreateResponse], error)` - New function `*CacheRulesClient.BeginDelete(context.Context, string, string, string, *CacheRulesClientBeginDeleteOptions) (*runtime.Poller[CacheRulesClientDeleteResponse], error)` @@ -125,91 +23,25 @@ - New function `*CacheRulesClient.NewListPager(string, string, *CacheRulesClientListOptions) *runtime.Pager[CacheRulesClientListResponse]` - New function `*CacheRulesClient.BeginUpdate(context.Context, string, string, string, CacheRuleUpdateParameters, *CacheRulesClientBeginUpdateOptions) (*runtime.Poller[CacheRulesClientUpdateResponse], error)` - New function `*ClientFactory.NewCacheRulesClient() *CacheRulesClient` -- New function `*ClientFactory.NewConnectedRegistriesClient() *ConnectedRegistriesClient` - New function `*ClientFactory.NewCredentialSetsClient() *CredentialSetsClient` -- New function `*ClientFactory.NewExportPipelinesClient() *ExportPipelinesClient` -- New function `*ClientFactory.NewImportPipelinesClient() *ImportPipelinesClient` -- New function `*ClientFactory.NewPipelineRunsClient() *PipelineRunsClient` -- New function `NewConnectedRegistriesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ConnectedRegistriesClient, error)` -- New function `*ConnectedRegistriesClient.BeginCreate(context.Context, string, string, string, ConnectedRegistry, *ConnectedRegistriesClientBeginCreateOptions) (*runtime.Poller[ConnectedRegistriesClientCreateResponse], error)` -- New function `*ConnectedRegistriesClient.BeginDeactivate(context.Context, string, string, string, *ConnectedRegistriesClientBeginDeactivateOptions) (*runtime.Poller[ConnectedRegistriesClientDeactivateResponse], error)` -- New function `*ConnectedRegistriesClient.BeginDelete(context.Context, string, string, string, *ConnectedRegistriesClientBeginDeleteOptions) (*runtime.Poller[ConnectedRegistriesClientDeleteResponse], error)` -- New function `*ConnectedRegistriesClient.Get(context.Context, string, string, string, *ConnectedRegistriesClientGetOptions) (ConnectedRegistriesClientGetResponse, error)` -- New function `*ConnectedRegistriesClient.NewListPager(string, string, *ConnectedRegistriesClientListOptions) *runtime.Pager[ConnectedRegistriesClientListResponse]` -- New function `*ConnectedRegistriesClient.BeginUpdate(context.Context, string, string, string, ConnectedRegistryUpdateParameters, *ConnectedRegistriesClientBeginUpdateOptions) (*runtime.Poller[ConnectedRegistriesClientUpdateResponse], error)` - New function `NewCredentialSetsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CredentialSetsClient, error)` - New function `*CredentialSetsClient.BeginCreate(context.Context, string, string, string, CredentialSet, *CredentialSetsClientBeginCreateOptions) (*runtime.Poller[CredentialSetsClientCreateResponse], error)` - New function `*CredentialSetsClient.BeginDelete(context.Context, string, string, string, *CredentialSetsClientBeginDeleteOptions) (*runtime.Poller[CredentialSetsClientDeleteResponse], error)` - New function `*CredentialSetsClient.Get(context.Context, string, string, string, *CredentialSetsClientGetOptions) (CredentialSetsClientGetResponse, error)` - New function `*CredentialSetsClient.NewListPager(string, string, *CredentialSetsClientListOptions) *runtime.Pager[CredentialSetsClientListResponse]` - New function `*CredentialSetsClient.BeginUpdate(context.Context, string, string, string, CredentialSetUpdateParameters, *CredentialSetsClientBeginUpdateOptions) (*runtime.Poller[CredentialSetsClientUpdateResponse], error)` -- New function `NewExportPipelinesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ExportPipelinesClient, error)` -- New function `*ExportPipelinesClient.BeginCreate(context.Context, string, string, string, ExportPipeline, *ExportPipelinesClientBeginCreateOptions) (*runtime.Poller[ExportPipelinesClientCreateResponse], error)` -- New function `*ExportPipelinesClient.BeginDelete(context.Context, string, string, string, *ExportPipelinesClientBeginDeleteOptions) (*runtime.Poller[ExportPipelinesClientDeleteResponse], error)` -- New function `*ExportPipelinesClient.Get(context.Context, string, string, string, *ExportPipelinesClientGetOptions) (ExportPipelinesClientGetResponse, error)` -- New function `*ExportPipelinesClient.NewListPager(string, string, *ExportPipelinesClientListOptions) *runtime.Pager[ExportPipelinesClientListResponse]` -- New function `NewImportPipelinesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ImportPipelinesClient, error)` -- New function `*ImportPipelinesClient.BeginCreate(context.Context, string, string, string, ImportPipeline, *ImportPipelinesClientBeginCreateOptions) (*runtime.Poller[ImportPipelinesClientCreateResponse], error)` -- New function `*ImportPipelinesClient.BeginDelete(context.Context, string, string, string, *ImportPipelinesClientBeginDeleteOptions) (*runtime.Poller[ImportPipelinesClientDeleteResponse], error)` -- New function `*ImportPipelinesClient.Get(context.Context, string, string, string, *ImportPipelinesClientGetOptions) (ImportPipelinesClientGetResponse, error)` -- New function `*ImportPipelinesClient.NewListPager(string, string, *ImportPipelinesClientListOptions) *runtime.Pager[ImportPipelinesClientListResponse]` -- New function `NewPipelineRunsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*PipelineRunsClient, error)` -- New function `*PipelineRunsClient.BeginCreate(context.Context, string, string, string, PipelineRun, *PipelineRunsClientBeginCreateOptions) (*runtime.Poller[PipelineRunsClientCreateResponse], error)` -- New function `*PipelineRunsClient.BeginDelete(context.Context, string, string, string, *PipelineRunsClientBeginDeleteOptions) (*runtime.Poller[PipelineRunsClientDeleteResponse], error)` -- New function `*PipelineRunsClient.Get(context.Context, string, string, string, *PipelineRunsClientGetOptions) (PipelineRunsClientGetResponse, error)` -- New function `*PipelineRunsClient.NewListPager(string, string, *PipelineRunsClientListOptions) *runtime.Pager[PipelineRunsClientListResponse]` -- New struct `ActivationProperties` - New struct `AuthCredential` -- New struct `AzureADAuthenticationAsArmPolicy` - New struct `CacheRule` - New struct `CacheRuleProperties` - New struct `CacheRuleUpdateParameters` - New struct `CacheRuleUpdateProperties` - New struct `CacheRulesListResult` -- New struct `ConnectedRegistry` -- New struct `ConnectedRegistryListResult` -- New struct `ConnectedRegistryProperties` -- New struct `ConnectedRegistryUpdateParameters` -- New struct `ConnectedRegistryUpdateProperties` - New struct `CredentialHealth` - New struct `CredentialSet` - New struct `CredentialSetListResult` - New struct `CredentialSetProperties` - New struct `CredentialSetUpdateParameters` - New struct `CredentialSetUpdateProperties` -- New struct `ExportPipeline` -- New struct `ExportPipelineListResult` -- New struct `ExportPipelineProperties` -- New struct `ExportPipelineTargetProperties` -- New struct `ImportPipeline` -- New struct `ImportPipelineListResult` -- New struct `ImportPipelineProperties` -- New struct `ImportPipelineSourceProperties` -- New struct `LoggingProperties` -- New struct `LoginServerProperties` -- New struct `ParentProperties` -- New struct `PipelineRun` -- New struct `PipelineRunListResult` -- New struct `PipelineRunProperties` -- New struct `PipelineRunRequest` -- New struct `PipelineRunResponse` -- New struct `PipelineRunSourceProperties` -- New struct `PipelineRunTargetProperties` -- New struct `PipelineSourceTriggerDescriptor` -- New struct `PipelineSourceTriggerProperties` -- New struct `PipelineTriggerDescriptor` -- New struct `PipelineTriggerProperties` -- New struct `ProgressProperties` -- New struct `SoftDeletePolicy` -- New struct `StatusDetailProperties` -- New struct `SyncProperties` -- New struct `SyncUpdateProperties` -- New struct `TLSCertificateProperties` -- New struct `TLSProperties` -- New field `AzureADAuthenticationAsArmPolicy` in struct `Policies` -- New field `SoftDeletePolicy` in struct `Policies` -- New field `AnonymousPullEnabled` in struct `RegistryProperties` -- New field `AnonymousPullEnabled` in struct `RegistryPropertiesUpdateParameters` ## 1.0.0 (2023-03-24) diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/agentpools_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/agentpools_client.go index ecef97ced047..cd78cba4c852 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/agentpools_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/agentpools_client.go @@ -71,10 +71,6 @@ func (client *AgentPoolsClient) BeginCreate(ctx context.Context, resourceGroupNa // Generated from API version 2019-06-01-preview func (client *AgentPoolsClient) create(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, agentPool AgentPool, options *AgentPoolsClientBeginCreateOptions) (*http.Response, error) { var err error - const operationName = "AgentPoolsClient.BeginCreate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, agentPoolName, agentPool, options) if err != nil { return nil, err @@ -147,10 +143,6 @@ func (client *AgentPoolsClient) BeginDelete(ctx context.Context, resourceGroupNa // Generated from API version 2019-06-01-preview func (client *AgentPoolsClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, options *AgentPoolsClientBeginDeleteOptions) (*http.Response, error) { var err error - const operationName = "AgentPoolsClient.BeginDelete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, agentPoolName, options) if err != nil { return nil, err @@ -203,10 +195,6 @@ func (client *AgentPoolsClient) deleteCreateRequest(ctx context.Context, resourc // - options - AgentPoolsClientGetOptions contains the optional parameters for the AgentPoolsClient.Get method. func (client *AgentPoolsClient) Get(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, options *AgentPoolsClientGetOptions) (AgentPoolsClientGetResponse, error) { var err error - const operationName = "AgentPoolsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, agentPoolName, options) if err != nil { return AgentPoolsClientGetResponse{}, err @@ -270,10 +258,6 @@ func (client *AgentPoolsClient) getHandleResponse(resp *http.Response) (AgentPoo // method. func (client *AgentPoolsClient) GetQueueStatus(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, options *AgentPoolsClientGetQueueStatusOptions) (AgentPoolsClientGetQueueStatusResponse, error) { var err error - const operationName = "AgentPoolsClient.GetQueueStatus" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getQueueStatusCreateRequest(ctx, resourceGroupName, registryName, agentPoolName, options) if err != nil { return AgentPoolsClientGetQueueStatusResponse{}, err @@ -338,7 +322,6 @@ func (client *AgentPoolsClient) NewListPager(resourceGroupName string, registryN return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *AgentPoolsClientListResponse) (AgentPoolsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AgentPoolsClient.NewListPager") var req *policy.Request var err error if page == nil { @@ -358,7 +341,6 @@ func (client *AgentPoolsClient) NewListPager(resourceGroupName string, registryN } return client.listHandleResponse(resp) }, - Tracer: client.internal.Tracer(), }) } @@ -422,10 +404,6 @@ func (client *AgentPoolsClient) BeginUpdate(ctx context.Context, resourceGroupNa // Generated from API version 2019-06-01-preview func (client *AgentPoolsClient) update(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, updateParameters AgentPoolUpdateParameters, options *AgentPoolsClientBeginUpdateOptions) (*http.Response, error) { var err error - const operationName = "AgentPoolsClient.BeginUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, agentPoolName, updateParameters, options) if err != nil { return nil, err diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/agentpools_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/agentpools_client_example_test.go index b17a83e2dc77..90cf9a2b49c1 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/agentpools_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/agentpools_client_example_test.go @@ -15,7 +15,7 @@ import ( "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/containerregistry/armcontainerregistry" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/v2" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/AgentPoolsGet.json diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/autorest.md b/sdk/resourcemanager/containerregistry/armcontainerregistry/autorest.md index b82fcccfb0f0..2b54ac312a69 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/autorest.md +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/autorest.md @@ -8,10 +8,6 @@ require: - https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/readme.md - https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module: github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry -module-version: 1.1.0-beta.4 -azcore-version: 1.8.0-beta.1 -generate-fakes: true -inject-spans: true +module-version: 2.0.0 tag: package-2023-07 ``` diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/build.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/build.go index ab8b3706bb05..f0c69abc5ccb 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/build.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/build.go @@ -2,6 +2,6 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // This file enables 'go generate' to regenerate this specific SDK -//go:generate pwsh ../../../../eng/scripts/build.ps1 -goExtension "@autorest/go@4.0.0-preview.54" -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/containerregistry/armcontainerregistry +//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -removeUnreferencedTypes resourcemanager/containerregistry/armcontainerregistry package armcontainerregistry diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client.go index fdf45cef1c57..4b8a697c387d 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client.go @@ -73,10 +73,6 @@ func (client *CacheRulesClient) BeginCreate(ctx context.Context, resourceGroupNa // Generated from API version 2023-07-01 func (client *CacheRulesClient) create(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, cacheRuleCreateParameters CacheRule, options *CacheRulesClientBeginCreateOptions) (*http.Response, error) { var err error - const operationName = "CacheRulesClient.BeginCreate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, cacheRuleName, cacheRuleCreateParameters, options) if err != nil { return nil, err @@ -151,10 +147,6 @@ func (client *CacheRulesClient) BeginDelete(ctx context.Context, resourceGroupNa // Generated from API version 2023-07-01 func (client *CacheRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, options *CacheRulesClientBeginDeleteOptions) (*http.Response, error) { var err error - const operationName = "CacheRulesClient.BeginDelete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, cacheRuleName, options) if err != nil { return nil, err @@ -207,10 +199,6 @@ func (client *CacheRulesClient) deleteCreateRequest(ctx context.Context, resourc // - options - CacheRulesClientGetOptions contains the optional parameters for the CacheRulesClient.Get method. func (client *CacheRulesClient) Get(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, options *CacheRulesClientGetOptions) (CacheRulesClientGetResponse, error) { var err error - const operationName = "CacheRulesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, cacheRuleName, options) if err != nil { return CacheRulesClientGetResponse{}, err @@ -275,7 +263,6 @@ func (client *CacheRulesClient) NewListPager(resourceGroupName string, registryN return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *CacheRulesClientListResponse) (CacheRulesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CacheRulesClient.NewListPager") var req *policy.Request var err error if page == nil { @@ -295,7 +282,6 @@ func (client *CacheRulesClient) NewListPager(resourceGroupName string, registryN } return client.listHandleResponse(resp) }, - Tracer: client.internal.Tracer(), }) } @@ -361,10 +347,6 @@ func (client *CacheRulesClient) BeginUpdate(ctx context.Context, resourceGroupNa // Generated from API version 2023-07-01 func (client *CacheRulesClient) update(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, cacheRuleUpdateParameters CacheRuleUpdateParameters, options *CacheRulesClientBeginUpdateOptions) (*http.Response, error) { var err error - const operationName = "CacheRulesClient.BeginUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, cacheRuleName, cacheRuleUpdateParameters, options) if err != nil { return nil, err diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client_example_test.go index 7ec730c04c61..bd15a3b7a186 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client_example_test.go @@ -15,7 +15,7 @@ import ( "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/containerregistry/armcontainerregistry" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/v2" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/CacheRuleList.json diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/constants.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/constants.go index d7fa4a1f85c5..77e16ab0c26e 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/constants.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/constants.go @@ -10,7 +10,7 @@ package armcontainerregistry const ( moduleName = "armcontainerregistry" - moduleVersion = "v1.1.0-beta.4" + moduleVersion = "v2.0.0" ) // Action - The action of IP ACL rule. diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client.go index e288d477f411..aaca648fd53d 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client.go @@ -74,10 +74,6 @@ func (client *CredentialSetsClient) BeginCreate(ctx context.Context, resourceGro // Generated from API version 2023-07-01 func (client *CredentialSetsClient) create(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, credentialSetCreateParameters CredentialSet, options *CredentialSetsClientBeginCreateOptions) (*http.Response, error) { var err error - const operationName = "CredentialSetsClient.BeginCreate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, credentialSetName, credentialSetCreateParameters, options) if err != nil { return nil, err @@ -153,10 +149,6 @@ func (client *CredentialSetsClient) BeginDelete(ctx context.Context, resourceGro // Generated from API version 2023-07-01 func (client *CredentialSetsClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, options *CredentialSetsClientBeginDeleteOptions) (*http.Response, error) { var err error - const operationName = "CredentialSetsClient.BeginDelete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, credentialSetName, options) if err != nil { return nil, err @@ -209,10 +201,6 @@ func (client *CredentialSetsClient) deleteCreateRequest(ctx context.Context, res // - options - CredentialSetsClientGetOptions contains the optional parameters for the CredentialSetsClient.Get method. func (client *CredentialSetsClient) Get(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, options *CredentialSetsClientGetOptions) (CredentialSetsClientGetResponse, error) { var err error - const operationName = "CredentialSetsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, credentialSetName, options) if err != nil { return CredentialSetsClientGetResponse{}, err @@ -277,7 +265,6 @@ func (client *CredentialSetsClient) NewListPager(resourceGroupName string, regis return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *CredentialSetsClientListResponse) (CredentialSetsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CredentialSetsClient.NewListPager") var req *policy.Request var err error if page == nil { @@ -297,7 +284,6 @@ func (client *CredentialSetsClient) NewListPager(resourceGroupName string, regis } return client.listHandleResponse(resp) }, - Tracer: client.internal.Tracer(), }) } @@ -364,10 +350,6 @@ func (client *CredentialSetsClient) BeginUpdate(ctx context.Context, resourceGro // Generated from API version 2023-07-01 func (client *CredentialSetsClient) update(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, credentialSetUpdateParameters CredentialSetUpdateParameters, options *CredentialSetsClientBeginUpdateOptions) (*http.Response, error) { var err error - const operationName = "CredentialSetsClient.BeginUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, credentialSetName, credentialSetUpdateParameters, options) if err != nil { return nil, err diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client_example_test.go index 652a625117a6..0d4a93d8d0ee 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client_example_test.go @@ -15,7 +15,7 @@ import ( "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/containerregistry/armcontainerregistry" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/v2" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/CredentialSetList.json diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/agentpools_server.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/agentpools_server.go deleted file mode 100644 index a095c57d865e..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/agentpools_server.go +++ /dev/null @@ -1,375 +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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" - "net/http" - "net/url" - "regexp" -) - -// AgentPoolsServer is a fake server for instances of the armcontainerregistry.AgentPoolsClient type. -type AgentPoolsServer struct { - // BeginCreate is the fake for method AgentPoolsClient.BeginCreate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, agentPool armcontainerregistry.AgentPool, options *armcontainerregistry.AgentPoolsClientBeginCreateOptions) (resp azfake.PollerResponder[armcontainerregistry.AgentPoolsClientCreateResponse], errResp azfake.ErrorResponder) - - // BeginDelete is the fake for method AgentPoolsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, options *armcontainerregistry.AgentPoolsClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerregistry.AgentPoolsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method AgentPoolsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, options *armcontainerregistry.AgentPoolsClientGetOptions) (resp azfake.Responder[armcontainerregistry.AgentPoolsClientGetResponse], errResp azfake.ErrorResponder) - - // GetQueueStatus is the fake for method AgentPoolsClient.GetQueueStatus - // HTTP status codes to indicate success: http.StatusOK - GetQueueStatus func(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, options *armcontainerregistry.AgentPoolsClientGetQueueStatusOptions) (resp azfake.Responder[armcontainerregistry.AgentPoolsClientGetQueueStatusResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method AgentPoolsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, registryName string, options *armcontainerregistry.AgentPoolsClientListOptions) (resp azfake.PagerResponder[armcontainerregistry.AgentPoolsClientListResponse]) - - // BeginUpdate is the fake for method AgentPoolsClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginUpdate func(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, updateParameters armcontainerregistry.AgentPoolUpdateParameters, options *armcontainerregistry.AgentPoolsClientBeginUpdateOptions) (resp azfake.PollerResponder[armcontainerregistry.AgentPoolsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewAgentPoolsServerTransport creates a new instance of AgentPoolsServerTransport with the provided implementation. -// The returned AgentPoolsServerTransport instance is connected to an instance of armcontainerregistry.AgentPoolsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAgentPoolsServerTransport(srv *AgentPoolsServer) *AgentPoolsServerTransport { - return &AgentPoolsServerTransport{ - srv: srv, - beginCreate: newTracker[azfake.PollerResponder[armcontainerregistry.AgentPoolsClientCreateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armcontainerregistry.AgentPoolsClientDeleteResponse]](), - newListPager: newTracker[azfake.PagerResponder[armcontainerregistry.AgentPoolsClientListResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armcontainerregistry.AgentPoolsClientUpdateResponse]](), - } -} - -// AgentPoolsServerTransport connects instances of armcontainerregistry.AgentPoolsClient to instances of AgentPoolsServer. -// Don't use this type directly, use NewAgentPoolsServerTransport instead. -type AgentPoolsServerTransport struct { - srv *AgentPoolsServer - beginCreate *tracker[azfake.PollerResponder[armcontainerregistry.AgentPoolsClientCreateResponse]] - beginDelete *tracker[azfake.PollerResponder[armcontainerregistry.AgentPoolsClientDeleteResponse]] - newListPager *tracker[azfake.PagerResponder[armcontainerregistry.AgentPoolsClientListResponse]] - beginUpdate *tracker[azfake.PollerResponder[armcontainerregistry.AgentPoolsClientUpdateResponse]] -} - -// Do implements the policy.Transporter interface for AgentPoolsServerTransport. -func (a *AgentPoolsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "AgentPoolsClient.BeginCreate": - resp, err = a.dispatchBeginCreate(req) - case "AgentPoolsClient.BeginDelete": - resp, err = a.dispatchBeginDelete(req) - case "AgentPoolsClient.Get": - resp, err = a.dispatchGet(req) - case "AgentPoolsClient.GetQueueStatus": - resp, err = a.dispatchGetQueueStatus(req) - case "AgentPoolsClient.NewListPager": - resp, err = a.dispatchNewListPager(req) - case "AgentPoolsClient.BeginUpdate": - resp, err = a.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *AgentPoolsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { - if a.srv.BeginCreate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} - } - beginCreate := a.beginCreate.get(req) - if beginCreate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/agentPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.AgentPool](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - agentPoolNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("agentPoolName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.BeginCreate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, agentPoolNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreate = &respr - a.beginCreate.add(req, beginCreate) - } - - resp, err := server.PollerResponderNext(beginCreate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - a.beginCreate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginCreate) { - a.beginCreate.remove(req) - } - - return resp, nil -} - -func (a *AgentPoolsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if a.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - beginDelete := a.beginDelete.get(req) - if beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/agentPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - agentPoolNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("agentPoolName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.BeginDelete(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, agentPoolNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginDelete = &respr - a.beginDelete.add(req, beginDelete) - } - - resp, err := server.PollerResponderNext(beginDelete, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - a.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} - } - if !server.PollerResponderMore(beginDelete) { - a.beginDelete.remove(req) - } - - return resp, nil -} - -func (a *AgentPoolsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if a.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/agentPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - agentPoolNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("agentPoolName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, agentPoolNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AgentPool, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AgentPoolsServerTransport) dispatchGetQueueStatus(req *http.Request) (*http.Response, error) { - if a.srv.GetQueueStatus == nil { - return nil, &nonRetriableError{errors.New("fake for method GetQueueStatus not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/agentPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listQueueStatus` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - agentPoolNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("agentPoolName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.GetQueueStatus(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, agentPoolNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AgentPoolQueueStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AgentPoolsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := a.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/agentPools` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - resp := a.srv.NewListPager(resourceGroupNameUnescaped, registryNameUnescaped, nil) - newListPager = &resp - a.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcontainerregistry.AgentPoolsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - a.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - a.newListPager.remove(req) - } - return resp, nil -} - -func (a *AgentPoolsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { - if a.srv.BeginUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} - } - beginUpdate := a.beginUpdate.get(req) - if beginUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/agentPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.AgentPoolUpdateParameters](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - agentPoolNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("agentPoolName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.BeginUpdate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, agentPoolNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginUpdate = &respr - a.beginUpdate.add(req, beginUpdate) - } - - resp, err := server.PollerResponderNext(beginUpdate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - a.beginUpdate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginUpdate) { - a.beginUpdate.remove(req) - } - - return resp, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/cacherules_server.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/cacherules_server.go deleted file mode 100644 index a9d1b53df08b..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/cacherules_server.go +++ /dev/null @@ -1,332 +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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" - "net/http" - "net/url" - "regexp" -) - -// CacheRulesServer is a fake server for instances of the armcontainerregistry.CacheRulesClient type. -type CacheRulesServer struct { - // BeginCreate is the fake for method CacheRulesClient.BeginCreate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, cacheRuleCreateParameters armcontainerregistry.CacheRule, options *armcontainerregistry.CacheRulesClientBeginCreateOptions) (resp azfake.PollerResponder[armcontainerregistry.CacheRulesClientCreateResponse], errResp azfake.ErrorResponder) - - // BeginDelete is the fake for method CacheRulesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, options *armcontainerregistry.CacheRulesClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerregistry.CacheRulesClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method CacheRulesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, options *armcontainerregistry.CacheRulesClientGetOptions) (resp azfake.Responder[armcontainerregistry.CacheRulesClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method CacheRulesClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, registryName string, options *armcontainerregistry.CacheRulesClientListOptions) (resp azfake.PagerResponder[armcontainerregistry.CacheRulesClientListResponse]) - - // BeginUpdate is the fake for method CacheRulesClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginUpdate func(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, cacheRuleUpdateParameters armcontainerregistry.CacheRuleUpdateParameters, options *armcontainerregistry.CacheRulesClientBeginUpdateOptions) (resp azfake.PollerResponder[armcontainerregistry.CacheRulesClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewCacheRulesServerTransport creates a new instance of CacheRulesServerTransport with the provided implementation. -// The returned CacheRulesServerTransport instance is connected to an instance of armcontainerregistry.CacheRulesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewCacheRulesServerTransport(srv *CacheRulesServer) *CacheRulesServerTransport { - return &CacheRulesServerTransport{ - srv: srv, - beginCreate: newTracker[azfake.PollerResponder[armcontainerregistry.CacheRulesClientCreateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armcontainerregistry.CacheRulesClientDeleteResponse]](), - newListPager: newTracker[azfake.PagerResponder[armcontainerregistry.CacheRulesClientListResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armcontainerregistry.CacheRulesClientUpdateResponse]](), - } -} - -// CacheRulesServerTransport connects instances of armcontainerregistry.CacheRulesClient to instances of CacheRulesServer. -// Don't use this type directly, use NewCacheRulesServerTransport instead. -type CacheRulesServerTransport struct { - srv *CacheRulesServer - beginCreate *tracker[azfake.PollerResponder[armcontainerregistry.CacheRulesClientCreateResponse]] - beginDelete *tracker[azfake.PollerResponder[armcontainerregistry.CacheRulesClientDeleteResponse]] - newListPager *tracker[azfake.PagerResponder[armcontainerregistry.CacheRulesClientListResponse]] - beginUpdate *tracker[azfake.PollerResponder[armcontainerregistry.CacheRulesClientUpdateResponse]] -} - -// Do implements the policy.Transporter interface for CacheRulesServerTransport. -func (c *CacheRulesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "CacheRulesClient.BeginCreate": - resp, err = c.dispatchBeginCreate(req) - case "CacheRulesClient.BeginDelete": - resp, err = c.dispatchBeginDelete(req) - case "CacheRulesClient.Get": - resp, err = c.dispatchGet(req) - case "CacheRulesClient.NewListPager": - resp, err = c.dispatchNewListPager(req) - case "CacheRulesClient.BeginUpdate": - resp, err = c.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (c *CacheRulesServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { - if c.srv.BeginCreate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} - } - beginCreate := c.beginCreate.get(req) - if beginCreate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cacheRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.CacheRule](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - cacheRuleNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("cacheRuleName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.BeginCreate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, cacheRuleNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreate = &respr - c.beginCreate.add(req, beginCreate) - } - - resp, err := server.PollerResponderNext(beginCreate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - c.beginCreate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginCreate) { - c.beginCreate.remove(req) - } - - return resp, nil -} - -func (c *CacheRulesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if c.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - beginDelete := c.beginDelete.get(req) - if beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cacheRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - cacheRuleNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("cacheRuleName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.BeginDelete(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, cacheRuleNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginDelete = &respr - c.beginDelete.add(req, beginDelete) - } - - resp, err := server.PollerResponderNext(beginDelete, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - c.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} - } - if !server.PollerResponderMore(beginDelete) { - c.beginDelete.remove(req) - } - - return resp, nil -} - -func (c *CacheRulesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if c.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cacheRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - cacheRuleNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("cacheRuleName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, cacheRuleNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CacheRule, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (c *CacheRulesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if c.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := c.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cacheRules` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - resp := c.srv.NewListPager(resourceGroupNameUnescaped, registryNameUnescaped, nil) - newListPager = &resp - c.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcontainerregistry.CacheRulesClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - c.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - c.newListPager.remove(req) - } - return resp, nil -} - -func (c *CacheRulesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { - if c.srv.BeginUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} - } - beginUpdate := c.beginUpdate.get(req) - if beginUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cacheRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.CacheRuleUpdateParameters](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - cacheRuleNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("cacheRuleName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.BeginUpdate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, cacheRuleNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginUpdate = &respr - c.beginUpdate.add(req, beginUpdate) - } - - resp, err := server.PollerResponderNext(beginUpdate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - c.beginUpdate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginUpdate) { - c.beginUpdate.remove(req) - } - - return resp, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/credentialsets_server.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/credentialsets_server.go deleted file mode 100644 index 591efcda35c5..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/credentialsets_server.go +++ /dev/null @@ -1,332 +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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" - "net/http" - "net/url" - "regexp" -) - -// CredentialSetsServer is a fake server for instances of the armcontainerregistry.CredentialSetsClient type. -type CredentialSetsServer struct { - // BeginCreate is the fake for method CredentialSetsClient.BeginCreate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, credentialSetCreateParameters armcontainerregistry.CredentialSet, options *armcontainerregistry.CredentialSetsClientBeginCreateOptions) (resp azfake.PollerResponder[armcontainerregistry.CredentialSetsClientCreateResponse], errResp azfake.ErrorResponder) - - // BeginDelete is the fake for method CredentialSetsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, options *armcontainerregistry.CredentialSetsClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerregistry.CredentialSetsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method CredentialSetsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, options *armcontainerregistry.CredentialSetsClientGetOptions) (resp azfake.Responder[armcontainerregistry.CredentialSetsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method CredentialSetsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, registryName string, options *armcontainerregistry.CredentialSetsClientListOptions) (resp azfake.PagerResponder[armcontainerregistry.CredentialSetsClientListResponse]) - - // BeginUpdate is the fake for method CredentialSetsClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginUpdate func(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, credentialSetUpdateParameters armcontainerregistry.CredentialSetUpdateParameters, options *armcontainerregistry.CredentialSetsClientBeginUpdateOptions) (resp azfake.PollerResponder[armcontainerregistry.CredentialSetsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewCredentialSetsServerTransport creates a new instance of CredentialSetsServerTransport with the provided implementation. -// The returned CredentialSetsServerTransport instance is connected to an instance of armcontainerregistry.CredentialSetsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewCredentialSetsServerTransport(srv *CredentialSetsServer) *CredentialSetsServerTransport { - return &CredentialSetsServerTransport{ - srv: srv, - beginCreate: newTracker[azfake.PollerResponder[armcontainerregistry.CredentialSetsClientCreateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armcontainerregistry.CredentialSetsClientDeleteResponse]](), - newListPager: newTracker[azfake.PagerResponder[armcontainerregistry.CredentialSetsClientListResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armcontainerregistry.CredentialSetsClientUpdateResponse]](), - } -} - -// CredentialSetsServerTransport connects instances of armcontainerregistry.CredentialSetsClient to instances of CredentialSetsServer. -// Don't use this type directly, use NewCredentialSetsServerTransport instead. -type CredentialSetsServerTransport struct { - srv *CredentialSetsServer - beginCreate *tracker[azfake.PollerResponder[armcontainerregistry.CredentialSetsClientCreateResponse]] - beginDelete *tracker[azfake.PollerResponder[armcontainerregistry.CredentialSetsClientDeleteResponse]] - newListPager *tracker[azfake.PagerResponder[armcontainerregistry.CredentialSetsClientListResponse]] - beginUpdate *tracker[azfake.PollerResponder[armcontainerregistry.CredentialSetsClientUpdateResponse]] -} - -// Do implements the policy.Transporter interface for CredentialSetsServerTransport. -func (c *CredentialSetsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "CredentialSetsClient.BeginCreate": - resp, err = c.dispatchBeginCreate(req) - case "CredentialSetsClient.BeginDelete": - resp, err = c.dispatchBeginDelete(req) - case "CredentialSetsClient.Get": - resp, err = c.dispatchGet(req) - case "CredentialSetsClient.NewListPager": - resp, err = c.dispatchNewListPager(req) - case "CredentialSetsClient.BeginUpdate": - resp, err = c.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (c *CredentialSetsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { - if c.srv.BeginCreate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} - } - beginCreate := c.beginCreate.get(req) - if beginCreate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/credentialSets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.CredentialSet](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - credentialSetNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("credentialSetName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.BeginCreate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, credentialSetNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreate = &respr - c.beginCreate.add(req, beginCreate) - } - - resp, err := server.PollerResponderNext(beginCreate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - c.beginCreate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginCreate) { - c.beginCreate.remove(req) - } - - return resp, nil -} - -func (c *CredentialSetsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if c.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - beginDelete := c.beginDelete.get(req) - if beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/credentialSets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - credentialSetNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("credentialSetName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.BeginDelete(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, credentialSetNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginDelete = &respr - c.beginDelete.add(req, beginDelete) - } - - resp, err := server.PollerResponderNext(beginDelete, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - c.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} - } - if !server.PollerResponderMore(beginDelete) { - c.beginDelete.remove(req) - } - - return resp, nil -} - -func (c *CredentialSetsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if c.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/credentialSets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - credentialSetNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("credentialSetName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, credentialSetNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CredentialSet, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (c *CredentialSetsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if c.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := c.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/credentialSets` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - resp := c.srv.NewListPager(resourceGroupNameUnescaped, registryNameUnescaped, nil) - newListPager = &resp - c.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcontainerregistry.CredentialSetsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - c.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - c.newListPager.remove(req) - } - return resp, nil -} - -func (c *CredentialSetsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { - if c.srv.BeginUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} - } - beginUpdate := c.beginUpdate.get(req) - if beginUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/credentialSets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.CredentialSetUpdateParameters](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - credentialSetNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("credentialSetName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.BeginUpdate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, credentialSetNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginUpdate = &respr - c.beginUpdate.add(req, beginUpdate) - } - - resp, err := server.PollerResponderNext(beginUpdate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - c.beginUpdate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginUpdate) { - c.beginUpdate.remove(req) - } - - return resp, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/internal.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/internal.go deleted file mode 100644 index 03b635903572..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/internal.go +++ /dev/null @@ -1,123 +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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "io" - "net/http" - "reflect" - "regexp" - "strings" - "sync" -) - -type nonRetriableError struct { - error -} - -func (nonRetriableError) NonRetriable() { - // marker method -} - -func getOptional[T any](v T) *T { - if reflect.ValueOf(v).IsZero() { - return nil - } - return &v -} - -func getHeaderValue(h http.Header, k string) string { - v := h[k] - if len(v) == 0 { - return "" - } - return v[0] -} - -func parseOptional[T any](v string, parse func(v string) (T, error)) (*T, error) { - if v == "" { - return nil, nil - } - t, err := parse(v) - if err != nil { - return nil, err - } - return &t, err -} - -func parseWithCast[T any](v string, parse func(v string) (T, error)) (T, error) { - t, err := parse(v) - if err != nil { - return *new(T), err - } - return t, err -} - -func readRequestBody(req *http.Request) ([]byte, error) { - if req.Body == nil { - return nil, nil - } - body, err := io.ReadAll(req.Body) - if err != nil { - return nil, err - } - req.Body.Close() - return body, nil -} - -func contains[T comparable](s []T, v T) bool { - for _, vv := range s { - if vv == v { - return true - } - } - return false -} - -func newTracker[T any]() *tracker[T] { - return &tracker[T]{ - items: map[string]*T{}, - } -} - -type tracker[T any] struct { - items map[string]*T - mu sync.Mutex -} - -func (p *tracker[T]) key(req *http.Request) string { - path := req.URL.Path - if match, _ := regexp.Match(`/page_\d+$`, []byte(path)); match { - path = path[:strings.LastIndex(path, "/")] - } else if strings.HasSuffix(path, "/get/fake/status") { - path = path[:len(path)-16] - } - return path -} - -func (p *tracker[T]) get(req *http.Request) *T { - p.mu.Lock() - defer p.mu.Unlock() - if item, ok := p.items[p.key(req)]; ok { - return item - } - return nil -} - -func (p *tracker[T]) add(req *http.Request, item *T) { - p.mu.Lock() - defer p.mu.Unlock() - p.items[p.key(req)] = item -} - -func (p *tracker[T]) remove(req *http.Request) { - p.mu.Lock() - defer p.mu.Unlock() - delete(p.items, p.key(req)) -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/operations_server.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/operations_server.go deleted file mode 100644 index 679497016edc..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/operations_server.go +++ /dev/null @@ -1,96 +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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" - "net/http" -) - -// OperationsServer is a fake server for instances of the armcontainerregistry.OperationsClient type. -type OperationsServer struct { - // NewListPager is the fake for method OperationsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armcontainerregistry.OperationsClientListOptions) (resp azfake.PagerResponder[armcontainerregistry.OperationsClientListResponse]) -} - -// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. -// The returned OperationsServerTransport instance is connected to an instance of armcontainerregistry.OperationsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { - return &OperationsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armcontainerregistry.OperationsClientListResponse]](), - } -} - -// OperationsServerTransport connects instances of armcontainerregistry.OperationsClient to instances of OperationsServer. -// Don't use this type directly, use NewOperationsServerTransport instead. -type OperationsServerTransport struct { - srv *OperationsServer - newListPager *tracker[azfake.PagerResponder[armcontainerregistry.OperationsClientListResponse]] -} - -// Do implements the policy.Transporter interface for OperationsServerTransport. -func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if o.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := o.newListPager.get(req) - if newListPager == nil { - resp := o.srv.NewListPager(nil) - newListPager = &resp - o.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcontainerregistry.OperationsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - o.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - o.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/polymorphic_helpers.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/polymorphic_helpers.go deleted file mode 100644 index 73d14565ff9d..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/polymorphic_helpers.go +++ /dev/null @@ -1,91 +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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "encoding/json" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" -) - -func unmarshalRunRequestClassification(rawMsg json.RawMessage) (armcontainerregistry.RunRequestClassification, error) { - if rawMsg == nil { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b armcontainerregistry.RunRequestClassification - switch m["type"] { - case "DockerBuildRequest": - b = &armcontainerregistry.DockerBuildRequest{} - case "EncodedTaskRunRequest": - b = &armcontainerregistry.EncodedTaskRunRequest{} - case "FileTaskRunRequest": - b = &armcontainerregistry.FileTaskRunRequest{} - case "TaskRunRequest": - b = &armcontainerregistry.TaskRunRequest{} - default: - b = &armcontainerregistry.RunRequest{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalTaskStepPropertiesClassification(rawMsg json.RawMessage) (armcontainerregistry.TaskStepPropertiesClassification, error) { - if rawMsg == nil { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b armcontainerregistry.TaskStepPropertiesClassification - switch m["type"] { - case string(armcontainerregistry.StepTypeDocker): - b = &armcontainerregistry.DockerBuildStep{} - case string(armcontainerregistry.StepTypeEncodedTask): - b = &armcontainerregistry.EncodedTaskStep{} - case string(armcontainerregistry.StepTypeFileTask): - b = &armcontainerregistry.FileTaskStep{} - default: - b = &armcontainerregistry.TaskStepProperties{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalTaskStepUpdateParametersClassification(rawMsg json.RawMessage) (armcontainerregistry.TaskStepUpdateParametersClassification, error) { - if rawMsg == nil { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b armcontainerregistry.TaskStepUpdateParametersClassification - switch m["type"] { - case string(armcontainerregistry.StepTypeDocker): - b = &armcontainerregistry.DockerBuildStepUpdateParameters{} - case string(armcontainerregistry.StepTypeEncodedTask): - b = &armcontainerregistry.EncodedTaskStepUpdateParameters{} - case string(armcontainerregistry.StepTypeFileTask): - b = &armcontainerregistry.FileTaskStepUpdateParameters{} - default: - b = &armcontainerregistry.TaskStepUpdateParameters{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/privateendpointconnections_server.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/privateendpointconnections_server.go deleted file mode 100644 index 071c1c6e292c..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/privateendpointconnections_server.go +++ /dev/null @@ -1,272 +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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" - "net/http" - "net/url" - "regexp" -) - -// PrivateEndpointConnectionsServer is a fake server for instances of the armcontainerregistry.PrivateEndpointConnectionsClient type. -type PrivateEndpointConnectionsServer struct { - // BeginCreateOrUpdate is the fake for method PrivateEndpointConnectionsClient.BeginCreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, privateEndpointConnection armcontainerregistry.PrivateEndpointConnection, options *armcontainerregistry.PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armcontainerregistry.PrivateEndpointConnectionsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // BeginDelete is the fake for method PrivateEndpointConnectionsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, options *armcontainerregistry.PrivateEndpointConnectionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerregistry.PrivateEndpointConnectionsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method PrivateEndpointConnectionsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, options *armcontainerregistry.PrivateEndpointConnectionsClientGetOptions) (resp azfake.Responder[armcontainerregistry.PrivateEndpointConnectionsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method PrivateEndpointConnectionsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, registryName string, options *armcontainerregistry.PrivateEndpointConnectionsClientListOptions) (resp azfake.PagerResponder[armcontainerregistry.PrivateEndpointConnectionsClientListResponse]) -} - -// NewPrivateEndpointConnectionsServerTransport creates a new instance of PrivateEndpointConnectionsServerTransport with the provided implementation. -// The returned PrivateEndpointConnectionsServerTransport instance is connected to an instance of armcontainerregistry.PrivateEndpointConnectionsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewPrivateEndpointConnectionsServerTransport(srv *PrivateEndpointConnectionsServer) *PrivateEndpointConnectionsServerTransport { - return &PrivateEndpointConnectionsServerTransport{ - srv: srv, - beginCreateOrUpdate: newTracker[azfake.PollerResponder[armcontainerregistry.PrivateEndpointConnectionsClientCreateOrUpdateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armcontainerregistry.PrivateEndpointConnectionsClientDeleteResponse]](), - newListPager: newTracker[azfake.PagerResponder[armcontainerregistry.PrivateEndpointConnectionsClientListResponse]](), - } -} - -// PrivateEndpointConnectionsServerTransport connects instances of armcontainerregistry.PrivateEndpointConnectionsClient to instances of PrivateEndpointConnectionsServer. -// Don't use this type directly, use NewPrivateEndpointConnectionsServerTransport instead. -type PrivateEndpointConnectionsServerTransport struct { - srv *PrivateEndpointConnectionsServer - beginCreateOrUpdate *tracker[azfake.PollerResponder[armcontainerregistry.PrivateEndpointConnectionsClientCreateOrUpdateResponse]] - beginDelete *tracker[azfake.PollerResponder[armcontainerregistry.PrivateEndpointConnectionsClientDeleteResponse]] - newListPager *tracker[azfake.PagerResponder[armcontainerregistry.PrivateEndpointConnectionsClientListResponse]] -} - -// Do implements the policy.Transporter interface for PrivateEndpointConnectionsServerTransport. -func (p *PrivateEndpointConnectionsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "PrivateEndpointConnectionsClient.BeginCreateOrUpdate": - resp, err = p.dispatchBeginCreateOrUpdate(req) - case "PrivateEndpointConnectionsClient.BeginDelete": - resp, err = p.dispatchBeginDelete(req) - case "PrivateEndpointConnectionsClient.Get": - resp, err = p.dispatchGet(req) - case "PrivateEndpointConnectionsClient.NewListPager": - resp, err = p.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { - if p.srv.BeginCreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} - } - beginCreateOrUpdate := p.beginCreateOrUpdate.get(req) - if beginCreateOrUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.PrivateEndpointConnection](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - privateEndpointConnectionNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, privateEndpointConnectionNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreateOrUpdate = &respr - p.beginCreateOrUpdate.add(req, beginCreateOrUpdate) - } - - resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - p.beginCreateOrUpdate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginCreateOrUpdate) { - p.beginCreateOrUpdate.remove(req) - } - - return resp, nil -} - -func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if p.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - beginDelete := p.beginDelete.get(req) - if beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - privateEndpointConnectionNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, privateEndpointConnectionNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginDelete = &respr - p.beginDelete.add(req, beginDelete) - } - - resp, err := server.PollerResponderNext(beginDelete, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - p.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} - } - if !server.PollerResponderMore(beginDelete) { - p.beginDelete.remove(req) - } - - return resp, nil -} - -func (p *PrivateEndpointConnectionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - privateEndpointConnectionNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, privateEndpointConnectionNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnection, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (p *PrivateEndpointConnectionsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if p.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := p.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - resp := p.srv.NewListPager(resourceGroupNameUnescaped, registryNameUnescaped, nil) - newListPager = &resp - p.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcontainerregistry.PrivateEndpointConnectionsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - p.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - p.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/registries_server.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/registries_server.go deleted file mode 100644 index 2bfe5b17e10f..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/registries_server.go +++ /dev/null @@ -1,812 +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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" - "net/http" - "net/url" - "regexp" -) - -// RegistriesServer is a fake server for instances of the armcontainerregistry.RegistriesClient type. -type RegistriesServer struct { - // CheckNameAvailability is the fake for method RegistriesClient.CheckNameAvailability - // HTTP status codes to indicate success: http.StatusOK - CheckNameAvailability func(ctx context.Context, registryNameCheckRequest armcontainerregistry.RegistryNameCheckRequest, options *armcontainerregistry.RegistriesClientCheckNameAvailabilityOptions) (resp azfake.Responder[armcontainerregistry.RegistriesClientCheckNameAvailabilityResponse], errResp azfake.ErrorResponder) - - // BeginCreate is the fake for method RegistriesClient.BeginCreate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, registryName string, registry armcontainerregistry.Registry, options *armcontainerregistry.RegistriesClientBeginCreateOptions) (resp azfake.PollerResponder[armcontainerregistry.RegistriesClientCreateResponse], errResp azfake.ErrorResponder) - - // BeginDelete is the fake for method RegistriesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, registryName string, options *armcontainerregistry.RegistriesClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerregistry.RegistriesClientDeleteResponse], errResp azfake.ErrorResponder) - - // BeginGenerateCredentials is the fake for method RegistriesClient.BeginGenerateCredentials - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginGenerateCredentials func(ctx context.Context, resourceGroupName string, registryName string, generateCredentialsParameters armcontainerregistry.GenerateCredentialsParameters, options *armcontainerregistry.RegistriesClientBeginGenerateCredentialsOptions) (resp azfake.PollerResponder[armcontainerregistry.RegistriesClientGenerateCredentialsResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method RegistriesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, registryName string, options *armcontainerregistry.RegistriesClientGetOptions) (resp azfake.Responder[armcontainerregistry.RegistriesClientGetResponse], errResp azfake.ErrorResponder) - - // GetBuildSourceUploadURL is the fake for method RegistriesClient.GetBuildSourceUploadURL - // HTTP status codes to indicate success: http.StatusOK - GetBuildSourceUploadURL func(ctx context.Context, resourceGroupName string, registryName string, options *armcontainerregistry.RegistriesClientGetBuildSourceUploadURLOptions) (resp azfake.Responder[armcontainerregistry.RegistriesClientGetBuildSourceUploadURLResponse], errResp azfake.ErrorResponder) - - // GetPrivateLinkResource is the fake for method RegistriesClient.GetPrivateLinkResource - // HTTP status codes to indicate success: http.StatusOK - GetPrivateLinkResource func(ctx context.Context, resourceGroupName string, registryName string, groupName string, options *armcontainerregistry.RegistriesClientGetPrivateLinkResourceOptions) (resp azfake.Responder[armcontainerregistry.RegistriesClientGetPrivateLinkResourceResponse], errResp azfake.ErrorResponder) - - // BeginImportImage is the fake for method RegistriesClient.BeginImportImage - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginImportImage func(ctx context.Context, resourceGroupName string, registryName string, parameters armcontainerregistry.ImportImageParameters, options *armcontainerregistry.RegistriesClientBeginImportImageOptions) (resp azfake.PollerResponder[armcontainerregistry.RegistriesClientImportImageResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method RegistriesClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armcontainerregistry.RegistriesClientListOptions) (resp azfake.PagerResponder[armcontainerregistry.RegistriesClientListResponse]) - - // NewListByResourceGroupPager is the fake for method RegistriesClient.NewListByResourceGroupPager - // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupPager func(resourceGroupName string, options *armcontainerregistry.RegistriesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armcontainerregistry.RegistriesClientListByResourceGroupResponse]) - - // ListCredentials is the fake for method RegistriesClient.ListCredentials - // HTTP status codes to indicate success: http.StatusOK - ListCredentials func(ctx context.Context, resourceGroupName string, registryName string, options *armcontainerregistry.RegistriesClientListCredentialsOptions) (resp azfake.Responder[armcontainerregistry.RegistriesClientListCredentialsResponse], errResp azfake.ErrorResponder) - - // NewListPrivateLinkResourcesPager is the fake for method RegistriesClient.NewListPrivateLinkResourcesPager - // HTTP status codes to indicate success: http.StatusOK - NewListPrivateLinkResourcesPager func(resourceGroupName string, registryName string, options *armcontainerregistry.RegistriesClientListPrivateLinkResourcesOptions) (resp azfake.PagerResponder[armcontainerregistry.RegistriesClientListPrivateLinkResourcesResponse]) - - // ListUsages is the fake for method RegistriesClient.ListUsages - // HTTP status codes to indicate success: http.StatusOK - ListUsages func(ctx context.Context, resourceGroupName string, registryName string, options *armcontainerregistry.RegistriesClientListUsagesOptions) (resp azfake.Responder[armcontainerregistry.RegistriesClientListUsagesResponse], errResp azfake.ErrorResponder) - - // RegenerateCredential is the fake for method RegistriesClient.RegenerateCredential - // HTTP status codes to indicate success: http.StatusOK - RegenerateCredential func(ctx context.Context, resourceGroupName string, registryName string, regenerateCredentialParameters armcontainerregistry.RegenerateCredentialParameters, options *armcontainerregistry.RegistriesClientRegenerateCredentialOptions) (resp azfake.Responder[armcontainerregistry.RegistriesClientRegenerateCredentialResponse], errResp azfake.ErrorResponder) - - // BeginScheduleRun is the fake for method RegistriesClient.BeginScheduleRun - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginScheduleRun func(ctx context.Context, resourceGroupName string, registryName string, runRequest armcontainerregistry.RunRequestClassification, options *armcontainerregistry.RegistriesClientBeginScheduleRunOptions) (resp azfake.PollerResponder[armcontainerregistry.RegistriesClientScheduleRunResponse], errResp azfake.ErrorResponder) - - // BeginUpdate is the fake for method RegistriesClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginUpdate func(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters armcontainerregistry.RegistryUpdateParameters, options *armcontainerregistry.RegistriesClientBeginUpdateOptions) (resp azfake.PollerResponder[armcontainerregistry.RegistriesClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewRegistriesServerTransport creates a new instance of RegistriesServerTransport with the provided implementation. -// The returned RegistriesServerTransport instance is connected to an instance of armcontainerregistry.RegistriesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewRegistriesServerTransport(srv *RegistriesServer) *RegistriesServerTransport { - return &RegistriesServerTransport{ - srv: srv, - beginCreate: newTracker[azfake.PollerResponder[armcontainerregistry.RegistriesClientCreateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armcontainerregistry.RegistriesClientDeleteResponse]](), - beginGenerateCredentials: newTracker[azfake.PollerResponder[armcontainerregistry.RegistriesClientGenerateCredentialsResponse]](), - beginImportImage: newTracker[azfake.PollerResponder[armcontainerregistry.RegistriesClientImportImageResponse]](), - newListPager: newTracker[azfake.PagerResponder[armcontainerregistry.RegistriesClientListResponse]](), - newListByResourceGroupPager: newTracker[azfake.PagerResponder[armcontainerregistry.RegistriesClientListByResourceGroupResponse]](), - newListPrivateLinkResourcesPager: newTracker[azfake.PagerResponder[armcontainerregistry.RegistriesClientListPrivateLinkResourcesResponse]](), - beginScheduleRun: newTracker[azfake.PollerResponder[armcontainerregistry.RegistriesClientScheduleRunResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armcontainerregistry.RegistriesClientUpdateResponse]](), - } -} - -// RegistriesServerTransport connects instances of armcontainerregistry.RegistriesClient to instances of RegistriesServer. -// Don't use this type directly, use NewRegistriesServerTransport instead. -type RegistriesServerTransport struct { - srv *RegistriesServer - beginCreate *tracker[azfake.PollerResponder[armcontainerregistry.RegistriesClientCreateResponse]] - beginDelete *tracker[azfake.PollerResponder[armcontainerregistry.RegistriesClientDeleteResponse]] - beginGenerateCredentials *tracker[azfake.PollerResponder[armcontainerregistry.RegistriesClientGenerateCredentialsResponse]] - beginImportImage *tracker[azfake.PollerResponder[armcontainerregistry.RegistriesClientImportImageResponse]] - newListPager *tracker[azfake.PagerResponder[armcontainerregistry.RegistriesClientListResponse]] - newListByResourceGroupPager *tracker[azfake.PagerResponder[armcontainerregistry.RegistriesClientListByResourceGroupResponse]] - newListPrivateLinkResourcesPager *tracker[azfake.PagerResponder[armcontainerregistry.RegistriesClientListPrivateLinkResourcesResponse]] - beginScheduleRun *tracker[azfake.PollerResponder[armcontainerregistry.RegistriesClientScheduleRunResponse]] - beginUpdate *tracker[azfake.PollerResponder[armcontainerregistry.RegistriesClientUpdateResponse]] -} - -// Do implements the policy.Transporter interface for RegistriesServerTransport. -func (r *RegistriesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "RegistriesClient.CheckNameAvailability": - resp, err = r.dispatchCheckNameAvailability(req) - case "RegistriesClient.BeginCreate": - resp, err = r.dispatchBeginCreate(req) - case "RegistriesClient.BeginDelete": - resp, err = r.dispatchBeginDelete(req) - case "RegistriesClient.BeginGenerateCredentials": - resp, err = r.dispatchBeginGenerateCredentials(req) - case "RegistriesClient.Get": - resp, err = r.dispatchGet(req) - case "RegistriesClient.GetBuildSourceUploadURL": - resp, err = r.dispatchGetBuildSourceUploadURL(req) - case "RegistriesClient.GetPrivateLinkResource": - resp, err = r.dispatchGetPrivateLinkResource(req) - case "RegistriesClient.BeginImportImage": - resp, err = r.dispatchBeginImportImage(req) - case "RegistriesClient.NewListPager": - resp, err = r.dispatchNewListPager(req) - case "RegistriesClient.NewListByResourceGroupPager": - resp, err = r.dispatchNewListByResourceGroupPager(req) - case "RegistriesClient.ListCredentials": - resp, err = r.dispatchListCredentials(req) - case "RegistriesClient.NewListPrivateLinkResourcesPager": - resp, err = r.dispatchNewListPrivateLinkResourcesPager(req) - case "RegistriesClient.ListUsages": - resp, err = r.dispatchListUsages(req) - case "RegistriesClient.RegenerateCredential": - resp, err = r.dispatchRegenerateCredential(req) - case "RegistriesClient.BeginScheduleRun": - resp, err = r.dispatchBeginScheduleRun(req) - case "RegistriesClient.BeginUpdate": - resp, err = r.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (r *RegistriesServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { - if r.srv.CheckNameAvailability == nil { - return nil, &nonRetriableError{errors.New("fake for method CheckNameAvailability not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/checkNameAvailability` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.RegistryNameCheckRequest](req) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.CheckNameAvailability(req.Context(), body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RegistryNameStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (r *RegistriesServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { - if r.srv.BeginCreate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} - } - beginCreate := r.beginCreate.get(req) - if beginCreate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.Registry](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.BeginCreate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreate = &respr - r.beginCreate.add(req, beginCreate) - } - - resp, err := server.PollerResponderNext(beginCreate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - r.beginCreate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginCreate) { - r.beginCreate.remove(req) - } - - return resp, nil -} - -func (r *RegistriesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if r.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - beginDelete := r.beginDelete.get(req) - if beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.BeginDelete(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginDelete = &respr - r.beginDelete.add(req, beginDelete) - } - - resp, err := server.PollerResponderNext(beginDelete, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - r.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} - } - if !server.PollerResponderMore(beginDelete) { - r.beginDelete.remove(req) - } - - return resp, nil -} - -func (r *RegistriesServerTransport) dispatchBeginGenerateCredentials(req *http.Request) (*http.Response, error) { - if r.srv.BeginGenerateCredentials == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginGenerateCredentials not implemented")} - } - beginGenerateCredentials := r.beginGenerateCredentials.get(req) - if beginGenerateCredentials == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/generateCredentials` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.GenerateCredentialsParameters](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.BeginGenerateCredentials(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginGenerateCredentials = &respr - r.beginGenerateCredentials.add(req, beginGenerateCredentials) - } - - resp, err := server.PollerResponderNext(beginGenerateCredentials, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - r.beginGenerateCredentials.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginGenerateCredentials) { - r.beginGenerateCredentials.remove(req) - } - - return resp, nil -} - -func (r *RegistriesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if r.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.Get(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Registry, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (r *RegistriesServerTransport) dispatchGetBuildSourceUploadURL(req *http.Request) (*http.Response, error) { - if r.srv.GetBuildSourceUploadURL == nil { - return nil, &nonRetriableError{errors.New("fake for method GetBuildSourceUploadURL not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listBuildSourceUploadUrl` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.GetBuildSourceUploadURL(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SourceUploadDefinition, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (r *RegistriesServerTransport) dispatchGetPrivateLinkResource(req *http.Request) (*http.Response, error) { - if r.srv.GetPrivateLinkResource == nil { - return nil, &nonRetriableError{errors.New("fake for method GetPrivateLinkResource not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - groupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("groupName")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.GetPrivateLinkResource(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, groupNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateLinkResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (r *RegistriesServerTransport) dispatchBeginImportImage(req *http.Request) (*http.Response, error) { - if r.srv.BeginImportImage == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginImportImage not implemented")} - } - beginImportImage := r.beginImportImage.get(req) - if beginImportImage == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/importImage` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.ImportImageParameters](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.BeginImportImage(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginImportImage = &respr - r.beginImportImage.add(req, beginImportImage) - } - - resp, err := server.PollerResponderNext(beginImportImage, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - r.beginImportImage.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginImportImage) { - r.beginImportImage.remove(req) - } - - return resp, nil -} - -func (r *RegistriesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if r.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := r.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := r.srv.NewListPager(nil) - newListPager = &resp - r.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcontainerregistry.RegistriesClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - r.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - r.newListPager.remove(req) - } - return resp, nil -} - -func (r *RegistriesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { - if r.srv.NewListByResourceGroupPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} - } - newListByResourceGroupPager := r.newListByResourceGroupPager.get(req) - if newListByResourceGroupPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resp := r.srv.NewListByResourceGroupPager(resourceGroupNameUnescaped, nil) - newListByResourceGroupPager = &resp - r.newListByResourceGroupPager.add(req, newListByResourceGroupPager) - server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armcontainerregistry.RegistriesClientListByResourceGroupResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - r.newListByResourceGroupPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByResourceGroupPager) { - r.newListByResourceGroupPager.remove(req) - } - return resp, nil -} - -func (r *RegistriesServerTransport) dispatchListCredentials(req *http.Request) (*http.Response, error) { - if r.srv.ListCredentials == nil { - return nil, &nonRetriableError{errors.New("fake for method ListCredentials not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listCredentials` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.ListCredentials(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RegistryListCredentialsResult, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (r *RegistriesServerTransport) dispatchNewListPrivateLinkResourcesPager(req *http.Request) (*http.Response, error) { - if r.srv.NewListPrivateLinkResourcesPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPrivateLinkResourcesPager not implemented")} - } - newListPrivateLinkResourcesPager := r.newListPrivateLinkResourcesPager.get(req) - if newListPrivateLinkResourcesPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - resp := r.srv.NewListPrivateLinkResourcesPager(resourceGroupNameUnescaped, registryNameUnescaped, nil) - newListPrivateLinkResourcesPager = &resp - r.newListPrivateLinkResourcesPager.add(req, newListPrivateLinkResourcesPager) - server.PagerResponderInjectNextLinks(newListPrivateLinkResourcesPager, req, func(page *armcontainerregistry.RegistriesClientListPrivateLinkResourcesResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPrivateLinkResourcesPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - r.newListPrivateLinkResourcesPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPrivateLinkResourcesPager) { - r.newListPrivateLinkResourcesPager.remove(req) - } - return resp, nil -} - -func (r *RegistriesServerTransport) dispatchListUsages(req *http.Request) (*http.Response, error) { - if r.srv.ListUsages == nil { - return nil, &nonRetriableError{errors.New("fake for method ListUsages not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listUsages` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.ListUsages(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RegistryUsageListResult, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (r *RegistriesServerTransport) dispatchRegenerateCredential(req *http.Request) (*http.Response, error) { - if r.srv.RegenerateCredential == nil { - return nil, &nonRetriableError{errors.New("fake for method RegenerateCredential not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/regenerateCredential` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.RegenerateCredentialParameters](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.RegenerateCredential(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RegistryListCredentialsResult, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (r *RegistriesServerTransport) dispatchBeginScheduleRun(req *http.Request) (*http.Response, error) { - if r.srv.BeginScheduleRun == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginScheduleRun not implemented")} - } - beginScheduleRun := r.beginScheduleRun.get(req) - if beginScheduleRun == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/scheduleRun` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - raw, err := readRequestBody(req) - if err != nil { - return nil, err - } - body, err := unmarshalRunRequestClassification(raw) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.BeginScheduleRun(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginScheduleRun = &respr - r.beginScheduleRun.add(req, beginScheduleRun) - } - - resp, err := server.PollerResponderNext(beginScheduleRun, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - r.beginScheduleRun.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginScheduleRun) { - r.beginScheduleRun.remove(req) - } - - return resp, nil -} - -func (r *RegistriesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { - if r.srv.BeginUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} - } - beginUpdate := r.beginUpdate.get(req) - if beginUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.RegistryUpdateParameters](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.BeginUpdate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginUpdate = &respr - r.beginUpdate.add(req, beginUpdate) - } - - resp, err := server.PollerResponderNext(beginUpdate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - r.beginUpdate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginUpdate) { - r.beginUpdate.remove(req) - } - - return resp, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/replications_server.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/replications_server.go deleted file mode 100644 index d06fa827d8e5..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/replications_server.go +++ /dev/null @@ -1,332 +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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" - "net/http" - "net/url" - "regexp" -) - -// ReplicationsServer is a fake server for instances of the armcontainerregistry.ReplicationsClient type. -type ReplicationsServer struct { - // BeginCreate is the fake for method ReplicationsClient.BeginCreate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replication armcontainerregistry.Replication, options *armcontainerregistry.ReplicationsClientBeginCreateOptions) (resp azfake.PollerResponder[armcontainerregistry.ReplicationsClientCreateResponse], errResp azfake.ErrorResponder) - - // BeginDelete is the fake for method ReplicationsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, registryName string, replicationName string, options *armcontainerregistry.ReplicationsClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerregistry.ReplicationsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method ReplicationsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, registryName string, replicationName string, options *armcontainerregistry.ReplicationsClientGetOptions) (resp azfake.Responder[armcontainerregistry.ReplicationsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method ReplicationsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, registryName string, options *armcontainerregistry.ReplicationsClientListOptions) (resp azfake.PagerResponder[armcontainerregistry.ReplicationsClientListResponse]) - - // BeginUpdate is the fake for method ReplicationsClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginUpdate func(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters armcontainerregistry.ReplicationUpdateParameters, options *armcontainerregistry.ReplicationsClientBeginUpdateOptions) (resp azfake.PollerResponder[armcontainerregistry.ReplicationsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewReplicationsServerTransport creates a new instance of ReplicationsServerTransport with the provided implementation. -// The returned ReplicationsServerTransport instance is connected to an instance of armcontainerregistry.ReplicationsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewReplicationsServerTransport(srv *ReplicationsServer) *ReplicationsServerTransport { - return &ReplicationsServerTransport{ - srv: srv, - beginCreate: newTracker[azfake.PollerResponder[armcontainerregistry.ReplicationsClientCreateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armcontainerregistry.ReplicationsClientDeleteResponse]](), - newListPager: newTracker[azfake.PagerResponder[armcontainerregistry.ReplicationsClientListResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armcontainerregistry.ReplicationsClientUpdateResponse]](), - } -} - -// ReplicationsServerTransport connects instances of armcontainerregistry.ReplicationsClient to instances of ReplicationsServer. -// Don't use this type directly, use NewReplicationsServerTransport instead. -type ReplicationsServerTransport struct { - srv *ReplicationsServer - beginCreate *tracker[azfake.PollerResponder[armcontainerregistry.ReplicationsClientCreateResponse]] - beginDelete *tracker[azfake.PollerResponder[armcontainerregistry.ReplicationsClientDeleteResponse]] - newListPager *tracker[azfake.PagerResponder[armcontainerregistry.ReplicationsClientListResponse]] - beginUpdate *tracker[azfake.PollerResponder[armcontainerregistry.ReplicationsClientUpdateResponse]] -} - -// Do implements the policy.Transporter interface for ReplicationsServerTransport. -func (r *ReplicationsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ReplicationsClient.BeginCreate": - resp, err = r.dispatchBeginCreate(req) - case "ReplicationsClient.BeginDelete": - resp, err = r.dispatchBeginDelete(req) - case "ReplicationsClient.Get": - resp, err = r.dispatchGet(req) - case "ReplicationsClient.NewListPager": - resp, err = r.dispatchNewListPager(req) - case "ReplicationsClient.BeginUpdate": - resp, err = r.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (r *ReplicationsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { - if r.srv.BeginCreate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} - } - beginCreate := r.beginCreate.get(req) - if beginCreate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replications/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.Replication](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - replicationNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("replicationName")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.BeginCreate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, replicationNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreate = &respr - r.beginCreate.add(req, beginCreate) - } - - resp, err := server.PollerResponderNext(beginCreate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - r.beginCreate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginCreate) { - r.beginCreate.remove(req) - } - - return resp, nil -} - -func (r *ReplicationsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if r.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - beginDelete := r.beginDelete.get(req) - if beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replications/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - replicationNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("replicationName")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.BeginDelete(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, replicationNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginDelete = &respr - r.beginDelete.add(req, beginDelete) - } - - resp, err := server.PollerResponderNext(beginDelete, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - r.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} - } - if !server.PollerResponderMore(beginDelete) { - r.beginDelete.remove(req) - } - - return resp, nil -} - -func (r *ReplicationsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if r.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replications/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - replicationNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("replicationName")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.Get(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, replicationNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Replication, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (r *ReplicationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if r.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := r.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replications` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - resp := r.srv.NewListPager(resourceGroupNameUnescaped, registryNameUnescaped, nil) - newListPager = &resp - r.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcontainerregistry.ReplicationsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - r.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - r.newListPager.remove(req) - } - return resp, nil -} - -func (r *ReplicationsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { - if r.srv.BeginUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} - } - beginUpdate := r.beginUpdate.get(req) - if beginUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replications/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.ReplicationUpdateParameters](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - replicationNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("replicationName")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.BeginUpdate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, replicationNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginUpdate = &respr - r.beginUpdate.add(req, beginUpdate) - } - - resp, err := server.PollerResponderNext(beginUpdate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - r.beginUpdate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginUpdate) { - r.beginUpdate.remove(req) - } - - return resp, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/runs_server.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/runs_server.go deleted file mode 100644 index 0465063bd146..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/runs_server.go +++ /dev/null @@ -1,343 +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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" - "net/http" - "net/url" - "regexp" - "strconv" -) - -// RunsServer is a fake server for instances of the armcontainerregistry.RunsClient type. -type RunsServer struct { - // BeginCancel is the fake for method RunsClient.BeginCancel - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginCancel func(ctx context.Context, resourceGroupName string, registryName string, runID string, options *armcontainerregistry.RunsClientBeginCancelOptions) (resp azfake.PollerResponder[armcontainerregistry.RunsClientCancelResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method RunsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, registryName string, runID string, options *armcontainerregistry.RunsClientGetOptions) (resp azfake.Responder[armcontainerregistry.RunsClientGetResponse], errResp azfake.ErrorResponder) - - // GetLogSasURL is the fake for method RunsClient.GetLogSasURL - // HTTP status codes to indicate success: http.StatusOK - GetLogSasURL func(ctx context.Context, resourceGroupName string, registryName string, runID string, options *armcontainerregistry.RunsClientGetLogSasURLOptions) (resp azfake.Responder[armcontainerregistry.RunsClientGetLogSasURLResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method RunsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, registryName string, options *armcontainerregistry.RunsClientListOptions) (resp azfake.PagerResponder[armcontainerregistry.RunsClientListResponse]) - - // BeginUpdate is the fake for method RunsClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginUpdate func(ctx context.Context, resourceGroupName string, registryName string, runID string, runUpdateParameters armcontainerregistry.RunUpdateParameters, options *armcontainerregistry.RunsClientBeginUpdateOptions) (resp azfake.PollerResponder[armcontainerregistry.RunsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewRunsServerTransport creates a new instance of RunsServerTransport with the provided implementation. -// The returned RunsServerTransport instance is connected to an instance of armcontainerregistry.RunsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewRunsServerTransport(srv *RunsServer) *RunsServerTransport { - return &RunsServerTransport{ - srv: srv, - beginCancel: newTracker[azfake.PollerResponder[armcontainerregistry.RunsClientCancelResponse]](), - newListPager: newTracker[azfake.PagerResponder[armcontainerregistry.RunsClientListResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armcontainerregistry.RunsClientUpdateResponse]](), - } -} - -// RunsServerTransport connects instances of armcontainerregistry.RunsClient to instances of RunsServer. -// Don't use this type directly, use NewRunsServerTransport instead. -type RunsServerTransport struct { - srv *RunsServer - beginCancel *tracker[azfake.PollerResponder[armcontainerregistry.RunsClientCancelResponse]] - newListPager *tracker[azfake.PagerResponder[armcontainerregistry.RunsClientListResponse]] - beginUpdate *tracker[azfake.PollerResponder[armcontainerregistry.RunsClientUpdateResponse]] -} - -// Do implements the policy.Transporter interface for RunsServerTransport. -func (r *RunsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "RunsClient.BeginCancel": - resp, err = r.dispatchBeginCancel(req) - case "RunsClient.Get": - resp, err = r.dispatchGet(req) - case "RunsClient.GetLogSasURL": - resp, err = r.dispatchGetLogSasURL(req) - case "RunsClient.NewListPager": - resp, err = r.dispatchNewListPager(req) - case "RunsClient.BeginUpdate": - resp, err = r.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (r *RunsServerTransport) dispatchBeginCancel(req *http.Request) (*http.Response, error) { - if r.srv.BeginCancel == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCancel not implemented")} - } - beginCancel := r.beginCancel.get(req) - if beginCancel == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cancel` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - runIDUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("runId")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.BeginCancel(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, runIDUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCancel = &respr - r.beginCancel.add(req, beginCancel) - } - - resp, err := server.PollerResponderNext(beginCancel, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - r.beginCancel.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginCancel) { - r.beginCancel.remove(req) - } - - return resp, nil -} - -func (r *RunsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if r.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - runIDUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("runId")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.Get(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, runIDUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Run, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (r *RunsServerTransport) dispatchGetLogSasURL(req *http.Request) (*http.Response, error) { - if r.srv.GetLogSasURL == nil { - return nil, &nonRetriableError{errors.New("fake for method GetLogSasURL not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listLogSasUrl` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - runIDUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("runId")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.GetLogSasURL(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, runIDUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RunGetLogResult, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (r *RunsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if r.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := r.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runs` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - topUnescaped, err := url.QueryUnescape(qp.Get("$top")) - if err != nil { - return nil, err - } - topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { - p, parseErr := strconv.ParseInt(v, 10, 32) - if parseErr != nil { - return 0, parseErr - } - return int32(p), nil - }) - if err != nil { - return nil, err - } - var options *armcontainerregistry.RunsClientListOptions - if filterParam != nil || topParam != nil { - options = &armcontainerregistry.RunsClientListOptions{ - Filter: filterParam, - Top: topParam, - } - } - resp := r.srv.NewListPager(resourceGroupNameUnescaped, registryNameUnescaped, options) - newListPager = &resp - r.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcontainerregistry.RunsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - r.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - r.newListPager.remove(req) - } - return resp, nil -} - -func (r *RunsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { - if r.srv.BeginUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} - } - beginUpdate := r.beginUpdate.get(req) - if beginUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.RunUpdateParameters](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - runIDUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("runId")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.BeginUpdate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, runIDUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginUpdate = &respr - r.beginUpdate.add(req, beginUpdate) - } - - resp, err := server.PollerResponderNext(beginUpdate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - r.beginUpdate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginUpdate) { - r.beginUpdate.remove(req) - } - - return resp, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/scopemaps_server.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/scopemaps_server.go deleted file mode 100644 index a93424f3581d..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/scopemaps_server.go +++ /dev/null @@ -1,332 +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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" - "net/http" - "net/url" - "regexp" -) - -// ScopeMapsServer is a fake server for instances of the armcontainerregistry.ScopeMapsClient type. -type ScopeMapsServer struct { - // BeginCreate is the fake for method ScopeMapsClient.BeginCreate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapCreateParameters armcontainerregistry.ScopeMap, options *armcontainerregistry.ScopeMapsClientBeginCreateOptions) (resp azfake.PollerResponder[armcontainerregistry.ScopeMapsClientCreateResponse], errResp azfake.ErrorResponder) - - // BeginDelete is the fake for method ScopeMapsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, options *armcontainerregistry.ScopeMapsClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerregistry.ScopeMapsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method ScopeMapsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, options *armcontainerregistry.ScopeMapsClientGetOptions) (resp azfake.Responder[armcontainerregistry.ScopeMapsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method ScopeMapsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, registryName string, options *armcontainerregistry.ScopeMapsClientListOptions) (resp azfake.PagerResponder[armcontainerregistry.ScopeMapsClientListResponse]) - - // BeginUpdate is the fake for method ScopeMapsClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginUpdate func(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapUpdateParameters armcontainerregistry.ScopeMapUpdateParameters, options *armcontainerregistry.ScopeMapsClientBeginUpdateOptions) (resp azfake.PollerResponder[armcontainerregistry.ScopeMapsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewScopeMapsServerTransport creates a new instance of ScopeMapsServerTransport with the provided implementation. -// The returned ScopeMapsServerTransport instance is connected to an instance of armcontainerregistry.ScopeMapsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewScopeMapsServerTransport(srv *ScopeMapsServer) *ScopeMapsServerTransport { - return &ScopeMapsServerTransport{ - srv: srv, - beginCreate: newTracker[azfake.PollerResponder[armcontainerregistry.ScopeMapsClientCreateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armcontainerregistry.ScopeMapsClientDeleteResponse]](), - newListPager: newTracker[azfake.PagerResponder[armcontainerregistry.ScopeMapsClientListResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armcontainerregistry.ScopeMapsClientUpdateResponse]](), - } -} - -// ScopeMapsServerTransport connects instances of armcontainerregistry.ScopeMapsClient to instances of ScopeMapsServer. -// Don't use this type directly, use NewScopeMapsServerTransport instead. -type ScopeMapsServerTransport struct { - srv *ScopeMapsServer - beginCreate *tracker[azfake.PollerResponder[armcontainerregistry.ScopeMapsClientCreateResponse]] - beginDelete *tracker[azfake.PollerResponder[armcontainerregistry.ScopeMapsClientDeleteResponse]] - newListPager *tracker[azfake.PagerResponder[armcontainerregistry.ScopeMapsClientListResponse]] - beginUpdate *tracker[azfake.PollerResponder[armcontainerregistry.ScopeMapsClientUpdateResponse]] -} - -// Do implements the policy.Transporter interface for ScopeMapsServerTransport. -func (s *ScopeMapsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ScopeMapsClient.BeginCreate": - resp, err = s.dispatchBeginCreate(req) - case "ScopeMapsClient.BeginDelete": - resp, err = s.dispatchBeginDelete(req) - case "ScopeMapsClient.Get": - resp, err = s.dispatchGet(req) - case "ScopeMapsClient.NewListPager": - resp, err = s.dispatchNewListPager(req) - case "ScopeMapsClient.BeginUpdate": - resp, err = s.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (s *ScopeMapsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { - if s.srv.BeginCreate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} - } - beginCreate := s.beginCreate.get(req) - if beginCreate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/scopeMaps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.ScopeMap](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - scopeMapNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("scopeMapName")]) - if err != nil { - return nil, err - } - respr, errRespr := s.srv.BeginCreate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, scopeMapNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreate = &respr - s.beginCreate.add(req, beginCreate) - } - - resp, err := server.PollerResponderNext(beginCreate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - s.beginCreate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginCreate) { - s.beginCreate.remove(req) - } - - return resp, nil -} - -func (s *ScopeMapsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if s.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - beginDelete := s.beginDelete.get(req) - if beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/scopeMaps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - scopeMapNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("scopeMapName")]) - if err != nil { - return nil, err - } - respr, errRespr := s.srv.BeginDelete(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, scopeMapNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginDelete = &respr - s.beginDelete.add(req, beginDelete) - } - - resp, err := server.PollerResponderNext(beginDelete, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - s.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} - } - if !server.PollerResponderMore(beginDelete) { - s.beginDelete.remove(req) - } - - return resp, nil -} - -func (s *ScopeMapsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if s.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/scopeMaps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - scopeMapNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("scopeMapName")]) - if err != nil { - return nil, err - } - respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, scopeMapNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ScopeMap, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (s *ScopeMapsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if s.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := s.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/scopeMaps` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - resp := s.srv.NewListPager(resourceGroupNameUnescaped, registryNameUnescaped, nil) - newListPager = &resp - s.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcontainerregistry.ScopeMapsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - s.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - s.newListPager.remove(req) - } - return resp, nil -} - -func (s *ScopeMapsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { - if s.srv.BeginUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} - } - beginUpdate := s.beginUpdate.get(req) - if beginUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/scopeMaps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.ScopeMapUpdateParameters](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - scopeMapNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("scopeMapName")]) - if err != nil { - return nil, err - } - respr, errRespr := s.srv.BeginUpdate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, scopeMapNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginUpdate = &respr - s.beginUpdate.add(req, beginUpdate) - } - - resp, err := server.PollerResponderNext(beginUpdate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - s.beginUpdate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginUpdate) { - s.beginUpdate.remove(req) - } - - return resp, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/taskruns_server.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/taskruns_server.go deleted file mode 100644 index 2dc38943ea83..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/taskruns_server.go +++ /dev/null @@ -1,375 +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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" - "net/http" - "net/url" - "regexp" -) - -// TaskRunsServer is a fake server for instances of the armcontainerregistry.TaskRunsClient type. -type TaskRunsServer struct { - // BeginCreate is the fake for method TaskRunsClient.BeginCreate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, taskRun armcontainerregistry.TaskRun, options *armcontainerregistry.TaskRunsClientBeginCreateOptions) (resp azfake.PollerResponder[armcontainerregistry.TaskRunsClientCreateResponse], errResp azfake.ErrorResponder) - - // BeginDelete is the fake for method TaskRunsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, options *armcontainerregistry.TaskRunsClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerregistry.TaskRunsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method TaskRunsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, options *armcontainerregistry.TaskRunsClientGetOptions) (resp azfake.Responder[armcontainerregistry.TaskRunsClientGetResponse], errResp azfake.ErrorResponder) - - // GetDetails is the fake for method TaskRunsClient.GetDetails - // HTTP status codes to indicate success: http.StatusOK - GetDetails func(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, options *armcontainerregistry.TaskRunsClientGetDetailsOptions) (resp azfake.Responder[armcontainerregistry.TaskRunsClientGetDetailsResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method TaskRunsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, registryName string, options *armcontainerregistry.TaskRunsClientListOptions) (resp azfake.PagerResponder[armcontainerregistry.TaskRunsClientListResponse]) - - // BeginUpdate is the fake for method TaskRunsClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginUpdate func(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, updateParameters armcontainerregistry.TaskRunUpdateParameters, options *armcontainerregistry.TaskRunsClientBeginUpdateOptions) (resp azfake.PollerResponder[armcontainerregistry.TaskRunsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewTaskRunsServerTransport creates a new instance of TaskRunsServerTransport with the provided implementation. -// The returned TaskRunsServerTransport instance is connected to an instance of armcontainerregistry.TaskRunsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewTaskRunsServerTransport(srv *TaskRunsServer) *TaskRunsServerTransport { - return &TaskRunsServerTransport{ - srv: srv, - beginCreate: newTracker[azfake.PollerResponder[armcontainerregistry.TaskRunsClientCreateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armcontainerregistry.TaskRunsClientDeleteResponse]](), - newListPager: newTracker[azfake.PagerResponder[armcontainerregistry.TaskRunsClientListResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armcontainerregistry.TaskRunsClientUpdateResponse]](), - } -} - -// TaskRunsServerTransport connects instances of armcontainerregistry.TaskRunsClient to instances of TaskRunsServer. -// Don't use this type directly, use NewTaskRunsServerTransport instead. -type TaskRunsServerTransport struct { - srv *TaskRunsServer - beginCreate *tracker[azfake.PollerResponder[armcontainerregistry.TaskRunsClientCreateResponse]] - beginDelete *tracker[azfake.PollerResponder[armcontainerregistry.TaskRunsClientDeleteResponse]] - newListPager *tracker[azfake.PagerResponder[armcontainerregistry.TaskRunsClientListResponse]] - beginUpdate *tracker[azfake.PollerResponder[armcontainerregistry.TaskRunsClientUpdateResponse]] -} - -// Do implements the policy.Transporter interface for TaskRunsServerTransport. -func (t *TaskRunsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "TaskRunsClient.BeginCreate": - resp, err = t.dispatchBeginCreate(req) - case "TaskRunsClient.BeginDelete": - resp, err = t.dispatchBeginDelete(req) - case "TaskRunsClient.Get": - resp, err = t.dispatchGet(req) - case "TaskRunsClient.GetDetails": - resp, err = t.dispatchGetDetails(req) - case "TaskRunsClient.NewListPager": - resp, err = t.dispatchNewListPager(req) - case "TaskRunsClient.BeginUpdate": - resp, err = t.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (t *TaskRunsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { - if t.srv.BeginCreate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} - } - beginCreate := t.beginCreate.get(req) - if beginCreate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/taskRuns/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.TaskRun](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - taskRunNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("taskRunName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.BeginCreate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, taskRunNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreate = &respr - t.beginCreate.add(req, beginCreate) - } - - resp, err := server.PollerResponderNext(beginCreate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - t.beginCreate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginCreate) { - t.beginCreate.remove(req) - } - - return resp, nil -} - -func (t *TaskRunsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if t.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - beginDelete := t.beginDelete.get(req) - if beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/taskRuns/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - taskRunNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("taskRunName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.BeginDelete(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, taskRunNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginDelete = &respr - t.beginDelete.add(req, beginDelete) - } - - resp, err := server.PollerResponderNext(beginDelete, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - t.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} - } - if !server.PollerResponderMore(beginDelete) { - t.beginDelete.remove(req) - } - - return resp, nil -} - -func (t *TaskRunsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if t.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/taskRuns/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - taskRunNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("taskRunName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.Get(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, taskRunNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).TaskRun, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (t *TaskRunsServerTransport) dispatchGetDetails(req *http.Request) (*http.Response, error) { - if t.srv.GetDetails == nil { - return nil, &nonRetriableError{errors.New("fake for method GetDetails not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/taskRuns/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listDetails` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - taskRunNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("taskRunName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.GetDetails(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, taskRunNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).TaskRun, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (t *TaskRunsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if t.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := t.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/taskRuns` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - resp := t.srv.NewListPager(resourceGroupNameUnescaped, registryNameUnescaped, nil) - newListPager = &resp - t.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcontainerregistry.TaskRunsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - t.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - t.newListPager.remove(req) - } - return resp, nil -} - -func (t *TaskRunsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { - if t.srv.BeginUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} - } - beginUpdate := t.beginUpdate.get(req) - if beginUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/taskRuns/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.TaskRunUpdateParameters](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - taskRunNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("taskRunName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.BeginUpdate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, taskRunNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginUpdate = &respr - t.beginUpdate.add(req, beginUpdate) - } - - resp, err := server.PollerResponderNext(beginUpdate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - t.beginUpdate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginUpdate) { - t.beginUpdate.remove(req) - } - - return resp, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/tasks_server.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/tasks_server.go deleted file mode 100644 index a9c1c42e0409..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/tasks_server.go +++ /dev/null @@ -1,375 +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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" - "net/http" - "net/url" - "regexp" -) - -// TasksServer is a fake server for instances of the armcontainerregistry.TasksClient type. -type TasksServer struct { - // BeginCreate is the fake for method TasksClient.BeginCreate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskCreateParameters armcontainerregistry.Task, options *armcontainerregistry.TasksClientBeginCreateOptions) (resp azfake.PollerResponder[armcontainerregistry.TasksClientCreateResponse], errResp azfake.ErrorResponder) - - // BeginDelete is the fake for method TasksClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, registryName string, taskName string, options *armcontainerregistry.TasksClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerregistry.TasksClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method TasksClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, registryName string, taskName string, options *armcontainerregistry.TasksClientGetOptions) (resp azfake.Responder[armcontainerregistry.TasksClientGetResponse], errResp azfake.ErrorResponder) - - // GetDetails is the fake for method TasksClient.GetDetails - // HTTP status codes to indicate success: http.StatusOK - GetDetails func(ctx context.Context, resourceGroupName string, registryName string, taskName string, options *armcontainerregistry.TasksClientGetDetailsOptions) (resp azfake.Responder[armcontainerregistry.TasksClientGetDetailsResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method TasksClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, registryName string, options *armcontainerregistry.TasksClientListOptions) (resp azfake.PagerResponder[armcontainerregistry.TasksClientListResponse]) - - // BeginUpdate is the fake for method TasksClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginUpdate func(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskUpdateParameters armcontainerregistry.TaskUpdateParameters, options *armcontainerregistry.TasksClientBeginUpdateOptions) (resp azfake.PollerResponder[armcontainerregistry.TasksClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewTasksServerTransport creates a new instance of TasksServerTransport with the provided implementation. -// The returned TasksServerTransport instance is connected to an instance of armcontainerregistry.TasksClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewTasksServerTransport(srv *TasksServer) *TasksServerTransport { - return &TasksServerTransport{ - srv: srv, - beginCreate: newTracker[azfake.PollerResponder[armcontainerregistry.TasksClientCreateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armcontainerregistry.TasksClientDeleteResponse]](), - newListPager: newTracker[azfake.PagerResponder[armcontainerregistry.TasksClientListResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armcontainerregistry.TasksClientUpdateResponse]](), - } -} - -// TasksServerTransport connects instances of armcontainerregistry.TasksClient to instances of TasksServer. -// Don't use this type directly, use NewTasksServerTransport instead. -type TasksServerTransport struct { - srv *TasksServer - beginCreate *tracker[azfake.PollerResponder[armcontainerregistry.TasksClientCreateResponse]] - beginDelete *tracker[azfake.PollerResponder[armcontainerregistry.TasksClientDeleteResponse]] - newListPager *tracker[azfake.PagerResponder[armcontainerregistry.TasksClientListResponse]] - beginUpdate *tracker[azfake.PollerResponder[armcontainerregistry.TasksClientUpdateResponse]] -} - -// Do implements the policy.Transporter interface for TasksServerTransport. -func (t *TasksServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "TasksClient.BeginCreate": - resp, err = t.dispatchBeginCreate(req) - case "TasksClient.BeginDelete": - resp, err = t.dispatchBeginDelete(req) - case "TasksClient.Get": - resp, err = t.dispatchGet(req) - case "TasksClient.GetDetails": - resp, err = t.dispatchGetDetails(req) - case "TasksClient.NewListPager": - resp, err = t.dispatchNewListPager(req) - case "TasksClient.BeginUpdate": - resp, err = t.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (t *TasksServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { - if t.srv.BeginCreate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} - } - beginCreate := t.beginCreate.get(req) - if beginCreate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tasks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.Task](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - taskNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("taskName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.BeginCreate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, taskNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreate = &respr - t.beginCreate.add(req, beginCreate) - } - - resp, err := server.PollerResponderNext(beginCreate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - t.beginCreate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginCreate) { - t.beginCreate.remove(req) - } - - return resp, nil -} - -func (t *TasksServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if t.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - beginDelete := t.beginDelete.get(req) - if beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tasks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - taskNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("taskName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.BeginDelete(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, taskNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginDelete = &respr - t.beginDelete.add(req, beginDelete) - } - - resp, err := server.PollerResponderNext(beginDelete, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - t.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} - } - if !server.PollerResponderMore(beginDelete) { - t.beginDelete.remove(req) - } - - return resp, nil -} - -func (t *TasksServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if t.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tasks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - taskNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("taskName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.Get(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, taskNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Task, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (t *TasksServerTransport) dispatchGetDetails(req *http.Request) (*http.Response, error) { - if t.srv.GetDetails == nil { - return nil, &nonRetriableError{errors.New("fake for method GetDetails not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tasks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listDetails` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - taskNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("taskName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.GetDetails(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, taskNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Task, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (t *TasksServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if t.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := t.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tasks` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - resp := t.srv.NewListPager(resourceGroupNameUnescaped, registryNameUnescaped, nil) - newListPager = &resp - t.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcontainerregistry.TasksClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - t.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - t.newListPager.remove(req) - } - return resp, nil -} - -func (t *TasksServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { - if t.srv.BeginUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} - } - beginUpdate := t.beginUpdate.get(req) - if beginUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tasks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.TaskUpdateParameters](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - taskNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("taskName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.BeginUpdate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, taskNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginUpdate = &respr - t.beginUpdate.add(req, beginUpdate) - } - - resp, err := server.PollerResponderNext(beginUpdate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - t.beginUpdate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginUpdate) { - t.beginUpdate.remove(req) - } - - return resp, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/time_rfc3339.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/time_rfc3339.go deleted file mode 100644 index 45fe10cbc6df..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/time_rfc3339.go +++ /dev/null @@ -1,86 +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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "regexp" - "strings" - "time" -) - -const ( - utcLayoutJSON = `"2006-01-02T15:04:05.999999999"` - utcLayout = "2006-01-02T15:04:05.999999999" - rfc3339JSON = `"` + time.RFC3339Nano + `"` -) - -// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) - -type timeRFC3339 time.Time - -func (t timeRFC3339) MarshalJSON() (json []byte, err error) { - tt := time.Time(t) - return tt.MarshalJSON() -} - -func (t timeRFC3339) MarshalText() (text []byte, err error) { - tt := time.Time(t) - return tt.MarshalText() -} - -func (t *timeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcLayoutJSON - if tzOffsetRegex.Match(data) { - layout = rfc3339JSON - } - return t.Parse(layout, string(data)) -} - -func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { - layout := utcLayout - if tzOffsetRegex.Match(data) { - layout = time.RFC3339Nano - } - return t.Parse(layout, string(data)) -} - -func (t *timeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = timeRFC3339(p) - return err -} - -func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { - if t == nil { - return - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*timeRFC3339)(t) -} - -func unpopulateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { - return nil - } - var aux timeRFC3339 - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/tokens_server.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/tokens_server.go deleted file mode 100644 index 93f978a410f2..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/tokens_server.go +++ /dev/null @@ -1,332 +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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" - "net/http" - "net/url" - "regexp" -) - -// TokensServer is a fake server for instances of the armcontainerregistry.TokensClient type. -type TokensServer struct { - // BeginCreate is the fake for method TokensClient.BeginCreate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenCreateParameters armcontainerregistry.Token, options *armcontainerregistry.TokensClientBeginCreateOptions) (resp azfake.PollerResponder[armcontainerregistry.TokensClientCreateResponse], errResp azfake.ErrorResponder) - - // BeginDelete is the fake for method TokensClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, registryName string, tokenName string, options *armcontainerregistry.TokensClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerregistry.TokensClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method TokensClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, registryName string, tokenName string, options *armcontainerregistry.TokensClientGetOptions) (resp azfake.Responder[armcontainerregistry.TokensClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method TokensClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, registryName string, options *armcontainerregistry.TokensClientListOptions) (resp azfake.PagerResponder[armcontainerregistry.TokensClientListResponse]) - - // BeginUpdate is the fake for method TokensClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginUpdate func(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenUpdateParameters armcontainerregistry.TokenUpdateParameters, options *armcontainerregistry.TokensClientBeginUpdateOptions) (resp azfake.PollerResponder[armcontainerregistry.TokensClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewTokensServerTransport creates a new instance of TokensServerTransport with the provided implementation. -// The returned TokensServerTransport instance is connected to an instance of armcontainerregistry.TokensClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewTokensServerTransport(srv *TokensServer) *TokensServerTransport { - return &TokensServerTransport{ - srv: srv, - beginCreate: newTracker[azfake.PollerResponder[armcontainerregistry.TokensClientCreateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armcontainerregistry.TokensClientDeleteResponse]](), - newListPager: newTracker[azfake.PagerResponder[armcontainerregistry.TokensClientListResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armcontainerregistry.TokensClientUpdateResponse]](), - } -} - -// TokensServerTransport connects instances of armcontainerregistry.TokensClient to instances of TokensServer. -// Don't use this type directly, use NewTokensServerTransport instead. -type TokensServerTransport struct { - srv *TokensServer - beginCreate *tracker[azfake.PollerResponder[armcontainerregistry.TokensClientCreateResponse]] - beginDelete *tracker[azfake.PollerResponder[armcontainerregistry.TokensClientDeleteResponse]] - newListPager *tracker[azfake.PagerResponder[armcontainerregistry.TokensClientListResponse]] - beginUpdate *tracker[azfake.PollerResponder[armcontainerregistry.TokensClientUpdateResponse]] -} - -// Do implements the policy.Transporter interface for TokensServerTransport. -func (t *TokensServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "TokensClient.BeginCreate": - resp, err = t.dispatchBeginCreate(req) - case "TokensClient.BeginDelete": - resp, err = t.dispatchBeginDelete(req) - case "TokensClient.Get": - resp, err = t.dispatchGet(req) - case "TokensClient.NewListPager": - resp, err = t.dispatchNewListPager(req) - case "TokensClient.BeginUpdate": - resp, err = t.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (t *TokensServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { - if t.srv.BeginCreate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} - } - beginCreate := t.beginCreate.get(req) - if beginCreate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tokens/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.Token](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - tokenNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("tokenName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.BeginCreate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, tokenNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreate = &respr - t.beginCreate.add(req, beginCreate) - } - - resp, err := server.PollerResponderNext(beginCreate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - t.beginCreate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginCreate) { - t.beginCreate.remove(req) - } - - return resp, nil -} - -func (t *TokensServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if t.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - beginDelete := t.beginDelete.get(req) - if beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tokens/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - tokenNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("tokenName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.BeginDelete(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, tokenNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginDelete = &respr - t.beginDelete.add(req, beginDelete) - } - - resp, err := server.PollerResponderNext(beginDelete, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - t.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} - } - if !server.PollerResponderMore(beginDelete) { - t.beginDelete.remove(req) - } - - return resp, nil -} - -func (t *TokensServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if t.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tokens/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - tokenNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("tokenName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.Get(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, tokenNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Token, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (t *TokensServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if t.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := t.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tokens` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - resp := t.srv.NewListPager(resourceGroupNameUnescaped, registryNameUnescaped, nil) - newListPager = &resp - t.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcontainerregistry.TokensClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - t.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - t.newListPager.remove(req) - } - return resp, nil -} - -func (t *TokensServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { - if t.srv.BeginUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} - } - beginUpdate := t.beginUpdate.get(req) - if beginUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tokens/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.TokenUpdateParameters](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - tokenNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("tokenName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.BeginUpdate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, tokenNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginUpdate = &respr - t.beginUpdate.add(req, beginUpdate) - } - - resp, err := server.PollerResponderNext(beginUpdate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - t.beginUpdate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginUpdate) { - t.beginUpdate.remove(req) - } - - return resp, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/webhooks_server.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/webhooks_server.go deleted file mode 100644 index 491798d96cf3..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/webhooks_server.go +++ /dev/null @@ -1,471 +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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" - "net/http" - "net/url" - "regexp" -) - -// WebhooksServer is a fake server for instances of the armcontainerregistry.WebhooksClient type. -type WebhooksServer struct { - // BeginCreate is the fake for method WebhooksClient.BeginCreate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookCreateParameters armcontainerregistry.WebhookCreateParameters, options *armcontainerregistry.WebhooksClientBeginCreateOptions) (resp azfake.PollerResponder[armcontainerregistry.WebhooksClientCreateResponse], errResp azfake.ErrorResponder) - - // BeginDelete is the fake for method WebhooksClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, registryName string, webhookName string, options *armcontainerregistry.WebhooksClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerregistry.WebhooksClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method WebhooksClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, registryName string, webhookName string, options *armcontainerregistry.WebhooksClientGetOptions) (resp azfake.Responder[armcontainerregistry.WebhooksClientGetResponse], errResp azfake.ErrorResponder) - - // GetCallbackConfig is the fake for method WebhooksClient.GetCallbackConfig - // HTTP status codes to indicate success: http.StatusOK - GetCallbackConfig func(ctx context.Context, resourceGroupName string, registryName string, webhookName string, options *armcontainerregistry.WebhooksClientGetCallbackConfigOptions) (resp azfake.Responder[armcontainerregistry.WebhooksClientGetCallbackConfigResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method WebhooksClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, registryName string, options *armcontainerregistry.WebhooksClientListOptions) (resp azfake.PagerResponder[armcontainerregistry.WebhooksClientListResponse]) - - // NewListEventsPager is the fake for method WebhooksClient.NewListEventsPager - // HTTP status codes to indicate success: http.StatusOK - NewListEventsPager func(resourceGroupName string, registryName string, webhookName string, options *armcontainerregistry.WebhooksClientListEventsOptions) (resp azfake.PagerResponder[armcontainerregistry.WebhooksClientListEventsResponse]) - - // Ping is the fake for method WebhooksClient.Ping - // HTTP status codes to indicate success: http.StatusOK - Ping func(ctx context.Context, resourceGroupName string, registryName string, webhookName string, options *armcontainerregistry.WebhooksClientPingOptions) (resp azfake.Responder[armcontainerregistry.WebhooksClientPingResponse], errResp azfake.ErrorResponder) - - // BeginUpdate is the fake for method WebhooksClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginUpdate func(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookUpdateParameters armcontainerregistry.WebhookUpdateParameters, options *armcontainerregistry.WebhooksClientBeginUpdateOptions) (resp azfake.PollerResponder[armcontainerregistry.WebhooksClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewWebhooksServerTransport creates a new instance of WebhooksServerTransport with the provided implementation. -// The returned WebhooksServerTransport instance is connected to an instance of armcontainerregistry.WebhooksClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewWebhooksServerTransport(srv *WebhooksServer) *WebhooksServerTransport { - return &WebhooksServerTransport{ - srv: srv, - beginCreate: newTracker[azfake.PollerResponder[armcontainerregistry.WebhooksClientCreateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armcontainerregistry.WebhooksClientDeleteResponse]](), - newListPager: newTracker[azfake.PagerResponder[armcontainerregistry.WebhooksClientListResponse]](), - newListEventsPager: newTracker[azfake.PagerResponder[armcontainerregistry.WebhooksClientListEventsResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armcontainerregistry.WebhooksClientUpdateResponse]](), - } -} - -// WebhooksServerTransport connects instances of armcontainerregistry.WebhooksClient to instances of WebhooksServer. -// Don't use this type directly, use NewWebhooksServerTransport instead. -type WebhooksServerTransport struct { - srv *WebhooksServer - beginCreate *tracker[azfake.PollerResponder[armcontainerregistry.WebhooksClientCreateResponse]] - beginDelete *tracker[azfake.PollerResponder[armcontainerregistry.WebhooksClientDeleteResponse]] - newListPager *tracker[azfake.PagerResponder[armcontainerregistry.WebhooksClientListResponse]] - newListEventsPager *tracker[azfake.PagerResponder[armcontainerregistry.WebhooksClientListEventsResponse]] - beginUpdate *tracker[azfake.PollerResponder[armcontainerregistry.WebhooksClientUpdateResponse]] -} - -// Do implements the policy.Transporter interface for WebhooksServerTransport. -func (w *WebhooksServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "WebhooksClient.BeginCreate": - resp, err = w.dispatchBeginCreate(req) - case "WebhooksClient.BeginDelete": - resp, err = w.dispatchBeginDelete(req) - case "WebhooksClient.Get": - resp, err = w.dispatchGet(req) - case "WebhooksClient.GetCallbackConfig": - resp, err = w.dispatchGetCallbackConfig(req) - case "WebhooksClient.NewListPager": - resp, err = w.dispatchNewListPager(req) - case "WebhooksClient.NewListEventsPager": - resp, err = w.dispatchNewListEventsPager(req) - case "WebhooksClient.Ping": - resp, err = w.dispatchPing(req) - case "WebhooksClient.BeginUpdate": - resp, err = w.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (w *WebhooksServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { - if w.srv.BeginCreate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} - } - beginCreate := w.beginCreate.get(req) - if beginCreate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webhooks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.WebhookCreateParameters](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - webhookNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("webhookName")]) - if err != nil { - return nil, err - } - respr, errRespr := w.srv.BeginCreate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, webhookNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreate = &respr - w.beginCreate.add(req, beginCreate) - } - - resp, err := server.PollerResponderNext(beginCreate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - w.beginCreate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginCreate) { - w.beginCreate.remove(req) - } - - return resp, nil -} - -func (w *WebhooksServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if w.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - beginDelete := w.beginDelete.get(req) - if beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webhooks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - webhookNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("webhookName")]) - if err != nil { - return nil, err - } - respr, errRespr := w.srv.BeginDelete(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, webhookNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginDelete = &respr - w.beginDelete.add(req, beginDelete) - } - - resp, err := server.PollerResponderNext(beginDelete, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - w.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} - } - if !server.PollerResponderMore(beginDelete) { - w.beginDelete.remove(req) - } - - return resp, nil -} - -func (w *WebhooksServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if w.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webhooks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - webhookNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("webhookName")]) - if err != nil { - return nil, err - } - respr, errRespr := w.srv.Get(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, webhookNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Webhook, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (w *WebhooksServerTransport) dispatchGetCallbackConfig(req *http.Request) (*http.Response, error) { - if w.srv.GetCallbackConfig == nil { - return nil, &nonRetriableError{errors.New("fake for method GetCallbackConfig not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webhooks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getCallbackConfig` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - webhookNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("webhookName")]) - if err != nil { - return nil, err - } - respr, errRespr := w.srv.GetCallbackConfig(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, webhookNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CallbackConfig, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (w *WebhooksServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if w.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := w.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webhooks` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - resp := w.srv.NewListPager(resourceGroupNameUnescaped, registryNameUnescaped, nil) - newListPager = &resp - w.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcontainerregistry.WebhooksClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - w.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - w.newListPager.remove(req) - } - return resp, nil -} - -func (w *WebhooksServerTransport) dispatchNewListEventsPager(req *http.Request) (*http.Response, error) { - if w.srv.NewListEventsPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListEventsPager not implemented")} - } - newListEventsPager := w.newListEventsPager.get(req) - if newListEventsPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webhooks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listEvents` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - webhookNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("webhookName")]) - if err != nil { - return nil, err - } - resp := w.srv.NewListEventsPager(resourceGroupNameUnescaped, registryNameUnescaped, webhookNameUnescaped, nil) - newListEventsPager = &resp - w.newListEventsPager.add(req, newListEventsPager) - server.PagerResponderInjectNextLinks(newListEventsPager, req, func(page *armcontainerregistry.WebhooksClientListEventsResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListEventsPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - w.newListEventsPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListEventsPager) { - w.newListEventsPager.remove(req) - } - return resp, nil -} - -func (w *WebhooksServerTransport) dispatchPing(req *http.Request) (*http.Response, error) { - if w.srv.Ping == nil { - return nil, &nonRetriableError{errors.New("fake for method Ping not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webhooks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/ping` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - webhookNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("webhookName")]) - if err != nil { - return nil, err - } - respr, errRespr := w.srv.Ping(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, webhookNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).EventInfo, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (w *WebhooksServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { - if w.srv.BeginUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} - } - beginUpdate := w.beginUpdate.get(req) - if beginUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/webhooks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.WebhookUpdateParameters](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - webhookNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("webhookName")]) - if err != nil { - return nil, err - } - respr, errRespr := w.srv.BeginUpdate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, webhookNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginUpdate = &respr - w.beginUpdate.add(req, beginUpdate) - } - - resp, err := server.PollerResponderNext(beginUpdate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - w.beginUpdate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginUpdate) { - w.beginUpdate.remove(req) - } - - return resp, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake_example_test.go deleted file mode 100644 index 3856ce156cbf..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake_example_test.go +++ /dev/null @@ -1,79 +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. - -package armcontainerregistry_test - -import ( - "context" - "fmt" - "log" - "net/http" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/fake" -) - -func ExampleAgentPoolsServer() { - // first, create an instance of the fake server for the client you wish to test. - // the type name of the server will be similar to the corresponding client, with - // the suffix "Server" instead of "Client". - fakeAgentPoolsServer := fake.AgentPoolsServer{ - - // next, provide implementations for the APIs you wish to fake. - // this fake corresponds to the AgentPoolsClient.Get() API. - Get: func(ctx context.Context, resourceGroupName, registryName, agentPoolName string, options *armcontainerregistry.AgentPoolsClientGetOptions) (resp azfake.Responder[armcontainerregistry.AgentPoolsClientGetResponse], errResp azfake.ErrorResponder) { - // the values of ctx, resourceGroupName, vmName, and options come from the API call. - - // the named return values resp and errResp are used to construct the response - // and are meant to be mutually exclusive. if both responses have been constructed, - // the error response is selected. - - // construct the response type, populating fields as required - agentPoolsResp := armcontainerregistry.AgentPoolsClientGetResponse{} - agentPoolsResp.ID = to.Ptr("/fake/resource/id") - - // use resp to set the desired response - resp.SetResponse(http.StatusOK, agentPoolsResp, nil) - - // to simulate the failure case, use errResp - //errResp.SetResponseError(http.StatusBadRequest, "ThisIsASimulatedError") - - return - }, - } - - // now create the corresponding client, connecting the fake server via the client options - client, err := armcontainerregistry.NewAgentPoolsClient("subscriptionID", azfake.NewTokenCredential(), &arm.ClientOptions{ - ClientOptions: azcore.ClientOptions{ - Transport: fake.NewAgentPoolsServerTransport(&fakeAgentPoolsServer), - }, - }) - if err != nil { - log.Fatal(err) - } - - // call the API. the provided values will be passed to the fake's implementation. - // the response or error values returned by the API call are from the fake. - resp, err := client.Get(context.TODO(), "fakeResourceGroup", "fakeRegistry", "fakeAgentPool", nil) - if err != nil { - log.Fatal(err) - } - - fmt.Println(*resp.ID) - - // APIs that haven't been faked will return an error - _, err = client.GetQueueStatus(context.TODO(), "fakeResourceGroup", "fakeRegistry", "fakeAgentPool", nil) - - fmt.Println(err.Error()) - - // Output: - // /fake/resource/id - // fake for method GetQueueStatus not implemented -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/go.mod b/sdk/resourcemanager/containerregistry/armcontainerregistry/go.mod index d0ae8296a16a..ef0cdd167fb0 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/go.mod +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/go.mod @@ -1,4 +1,4 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/v2 go 1.18 @@ -6,6 +6,7 @@ require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0-beta.1 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry v1.0.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 github.com/stretchr/testify v1.7.0 ) diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/go.sum b/sdk/resourcemanager/containerregistry/armcontainerregistry/go.sum index ef821ca7f8c7..b828b4416614 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/go.sum +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/go.sum @@ -4,6 +4,8 @@ github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry v1.0.0 h1:UuDNFPr44qr9eFQF2sv2WpwSGJlvZroSMsI3A4YtQMc= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry v1.0.0/go.mod h1:tOckqrJq0CXsb/AlUYCdD7DqpULgOaexk+5rz+isAjM= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 h1:mLY+pNLjCUeKhgnAJWAKhEUQM+RJQo2H1fuGSw1Ky1E= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2/go.mod h1:FbdwsQ2EzwvXxOPcMFYO8ogEc9uMMIj3YkmCdXdAFmk= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 h1:ECsQtyERDVz3NP3kvDOTLvbQhqWp/x9EsGKtb4ogUr8= diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/models.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/models.go index dd92af5b7b9d..f5c28b280a4d 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/models.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/models.go @@ -10,17 +10,6 @@ package armcontainerregistry import "time" -// ActiveDirectoryObject - The Active Directory Object that will be used for authenticating the token of a container registry. -type ActiveDirectoryObject struct { - // The user/group/application object ID for Active Directory Object that will be used for authenticating the token of a container - // registry. - ObjectID *string - - // The tenant ID of user/group/application object Active Directory Object that will be used for authenticating the token of - // a container registry. - TenantID *string -} - // Actor - The agent that initiated the event. For most situations, this could be from the authorization context of the request. type Actor struct { // The subject or username associated with the request context that generated the event. @@ -652,61 +641,6 @@ type EncryptionProperty struct { Status *EncryptionStatus } -// ErrorAdditionalInfo - The resource management error additional info. -type ErrorAdditionalInfo struct { - // READ-ONLY; The additional info. - Info any - - // READ-ONLY; The additional info type. - Type *string -} - -// ErrorDetail - The error detail. -type ErrorDetail struct { - // READ-ONLY; The error additional info. - AdditionalInfo []*ErrorAdditionalInfo - - // READ-ONLY; The error code. - Code *string - - // READ-ONLY; The error details. - Details []*ErrorDetail - - // READ-ONLY; The error message. - Message *string - - // READ-ONLY; The error target. - Target *string -} - -// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. -// (This also follows the OData error response format.). -type ErrorResponse struct { - // The error object. - Error *ErrorDetail -} - -// ErrorResponseBody - An error response from the Azure Container Registry service. -type ErrorResponseBody struct { - // REQUIRED; error code. - Code *string - - // REQUIRED; error message. - Message *string - - // an array of additional nested error response info objects, as described by this contract. - Details []*InnerErrorDescription - - // target of the particular error. - Target *string -} - -// ErrorResponseForContainerRegistry - An error response from the Azure Container Registry service. -type ErrorResponseForContainerRegistry struct { - // Azure container registry build API error body. - Error *ErrorResponseBody -} - // Event - The event for a webhook. type Event struct { // The event request message sent to the service URI. @@ -1030,18 +964,6 @@ type ImportSourceCredentials struct { Username *string } -// InnerErrorDescription - inner error. -type InnerErrorDescription struct { - // REQUIRED; error code. - Code *string - - // REQUIRED; error message. - Message *string - - // target of the particular error. - Target *string -} - type KeyVaultProperties struct { // The client id of the identity which will be used to access key vault. Identity *string @@ -1179,15 +1101,6 @@ type OverrideTaskStepProperties struct { Values []*SetValue } -// PackageType - The properties of a package type. -type PackageType struct { - // The name of the package type. - Name *string - - // READ-ONLY; The endpoint of the package type. - Endpoint *string -} - // PlatformProperties - The platform properties against which the run has to happen. type PlatformProperties struct { // REQUIRED; The operating system type required for the run. @@ -1322,22 +1235,6 @@ type PrivateLinkServiceConnectionState struct { Status *ConnectionStatus } -// ProxyResource - The resource model definition for a ARM proxy resource. It will have everything other than required location -// and tags. -type ProxyResource struct { - // READ-ONLY; The resource ID. - ID *string - - // READ-ONLY; The name of the resource. - Name *string - - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData - - // READ-ONLY; The type of the resource. - Type *string -} - // QuarantinePolicy - The quarantine policy for a container registry. type QuarantinePolicy struct { // The value that indicates whether the policy is enabled or not. @@ -1621,27 +1518,6 @@ type Request struct { Useragent *string } -// Resource - An Azure resource. -type Resource struct { - // REQUIRED; The location of the resource. This cannot be changed after the resource is created. - Location *string - - // The tags of the resource. - Tags map[string]*string - - // READ-ONLY; The resource ID. - ID *string - - // READ-ONLY; The name of the resource. - Name *string - - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData - - // READ-ONLY; The type of the resource. - Type *string -} - // RetentionPolicy - The retention policy for a container registry. type RetentionPolicy struct { // The number of days to retain an untagged manifest after which it gets purged. @@ -2030,12 +1906,6 @@ type Status struct { Timestamp *time.Time } -// StorageAccountProperties - The properties of a storage account for a container registry. Only applicable to Classic SKU. -type StorageAccountProperties struct { - // REQUIRED; The resource ID of the storage account. - ID *string -} - // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // The timestamp of resource creation (UTC). diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/models_serde.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/models_serde.go index c445fdd690cd..24deec02be61 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/models_serde.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/models_serde.go @@ -15,37 +15,6 @@ import ( "reflect" ) -// MarshalJSON implements the json.Marshaller interface for type ActiveDirectoryObject. -func (a ActiveDirectoryObject) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "objectId", a.ObjectID) - populate(objectMap, "tenantId", a.TenantID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ActiveDirectoryObject. -func (a *ActiveDirectoryObject) 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", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectId": - err = unpopulate(val, "ObjectID", &a.ObjectID) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &a.TenantID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type Actor. func (a Actor) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1482,173 +1451,6 @@ func (e *EncryptionProperty) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. -func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateAny(objectMap, "info", e.Info) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. -func (e *ErrorAdditionalInfo) 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 "info": - err = unpopulate(val, "Info", &e.Info) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. -func (e ErrorDetail) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "additionalInfo", e.AdditionalInfo) - populate(objectMap, "code", e.Code) - populate(objectMap, "details", e.Details) - populate(objectMap, "message", e.Message) - populate(objectMap, "target", e.Target) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. -func (e *ErrorDetail) 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 "additionalInfo": - err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) - delete(rawMsg, key) - case "code": - err = unpopulate(val, "Code", &e.Code) - delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &e.Details) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &e.Target) - 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 ErrorResponse. -func (e ErrorResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "error", e.Error) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. -func (e *ErrorResponse) 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 "error": - err = unpopulate(val, "Error", &e.Error) - 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 ErrorResponseBody. -func (e ErrorResponseBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "code", e.Code) - populate(objectMap, "details", e.Details) - populate(objectMap, "message", e.Message) - populate(objectMap, "target", e.Target) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseBody. -func (e *ErrorResponseBody) 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 "code": - err = unpopulate(val, "Code", &e.Code) - delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &e.Details) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &e.Target) - 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 ErrorResponseForContainerRegistry. -func (e ErrorResponseForContainerRegistry) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "error", e.Error) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseForContainerRegistry. -func (e *ErrorResponseForContainerRegistry) 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 "error": - err = unpopulate(val, "Error", &e.Error) - 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 Event. func (e Event) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2394,41 +2196,6 @@ func (i *ImportSourceCredentials) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type InnerErrorDescription. -func (i InnerErrorDescription) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "code", i.Code) - populate(objectMap, "message", i.Message) - populate(objectMap, "target", i.Target) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type InnerErrorDescription. -func (i *InnerErrorDescription) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "code": - err = unpopulate(val, "Code", &i.Code) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &i.Message) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &i.Target) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type KeyVaultProperties. func (k KeyVaultProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2803,37 +2570,6 @@ func (o *OverrideTaskStepProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PackageType. -func (p PackageType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "endpoint", p.Endpoint) - populate(objectMap, "name", p.Name) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PackageType. -func (p *PackageType) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endpoint": - err = unpopulate(val, "Endpoint", &p.Endpoint) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type PlatformProperties. func (p PlatformProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3219,45 +2955,6 @@ func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ProxyResource. -func (p ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "systemData", p.SystemData) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. -func (p *ProxyResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &p.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type QuarantinePolicy. func (q QuarantinePolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3987,53 +3684,6 @@ func (r *Request) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "systemData", r.SystemData) - populate(objectMap, "tags", r.Tags) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. -func (r *Resource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &r.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &r.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type RetentionPolicy. func (r RetentionPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -5013,33 +4663,6 @@ func (s *Status) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type StorageAccountProperties. -func (s StorageAccountProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageAccountProperties. -func (s *StorageAccountProperties) 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 "id": - err = unpopulate(val, "ID", &s.ID) - 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]any) @@ -6513,16 +6136,6 @@ func populate(m map[string]any, k string, v any) { } } -func populateAny(m map[string]any, k string, v any) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else { - m[k] = v - } -} - func unpopulate(data json.RawMessage, fn string, v any) error { if data == nil { return nil diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/operations_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/operations_client.go index c4678791fc15..4d831b4f4d2a 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/operations_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/operations_client.go @@ -47,7 +47,6 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") var req *policy.Request var err error if page == nil { @@ -67,7 +66,6 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption } return client.listHandleResponse(resp) }, - Tracer: client.internal.Tracer(), }) } diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/operations_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/operations_client_example_test.go index fc0b639b934d..084ec7d37c80 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/operations_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/operations_client_example_test.go @@ -14,7 +14,7 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/v2" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/OperationList.json diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_client.go index 8104965436f8..01c88c661f3b 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_client.go @@ -74,10 +74,6 @@ func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context. // Generated from API version 2023-07-01 func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error - const operationName = "PrivateEndpointConnectionsClient.BeginCreateOrUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, registryName, privateEndpointConnectionName, privateEndpointConnection, options) if err != nil { return nil, err @@ -153,10 +149,6 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Generated from API version 2023-07-01 func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { var err error - const operationName = "PrivateEndpointConnectionsClient.BeginDelete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, privateEndpointConnectionName, options) if err != nil { return nil, err @@ -209,10 +201,6 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // method. func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { var err error - const operationName = "PrivateEndpointConnectionsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, privateEndpointConnectionName, options) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err @@ -278,7 +266,6 @@ func (client *PrivateEndpointConnectionsClient) NewListPager(resourceGroupName s return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *PrivateEndpointConnectionsClientListResponse) (PrivateEndpointConnectionsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateEndpointConnectionsClient.NewListPager") var req *policy.Request var err error if page == nil { @@ -298,7 +285,6 @@ func (client *PrivateEndpointConnectionsClient) NewListPager(resourceGroupName s } return client.listHandleResponse(resp) }, - Tracer: client.internal.Tracer(), }) } diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_client_example_test.go index 49407e2e37ca..994389b04bae 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_client_example_test.go @@ -15,7 +15,7 @@ import ( "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/containerregistry/armcontainerregistry" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/v2" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/PrivateEndpointConnectionList.json diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/registries_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/registries_client.go index 444bdbcc118b..2e20eb77a06c 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/registries_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/registries_client.go @@ -53,10 +53,6 @@ func NewRegistriesClient(subscriptionID string, credential azcore.TokenCredentia // method. func (client *RegistriesClient) CheckNameAvailability(ctx context.Context, registryNameCheckRequest RegistryNameCheckRequest, options *RegistriesClientCheckNameAvailabilityOptions) (RegistriesClientCheckNameAvailabilityResponse, error) { var err error - const operationName = "RegistriesClient.CheckNameAvailability" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.checkNameAvailabilityCreateRequest(ctx, registryNameCheckRequest, options) if err != nil { return RegistriesClientCheckNameAvailabilityResponse{}, err @@ -129,10 +125,6 @@ func (client *RegistriesClient) BeginCreate(ctx context.Context, resourceGroupNa // Generated from API version 2023-07-01 func (client *RegistriesClient) create(ctx context.Context, resourceGroupName string, registryName string, registry Registry, options *RegistriesClientBeginCreateOptions) (*http.Response, error) { var err error - const operationName = "RegistriesClient.BeginCreate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, registry, options) if err != nil { return nil, err @@ -202,10 +194,6 @@ func (client *RegistriesClient) BeginDelete(ctx context.Context, resourceGroupNa // Generated from API version 2023-07-01 func (client *RegistriesClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, options *RegistriesClientBeginDeleteOptions) (*http.Response, error) { var err error - const operationName = "RegistriesClient.BeginDelete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, options) if err != nil { return nil, err @@ -273,10 +261,6 @@ func (client *RegistriesClient) BeginGenerateCredentials(ctx context.Context, re // Generated from API version 2023-07-01 func (client *RegistriesClient) generateCredentials(ctx context.Context, resourceGroupName string, registryName string, generateCredentialsParameters GenerateCredentialsParameters, options *RegistriesClientBeginGenerateCredentialsOptions) (*http.Response, error) { var err error - const operationName = "RegistriesClient.BeginGenerateCredentials" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.generateCredentialsCreateRequest(ctx, resourceGroupName, registryName, generateCredentialsParameters, options) if err != nil { return nil, err @@ -327,10 +311,6 @@ func (client *RegistriesClient) generateCredentialsCreateRequest(ctx context.Con // - options - RegistriesClientGetOptions contains the optional parameters for the RegistriesClient.Get method. func (client *RegistriesClient) Get(ctx context.Context, resourceGroupName string, registryName string, options *RegistriesClientGetOptions) (RegistriesClientGetResponse, error) { var err error - const operationName = "RegistriesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, options) if err != nil { return RegistriesClientGetResponse{}, err @@ -389,10 +369,6 @@ func (client *RegistriesClient) getHandleResponse(resp *http.Response) (Registri // method. func (client *RegistriesClient) GetBuildSourceUploadURL(ctx context.Context, resourceGroupName string, registryName string, options *RegistriesClientGetBuildSourceUploadURLOptions) (RegistriesClientGetBuildSourceUploadURLResponse, error) { var err error - const operationName = "RegistriesClient.GetBuildSourceUploadURL" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getBuildSourceUploadURLCreateRequest(ctx, resourceGroupName, registryName, options) if err != nil { return RegistriesClientGetBuildSourceUploadURLResponse{}, err @@ -452,10 +428,6 @@ func (client *RegistriesClient) getBuildSourceUploadURLHandleResponse(resp *http // method. func (client *RegistriesClient) GetPrivateLinkResource(ctx context.Context, resourceGroupName string, registryName string, groupName string, options *RegistriesClientGetPrivateLinkResourceOptions) (RegistriesClientGetPrivateLinkResourceResponse, error) { var err error - const operationName = "RegistriesClient.GetPrivateLinkResource" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getPrivateLinkResourceCreateRequest(ctx, resourceGroupName, registryName, groupName, options) if err != nil { return RegistriesClientGetPrivateLinkResourceResponse{}, err @@ -538,10 +510,6 @@ func (client *RegistriesClient) BeginImportImage(ctx context.Context, resourceGr // Generated from API version 2023-07-01 func (client *RegistriesClient) importImage(ctx context.Context, resourceGroupName string, registryName string, parameters ImportImageParameters, options *RegistriesClientBeginImportImageOptions) (*http.Response, error) { var err error - const operationName = "RegistriesClient.BeginImportImage" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.importImageCreateRequest(ctx, resourceGroupName, registryName, parameters, options) if err != nil { return nil, err @@ -592,7 +560,6 @@ func (client *RegistriesClient) NewListPager(options *RegistriesClientListOption return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *RegistriesClientListResponse) (RegistriesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RegistriesClient.NewListPager") var req *policy.Request var err error if page == nil { @@ -612,7 +579,6 @@ func (client *RegistriesClient) NewListPager(options *RegistriesClientListOption } return client.listHandleResponse(resp) }, - Tracer: client.internal.Tracer(), }) } @@ -652,7 +618,6 @@ func (client *RegistriesClient) NewListByResourceGroupPager(resourceGroupName st return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *RegistriesClientListByResourceGroupResponse) (RegistriesClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RegistriesClient.NewListByResourceGroupPager") var req *policy.Request var err error if page == nil { @@ -672,7 +637,6 @@ func (client *RegistriesClient) NewListByResourceGroupPager(resourceGroupName st } return client.listByResourceGroupHandleResponse(resp) }, - Tracer: client.internal.Tracer(), }) } @@ -714,10 +678,6 @@ func (client *RegistriesClient) listByResourceGroupHandleResponse(resp *http.Res // method. func (client *RegistriesClient) ListCredentials(ctx context.Context, resourceGroupName string, registryName string, options *RegistriesClientListCredentialsOptions) (RegistriesClientListCredentialsResponse, error) { var err error - const operationName = "RegistriesClient.ListCredentials" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.listCredentialsCreateRequest(ctx, resourceGroupName, registryName, options) if err != nil { return RegistriesClientListCredentialsResponse{}, err @@ -779,7 +739,6 @@ func (client *RegistriesClient) NewListPrivateLinkResourcesPager(resourceGroupNa return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *RegistriesClientListPrivateLinkResourcesResponse) (RegistriesClientListPrivateLinkResourcesResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RegistriesClient.NewListPrivateLinkResourcesPager") var req *policy.Request var err error if page == nil { @@ -799,7 +758,6 @@ func (client *RegistriesClient) NewListPrivateLinkResourcesPager(resourceGroupNa } return client.listPrivateLinkResourcesHandleResponse(resp) }, - Tracer: client.internal.Tracer(), }) } @@ -844,10 +802,6 @@ func (client *RegistriesClient) listPrivateLinkResourcesHandleResponse(resp *htt // - options - RegistriesClientListUsagesOptions contains the optional parameters for the RegistriesClient.ListUsages method. func (client *RegistriesClient) ListUsages(ctx context.Context, resourceGroupName string, registryName string, options *RegistriesClientListUsagesOptions) (RegistriesClientListUsagesResponse, error) { var err error - const operationName = "RegistriesClient.ListUsages" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.listUsagesCreateRequest(ctx, resourceGroupName, registryName, options) if err != nil { return RegistriesClientListUsagesResponse{}, err @@ -907,10 +861,6 @@ func (client *RegistriesClient) listUsagesHandleResponse(resp *http.Response) (R // method. func (client *RegistriesClient) RegenerateCredential(ctx context.Context, resourceGroupName string, registryName string, regenerateCredentialParameters RegenerateCredentialParameters, options *RegistriesClientRegenerateCredentialOptions) (RegistriesClientRegenerateCredentialResponse, error) { var err error - const operationName = "RegistriesClient.RegenerateCredential" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.regenerateCredentialCreateRequest(ctx, resourceGroupName, registryName, regenerateCredentialParameters, options) if err != nil { return RegistriesClientRegenerateCredentialResponse{}, err @@ -990,10 +940,6 @@ func (client *RegistriesClient) BeginScheduleRun(ctx context.Context, resourceGr // Generated from API version 2019-06-01-preview func (client *RegistriesClient) scheduleRun(ctx context.Context, resourceGroupName string, registryName string, runRequest RunRequestClassification, options *RegistriesClientBeginScheduleRunOptions) (*http.Response, error) { var err error - const operationName = "RegistriesClient.BeginScheduleRun" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.scheduleRunCreateRequest(ctx, resourceGroupName, registryName, runRequest, options) if err != nil { return nil, err @@ -1064,10 +1010,6 @@ func (client *RegistriesClient) BeginUpdate(ctx context.Context, resourceGroupNa // Generated from API version 2023-07-01 func (client *RegistriesClient) update(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters, options *RegistriesClientBeginUpdateOptions) (*http.Response, error) { var err error - const operationName = "RegistriesClient.BeginUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, registryUpdateParameters, options) if err != nil { return nil, err diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/registries_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/registries_client_example_test.go index 3940cb330a4c..31acbcb8f954 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/registries_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/registries_client_example_test.go @@ -17,7 +17,7 @@ import ( "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/containerregistry/armcontainerregistry" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/v2" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/ImportImageByManifestDigest.json diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client.go index d2ea869ac7cb..5fe02c5a9c64 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client.go @@ -74,10 +74,6 @@ func (client *ReplicationsClient) BeginCreate(ctx context.Context, resourceGroup // Generated from API version 2023-07-01 func (client *ReplicationsClient) create(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replication Replication, options *ReplicationsClientBeginCreateOptions) (*http.Response, error) { var err error - const operationName = "ReplicationsClient.BeginCreate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, replicationName, replication, options) if err != nil { return nil, err @@ -153,10 +149,6 @@ func (client *ReplicationsClient) BeginDelete(ctx context.Context, resourceGroup // Generated from API version 2023-07-01 func (client *ReplicationsClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, replicationName string, options *ReplicationsClientBeginDeleteOptions) (*http.Response, error) { var err error - const operationName = "ReplicationsClient.BeginDelete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, replicationName, options) if err != nil { return nil, err @@ -208,10 +200,6 @@ func (client *ReplicationsClient) deleteCreateRequest(ctx context.Context, resou // - options - ReplicationsClientGetOptions contains the optional parameters for the ReplicationsClient.Get method. func (client *ReplicationsClient) Get(ctx context.Context, resourceGroupName string, registryName string, replicationName string, options *ReplicationsClientGetOptions) (ReplicationsClientGetResponse, error) { var err error - const operationName = "ReplicationsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, replicationName, options) if err != nil { return ReplicationsClientGetResponse{}, err @@ -276,7 +264,6 @@ func (client *ReplicationsClient) NewListPager(resourceGroupName string, registr return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ReplicationsClientListResponse) (ReplicationsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ReplicationsClient.NewListPager") var req *policy.Request var err error if page == nil { @@ -296,7 +283,6 @@ func (client *ReplicationsClient) NewListPager(resourceGroupName string, registr } return client.listHandleResponse(resp) }, - Tracer: client.internal.Tracer(), }) } @@ -363,10 +349,6 @@ func (client *ReplicationsClient) BeginUpdate(ctx context.Context, resourceGroup // Generated from API version 2023-07-01 func (client *ReplicationsClient) update(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters ReplicationUpdateParameters, options *ReplicationsClientBeginUpdateOptions) (*http.Response, error) { var err error - const operationName = "ReplicationsClient.BeginUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, replicationName, replicationUpdateParameters, options) if err != nil { return nil, err diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client_example_test.go index 4787d2f6b7e2..c9550d353fba 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client_example_test.go @@ -15,7 +15,7 @@ import ( "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/containerregistry/armcontainerregistry" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/v2" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/ReplicationList.json diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/runs_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/runs_client.go index cd296b6de12c..99bdb79c885b 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/runs_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/runs_client.go @@ -71,10 +71,6 @@ func (client *RunsClient) BeginCancel(ctx context.Context, resourceGroupName str // Generated from API version 2019-06-01-preview func (client *RunsClient) cancel(ctx context.Context, resourceGroupName string, registryName string, runID string, options *RunsClientBeginCancelOptions) (*http.Response, error) { var err error - const operationName = "RunsClient.BeginCancel" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.cancelCreateRequest(ctx, resourceGroupName, registryName, runID, options) if err != nil { return nil, err @@ -127,10 +123,6 @@ func (client *RunsClient) cancelCreateRequest(ctx context.Context, resourceGroup // - options - RunsClientGetOptions contains the optional parameters for the RunsClient.Get method. func (client *RunsClient) Get(ctx context.Context, resourceGroupName string, registryName string, runID string, options *RunsClientGetOptions) (RunsClientGetResponse, error) { var err error - const operationName = "RunsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, runID, options) if err != nil { return RunsClientGetResponse{}, err @@ -193,10 +185,6 @@ func (client *RunsClient) getHandleResponse(resp *http.Response) (RunsClientGetR // - options - RunsClientGetLogSasURLOptions contains the optional parameters for the RunsClient.GetLogSasURL method. func (client *RunsClient) GetLogSasURL(ctx context.Context, resourceGroupName string, registryName string, runID string, options *RunsClientGetLogSasURLOptions) (RunsClientGetLogSasURLResponse, error) { var err error - const operationName = "RunsClient.GetLogSasURL" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getLogSasURLCreateRequest(ctx, resourceGroupName, registryName, runID, options) if err != nil { return RunsClientGetLogSasURLResponse{}, err @@ -261,7 +249,6 @@ func (client *RunsClient) NewListPager(resourceGroupName string, registryName st return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *RunsClientListResponse) (RunsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RunsClient.NewListPager") var req *policy.Request var err error if page == nil { @@ -281,7 +268,6 @@ func (client *RunsClient) NewListPager(resourceGroupName string, registryName st } return client.listHandleResponse(resp) }, - Tracer: client.internal.Tracer(), }) } @@ -351,10 +337,6 @@ func (client *RunsClient) BeginUpdate(ctx context.Context, resourceGroupName str // Generated from API version 2019-06-01-preview func (client *RunsClient) update(ctx context.Context, resourceGroupName string, registryName string, runID string, runUpdateParameters RunUpdateParameters, options *RunsClientBeginUpdateOptions) (*http.Response, error) { var err error - const operationName = "RunsClient.BeginUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, runID, runUpdateParameters, options) if err != nil { return nil, err diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/runs_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/runs_client_example_test.go index 868202be0cc7..77ed34b552c1 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/runs_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/runs_client_example_test.go @@ -15,7 +15,7 @@ import ( "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/containerregistry/armcontainerregistry" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/v2" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RunsList.json diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_client.go index 9ab3d6cf1faf..d654d78ed11f 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_client.go @@ -73,10 +73,6 @@ func (client *ScopeMapsClient) BeginCreate(ctx context.Context, resourceGroupNam // Generated from API version 2023-07-01 func (client *ScopeMapsClient) create(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapCreateParameters ScopeMap, options *ScopeMapsClientBeginCreateOptions) (*http.Response, error) { var err error - const operationName = "ScopeMapsClient.BeginCreate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, scopeMapName, scopeMapCreateParameters, options) if err != nil { return nil, err @@ -151,10 +147,6 @@ func (client *ScopeMapsClient) BeginDelete(ctx context.Context, resourceGroupNam // Generated from API version 2023-07-01 func (client *ScopeMapsClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, options *ScopeMapsClientBeginDeleteOptions) (*http.Response, error) { var err error - const operationName = "ScopeMapsClient.BeginDelete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, scopeMapName, options) if err != nil { return nil, err @@ -207,10 +199,6 @@ func (client *ScopeMapsClient) deleteCreateRequest(ctx context.Context, resource // - options - ScopeMapsClientGetOptions contains the optional parameters for the ScopeMapsClient.Get method. func (client *ScopeMapsClient) Get(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, options *ScopeMapsClientGetOptions) (ScopeMapsClientGetResponse, error) { var err error - const operationName = "ScopeMapsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, scopeMapName, options) if err != nil { return ScopeMapsClientGetResponse{}, err @@ -275,7 +263,6 @@ func (client *ScopeMapsClient) NewListPager(resourceGroupName string, registryNa return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ScopeMapsClientListResponse) (ScopeMapsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ScopeMapsClient.NewListPager") var req *policy.Request var err error if page == nil { @@ -295,7 +282,6 @@ func (client *ScopeMapsClient) NewListPager(resourceGroupName string, registryNa } return client.listHandleResponse(resp) }, - Tracer: client.internal.Tracer(), }) } @@ -361,10 +347,6 @@ func (client *ScopeMapsClient) BeginUpdate(ctx context.Context, resourceGroupNam // Generated from API version 2023-07-01 func (client *ScopeMapsClient) update(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapUpdateParameters ScopeMapUpdateParameters, options *ScopeMapsClientBeginUpdateOptions) (*http.Response, error) { var err error - const operationName = "ScopeMapsClient.BeginUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, scopeMapName, scopeMapUpdateParameters, options) if err != nil { return nil, err diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_client_example_test.go index 568231271457..d74b11cfdd97 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_client_example_test.go @@ -15,7 +15,7 @@ import ( "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/containerregistry/armcontainerregistry" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/v2" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/ScopeMapList.json diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/taskruns_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/taskruns_client.go index 966cff5c5ae8..82a5406dc72e 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/taskruns_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/taskruns_client.go @@ -71,10 +71,6 @@ func (client *TaskRunsClient) BeginCreate(ctx context.Context, resourceGroupName // Generated from API version 2019-06-01-preview func (client *TaskRunsClient) create(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, taskRun TaskRun, options *TaskRunsClientBeginCreateOptions) (*http.Response, error) { var err error - const operationName = "TaskRunsClient.BeginCreate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, taskRunName, taskRun, options) if err != nil { return nil, err @@ -147,10 +143,6 @@ func (client *TaskRunsClient) BeginDelete(ctx context.Context, resourceGroupName // Generated from API version 2019-06-01-preview func (client *TaskRunsClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, options *TaskRunsClientBeginDeleteOptions) (*http.Response, error) { var err error - const operationName = "TaskRunsClient.BeginDelete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, taskRunName, options) if err != nil { return nil, err @@ -203,10 +195,6 @@ func (client *TaskRunsClient) deleteCreateRequest(ctx context.Context, resourceG // - options - TaskRunsClientGetOptions contains the optional parameters for the TaskRunsClient.Get method. func (client *TaskRunsClient) Get(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, options *TaskRunsClientGetOptions) (TaskRunsClientGetResponse, error) { var err error - const operationName = "TaskRunsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, taskRunName, options) if err != nil { return TaskRunsClientGetResponse{}, err @@ -269,10 +257,6 @@ func (client *TaskRunsClient) getHandleResponse(resp *http.Response) (TaskRunsCl // - options - TaskRunsClientGetDetailsOptions contains the optional parameters for the TaskRunsClient.GetDetails method. func (client *TaskRunsClient) GetDetails(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, options *TaskRunsClientGetDetailsOptions) (TaskRunsClientGetDetailsResponse, error) { var err error - const operationName = "TaskRunsClient.GetDetails" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getDetailsCreateRequest(ctx, resourceGroupName, registryName, taskRunName, options) if err != nil { return TaskRunsClientGetDetailsResponse{}, err @@ -337,7 +321,6 @@ func (client *TaskRunsClient) NewListPager(resourceGroupName string, registryNam return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *TaskRunsClientListResponse) (TaskRunsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TaskRunsClient.NewListPager") var req *policy.Request var err error if page == nil { @@ -357,7 +340,6 @@ func (client *TaskRunsClient) NewListPager(resourceGroupName string, registryNam } return client.listHandleResponse(resp) }, - Tracer: client.internal.Tracer(), }) } @@ -421,10 +403,6 @@ func (client *TaskRunsClient) BeginUpdate(ctx context.Context, resourceGroupName // Generated from API version 2019-06-01-preview func (client *TaskRunsClient) update(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, updateParameters TaskRunUpdateParameters, options *TaskRunsClientBeginUpdateOptions) (*http.Response, error) { var err error - const operationName = "TaskRunsClient.BeginUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, taskRunName, updateParameters, options) if err != nil { return nil, err diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/taskruns_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/taskruns_client_example_test.go index 30f75a1846a0..1bb771b4ff6b 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/taskruns_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/taskruns_client_example_test.go @@ -15,7 +15,7 @@ import ( "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/containerregistry/armcontainerregistry" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/v2" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TaskRunsGet.json diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/tasks_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/tasks_client.go index 9071032e40ae..445cfe24d0f7 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/tasks_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/tasks_client.go @@ -71,10 +71,6 @@ func (client *TasksClient) BeginCreate(ctx context.Context, resourceGroupName st // Generated from API version 2019-06-01-preview func (client *TasksClient) create(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskCreateParameters Task, options *TasksClientBeginCreateOptions) (*http.Response, error) { var err error - const operationName = "TasksClient.BeginCreate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, taskName, taskCreateParameters, options) if err != nil { return nil, err @@ -147,10 +143,6 @@ func (client *TasksClient) BeginDelete(ctx context.Context, resourceGroupName st // Generated from API version 2019-06-01-preview func (client *TasksClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, taskName string, options *TasksClientBeginDeleteOptions) (*http.Response, error) { var err error - const operationName = "TasksClient.BeginDelete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, taskName, options) if err != nil { return nil, err @@ -203,10 +195,6 @@ func (client *TasksClient) deleteCreateRequest(ctx context.Context, resourceGrou // - options - TasksClientGetOptions contains the optional parameters for the TasksClient.Get method. func (client *TasksClient) Get(ctx context.Context, resourceGroupName string, registryName string, taskName string, options *TasksClientGetOptions) (TasksClientGetResponse, error) { var err error - const operationName = "TasksClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, taskName, options) if err != nil { return TasksClientGetResponse{}, err @@ -269,10 +257,6 @@ func (client *TasksClient) getHandleResponse(resp *http.Response) (TasksClientGe // - options - TasksClientGetDetailsOptions contains the optional parameters for the TasksClient.GetDetails method. func (client *TasksClient) GetDetails(ctx context.Context, resourceGroupName string, registryName string, taskName string, options *TasksClientGetDetailsOptions) (TasksClientGetDetailsResponse, error) { var err error - const operationName = "TasksClient.GetDetails" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getDetailsCreateRequest(ctx, resourceGroupName, registryName, taskName, options) if err != nil { return TasksClientGetDetailsResponse{}, err @@ -337,7 +321,6 @@ func (client *TasksClient) NewListPager(resourceGroupName string, registryName s return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *TasksClientListResponse) (TasksClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TasksClient.NewListPager") var req *policy.Request var err error if page == nil { @@ -357,7 +340,6 @@ func (client *TasksClient) NewListPager(resourceGroupName string, registryName s } return client.listHandleResponse(resp) }, - Tracer: client.internal.Tracer(), }) } @@ -421,10 +403,6 @@ func (client *TasksClient) BeginUpdate(ctx context.Context, resourceGroupName st // Generated from API version 2019-06-01-preview func (client *TasksClient) update(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskUpdateParameters TaskUpdateParameters, options *TasksClientBeginUpdateOptions) (*http.Response, error) { var err error - const operationName = "TasksClient.BeginUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, taskName, taskUpdateParameters, options) if err != nil { return nil, err diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/tasks_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/tasks_client_example_test.go index 7f9cdaa7f972..dca6736e331b 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/tasks_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/tasks_client_example_test.go @@ -15,7 +15,7 @@ import ( "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/containerregistry/armcontainerregistry" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/v2" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksList.json diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_client.go index 2ea54d84d433..b5231bb5deaf 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_client.go @@ -73,10 +73,6 @@ func (client *TokensClient) BeginCreate(ctx context.Context, resourceGroupName s // Generated from API version 2023-07-01 func (client *TokensClient) create(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenCreateParameters Token, options *TokensClientBeginCreateOptions) (*http.Response, error) { var err error - const operationName = "TokensClient.BeginCreate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, tokenName, tokenCreateParameters, options) if err != nil { return nil, err @@ -151,10 +147,6 @@ func (client *TokensClient) BeginDelete(ctx context.Context, resourceGroupName s // Generated from API version 2023-07-01 func (client *TokensClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, tokenName string, options *TokensClientBeginDeleteOptions) (*http.Response, error) { var err error - const operationName = "TokensClient.BeginDelete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, tokenName, options) if err != nil { return nil, err @@ -207,10 +199,6 @@ func (client *TokensClient) deleteCreateRequest(ctx context.Context, resourceGro // - options - TokensClientGetOptions contains the optional parameters for the TokensClient.Get method. func (client *TokensClient) Get(ctx context.Context, resourceGroupName string, registryName string, tokenName string, options *TokensClientGetOptions) (TokensClientGetResponse, error) { var err error - const operationName = "TokensClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, tokenName, options) if err != nil { return TokensClientGetResponse{}, err @@ -275,7 +263,6 @@ func (client *TokensClient) NewListPager(resourceGroupName string, registryName return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *TokensClientListResponse) (TokensClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TokensClient.NewListPager") var req *policy.Request var err error if page == nil { @@ -295,7 +282,6 @@ func (client *TokensClient) NewListPager(resourceGroupName string, registryName } return client.listHandleResponse(resp) }, - Tracer: client.internal.Tracer(), }) } @@ -361,10 +347,6 @@ func (client *TokensClient) BeginUpdate(ctx context.Context, resourceGroupName s // Generated from API version 2023-07-01 func (client *TokensClient) update(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenUpdateParameters TokenUpdateParameters, options *TokensClientBeginUpdateOptions) (*http.Response, error) { var err error - const operationName = "TokensClient.BeginUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, tokenName, tokenUpdateParameters, options) if err != nil { return nil, err diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_client_example_test.go index ab3d8d7ff284..1ec67210e2f6 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_client_example_test.go @@ -15,7 +15,7 @@ import ( "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/containerregistry/armcontainerregistry" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/v2" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/TokenList.json diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client.go index 796dbfe3a63e..4f2fd9af2b4a 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client.go @@ -73,10 +73,6 @@ func (client *WebhooksClient) BeginCreate(ctx context.Context, resourceGroupName // Generated from API version 2023-07-01 func (client *WebhooksClient) create(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookCreateParameters WebhookCreateParameters, options *WebhooksClientBeginCreateOptions) (*http.Response, error) { var err error - const operationName = "WebhooksClient.BeginCreate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, webhookName, webhookCreateParameters, options) if err != nil { return nil, err @@ -151,10 +147,6 @@ func (client *WebhooksClient) BeginDelete(ctx context.Context, resourceGroupName // Generated from API version 2023-07-01 func (client *WebhooksClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, webhookName string, options *WebhooksClientBeginDeleteOptions) (*http.Response, error) { var err error - const operationName = "WebhooksClient.BeginDelete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, webhookName, options) if err != nil { return nil, err @@ -206,10 +198,6 @@ func (client *WebhooksClient) deleteCreateRequest(ctx context.Context, resourceG // - options - WebhooksClientGetOptions contains the optional parameters for the WebhooksClient.Get method. func (client *WebhooksClient) Get(ctx context.Context, resourceGroupName string, registryName string, webhookName string, options *WebhooksClientGetOptions) (WebhooksClientGetResponse, error) { var err error - const operationName = "WebhooksClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, webhookName, options) if err != nil { return WebhooksClientGetResponse{}, err @@ -273,10 +261,6 @@ func (client *WebhooksClient) getHandleResponse(resp *http.Response) (WebhooksCl // method. func (client *WebhooksClient) GetCallbackConfig(ctx context.Context, resourceGroupName string, registryName string, webhookName string, options *WebhooksClientGetCallbackConfigOptions) (WebhooksClientGetCallbackConfigResponse, error) { var err error - const operationName = "WebhooksClient.GetCallbackConfig" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getCallbackConfigCreateRequest(ctx, resourceGroupName, registryName, webhookName, options) if err != nil { return WebhooksClientGetCallbackConfigResponse{}, err @@ -341,7 +325,6 @@ func (client *WebhooksClient) NewListPager(resourceGroupName string, registryNam return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *WebhooksClientListResponse) (WebhooksClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "WebhooksClient.NewListPager") var req *policy.Request var err error if page == nil { @@ -361,7 +344,6 @@ func (client *WebhooksClient) NewListPager(resourceGroupName string, registryNam } return client.listHandleResponse(resp) }, - Tracer: client.internal.Tracer(), }) } @@ -410,7 +392,6 @@ func (client *WebhooksClient) NewListEventsPager(resourceGroupName string, regis return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *WebhooksClientListEventsResponse) (WebhooksClientListEventsResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "WebhooksClient.NewListEventsPager") var req *policy.Request var err error if page == nil { @@ -430,7 +411,6 @@ func (client *WebhooksClient) NewListEventsPager(resourceGroupName string, regis } return client.listEventsHandleResponse(resp) }, - Tracer: client.internal.Tracer(), }) } @@ -480,10 +460,6 @@ func (client *WebhooksClient) listEventsHandleResponse(resp *http.Response) (Web // - options - WebhooksClientPingOptions contains the optional parameters for the WebhooksClient.Ping method. func (client *WebhooksClient) Ping(ctx context.Context, resourceGroupName string, registryName string, webhookName string, options *WebhooksClientPingOptions) (WebhooksClientPingResponse, error) { var err error - const operationName = "WebhooksClient.Ping" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.pingCreateRequest(ctx, resourceGroupName, registryName, webhookName, options) if err != nil { return WebhooksClientPingResponse{}, err @@ -566,10 +542,6 @@ func (client *WebhooksClient) BeginUpdate(ctx context.Context, resourceGroupName // Generated from API version 2023-07-01 func (client *WebhooksClient) update(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookUpdateParameters WebhookUpdateParameters, options *WebhooksClientBeginUpdateOptions) (*http.Response, error) { var err error - const operationName = "WebhooksClient.BeginUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, webhookName, webhookUpdateParameters, options) if err != nil { return nil, err diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client_example_test.go index caae854ea64d..fb339844d135 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client_example_test.go @@ -15,7 +15,7 @@ import ( "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/containerregistry/armcontainerregistry" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/v2" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/WebhookList.json From 76c51c76c2e9c23eb52e43a16db39f81f8003a40 Mon Sep 17 00:00:00 2001 From: Alancere <804873052@qq.com> Date: Mon, 18 Sep 2023 15:18:43 +0800 Subject: [PATCH 4/6] update major version --- .../armcontainerregistry/CHANGELOG.md | 13 +------------ .../armcontainerregistry/autorest.md | 2 +- .../armcontainerregistry/constants.go | 2 +- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/CHANGELOG.md b/sdk/resourcemanager/containerregistry/armcontainerregistry/CHANGELOG.md index 44500c66b46e..099da2d8184f 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/CHANGELOG.md +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/CHANGELOG.md @@ -1,17 +1,6 @@ # Release History -## 2.0.0 (2023-09-22) -### Breaking Changes - -- Struct `ActiveDirectoryObject` has been removed -- Struct `ErrorResponse` has been removed -- Struct `ErrorResponseBody` has been removed -- Struct `InnerErrorDescription` has been removed -- Struct `PackageType` has been removed -- Struct `ProxyResource` has been removed -- Struct `Resource` has been removed -- Struct `StorageAccountProperties` has been removed - +## 1.1.0 (2023-09-22) ### Features Added - New enum type `CredentialHealthStatus` with values `CredentialHealthStatusHealthy`, `CredentialHealthStatusUnhealthy` diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/autorest.md b/sdk/resourcemanager/containerregistry/armcontainerregistry/autorest.md index 2b54ac312a69..5df402513536 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/autorest.md +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/autorest.md @@ -8,6 +8,6 @@ require: - https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/readme.md - https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 2.0.0 +module-version: 1.1.0 tag: package-2023-07 ``` diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/constants.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/constants.go index 77e16ab0c26e..140d665797d3 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/constants.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/constants.go @@ -10,7 +10,7 @@ package armcontainerregistry const ( moduleName = "armcontainerregistry" - moduleVersion = "v2.0.0" + moduleVersion = "v1.1.0" ) // Action - The action of IP ACL rule. From ef7bbfef1d1b97cd532455a2ea03f9ea143d1cc2 Mon Sep 17 00:00:00 2001 From: Alancere <804873052@qq.com> Date: Mon, 18 Sep 2023 15:28:49 +0800 Subject: [PATCH 5/6] fix --- .../armcontainerregistry/agentpools_client_example_test.go | 2 +- .../armcontainerregistry/cacherules_client_example_test.go | 2 +- .../credentialsets_client_example_test.go | 2 +- .../containerregistry/armcontainerregistry/go.mod | 5 ++--- .../containerregistry/armcontainerregistry/go.sum | 6 ++---- .../armcontainerregistry/operations_client_example_test.go | 2 +- .../privateendpointconnections_client_example_test.go | 2 +- .../armcontainerregistry/registries_client_example_test.go | 2 +- .../replications_client_example_test.go | 2 +- .../armcontainerregistry/runs_client_example_test.go | 2 +- .../armcontainerregistry/scopemaps_client_example_test.go | 2 +- .../armcontainerregistry/taskruns_client_example_test.go | 2 +- .../armcontainerregistry/tasks_client_example_test.go | 2 +- .../armcontainerregistry/tokens_client_example_test.go | 2 +- .../armcontainerregistry/webhooks_client_example_test.go | 2 +- 15 files changed, 17 insertions(+), 20 deletions(-) diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/agentpools_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/agentpools_client_example_test.go index 90cf9a2b49c1..b17a83e2dc77 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/agentpools_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/agentpools_client_example_test.go @@ -15,7 +15,7 @@ import ( "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/containerregistry/armcontainerregistry/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/AgentPoolsGet.json diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client_example_test.go index bd15a3b7a186..7ec730c04c61 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client_example_test.go @@ -15,7 +15,7 @@ import ( "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/containerregistry/armcontainerregistry/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/CacheRuleList.json diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client_example_test.go index 0d4a93d8d0ee..652a625117a6 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client_example_test.go @@ -15,7 +15,7 @@ import ( "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/containerregistry/armcontainerregistry/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/CredentialSetList.json diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/go.mod b/sdk/resourcemanager/containerregistry/armcontainerregistry/go.mod index ef0cdd167fb0..cc47aed4255b 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/go.mod +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/go.mod @@ -1,12 +1,11 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/v2 +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0-beta.1 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.1 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 - github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry v1.0.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 github.com/stretchr/testify v1.7.0 ) diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/go.sum b/sdk/resourcemanager/containerregistry/armcontainerregistry/go.sum index b828b4416614..2b3cbdcb090d 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/go.sum +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/go.sum @@ -1,11 +1,9 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0-beta.1 h1:8t6ZZtkOCl+rx7uBn40Nj62ABVGkXK69U/En44wJIlE= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0-beta.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.1 h1:/iHxaJhsFr0+xVFfbMr5vxz848jyiWuIEDhYq3y5odY= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry v1.0.0 h1:UuDNFPr44qr9eFQF2sv2WpwSGJlvZroSMsI3A4YtQMc= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry v1.0.0/go.mod h1:tOckqrJq0CXsb/AlUYCdD7DqpULgOaexk+5rz+isAjM= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 h1:mLY+pNLjCUeKhgnAJWAKhEUQM+RJQo2H1fuGSw1Ky1E= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2/go.mod h1:FbdwsQ2EzwvXxOPcMFYO8ogEc9uMMIj3YkmCdXdAFmk= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 h1:ECsQtyERDVz3NP3kvDOTLvbQhqWp/x9EsGKtb4ogUr8= diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/operations_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/operations_client_example_test.go index 084ec7d37c80..fc0b639b934d 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/operations_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/operations_client_example_test.go @@ -14,7 +14,7 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/OperationList.json diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_client_example_test.go index 994389b04bae..49407e2e37ca 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_client_example_test.go @@ -15,7 +15,7 @@ import ( "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/containerregistry/armcontainerregistry/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/PrivateEndpointConnectionList.json diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/registries_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/registries_client_example_test.go index 31acbcb8f954..3940cb330a4c 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/registries_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/registries_client_example_test.go @@ -17,7 +17,7 @@ import ( "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/containerregistry/armcontainerregistry/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/ImportImageByManifestDigest.json diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client_example_test.go index c9550d353fba..4787d2f6b7e2 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client_example_test.go @@ -15,7 +15,7 @@ import ( "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/containerregistry/armcontainerregistry/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/ReplicationList.json diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/runs_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/runs_client_example_test.go index 77ed34b552c1..868202be0cc7 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/runs_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/runs_client_example_test.go @@ -15,7 +15,7 @@ import ( "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/containerregistry/armcontainerregistry/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RunsList.json diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_client_example_test.go index d74b11cfdd97..568231271457 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_client_example_test.go @@ -15,7 +15,7 @@ import ( "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/containerregistry/armcontainerregistry/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/ScopeMapList.json diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/taskruns_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/taskruns_client_example_test.go index 1bb771b4ff6b..30f75a1846a0 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/taskruns_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/taskruns_client_example_test.go @@ -15,7 +15,7 @@ import ( "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/containerregistry/armcontainerregistry/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TaskRunsGet.json diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/tasks_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/tasks_client_example_test.go index dca6736e331b..7f9cdaa7f972 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/tasks_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/tasks_client_example_test.go @@ -15,7 +15,7 @@ import ( "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/containerregistry/armcontainerregistry/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksList.json diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_client_example_test.go index 1ec67210e2f6..ab3d8d7ff284 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_client_example_test.go @@ -15,7 +15,7 @@ import ( "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/containerregistry/armcontainerregistry/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/TokenList.json diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client_example_test.go index fb339844d135..caae854ea64d 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client_example_test.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client_example_test.go @@ -15,7 +15,7 @@ import ( "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/containerregistry/armcontainerregistry/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" ) // Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/bbe1ea8bf5aa6cfbfa8855e03dbb9a93f8266bcd/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/stable/2023-07-01/examples/WebhookList.json From 78fcbb880df56bda67b4540bafe9394bf2dc006f Mon Sep 17 00:00:00 2001 From: Alancere <804873052@qq.com> Date: Mon, 18 Sep 2023 15:44:49 +0800 Subject: [PATCH 6/6] remove fake_example.go link --- .../containerregistry/armcontainerregistry/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/README.md b/sdk/resourcemanager/containerregistry/armcontainerregistry/README.md index 36e0d2133a5a..8a6ddd0116a9 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/README.md +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/README.md @@ -177,7 +177,6 @@ client, err := armcontainerregistry.NewAgentPoolsClient("subscriptionID", azfake - [Replication](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/containerregistry/replication) - [Container Task](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/containerregistry/task) - [Container Token](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/containerregistry/token) -- [Creating a Fake](https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/resourcemanager/containerregistry/armcontainerregistry/fake_example_test.go) ## Provide Feedback