From 077bd4d645c3fe8d1418a3d0a165aa6cd2da464d Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 16 Aug 2023 22:47:26 +0000 Subject: [PATCH] CodeGen from PR 25345 in Azure/azure-rest-api-specs Merge 8bbb66cf157203024902685e7cb512b5cb9871a2 into 81b12f02fbd0fb13383fbc9623887bd0eae4b2f9 --- .../armcontainerregistry/CHANGELOG.md | 37 + .../agentpools_client_example_test.go | 221 --- .../armcontainerregistry/archives_client.go | 427 +++++ .../archiveversions_client.go | 371 ++++ .../armcontainerregistry/autorest.md | 6 +- .../armcontainerregistry/cacherules_client.go | 28 +- .../cacherules_client_example_test.go | 194 -- .../armcontainerregistry/client_factory.go | 10 + .../connectedregistries_client.go | 32 +- ...connectedregistries_client_example_test.go | 302 --- .../armcontainerregistry/constants.go | 16 +- .../credentialsets_client.go | 28 +- .../credentialsets_client_example_test.go | 254 --- .../exportpipelines_client.go | 20 +- .../exportpipelines_client_example_test.go | 189 -- .../fake/archives_server.go | 339 ++++ .../fake/archiveversions_server.go | 300 +++ .../fake/cacherules_server.go | 6 +- .../fake/credentialsets_server.go | 6 +- .../armcontainerregistry/go.mod | 2 +- .../importpipelines_client.go | 20 +- .../importpipelines_client_example_test.go | 227 --- .../armcontainerregistry/models.go | 189 +- .../armcontainerregistry/models_serde.go | 500 +++++ .../armcontainerregistry/operations_client.go | 4 +- .../operations_client_example_test.go | 55 - .../armcontainerregistry/options.go | 49 + .../pipelineruns_client.go | 20 +- .../pipelineruns_client_example_test.go | 296 --- .../privateendpointconnections_client.go | 20 +- ...endpointconnections_client_example_test.go | 167 -- .../armcontainerregistry/registries_client.go | 66 +- .../registries_client_example_test.go | 1389 -------------- .../replications_client.go | 26 +- .../replications_client_example_test.go | 273 --- .../armcontainerregistry/response_types.go | 52 + .../runs_client_example_test.go | 283 --- .../armcontainerregistry/scopemaps_client.go | 26 +- .../scopemaps_client_example_test.go | 202 -- .../taskruns_client_example_test.go | 408 ---- .../tasks_client_example_test.go | 1651 ----------------- .../armcontainerregistry/tokens_client.go | 26 +- .../tokens_client_example_test.go | 218 --- .../armcontainerregistry/webhooks_client.go | 38 +- .../webhooks_client_example_test.go | 353 ---- 45 files changed, 2465 insertions(+), 6881 deletions(-) delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/agentpools_client_example_test.go create mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/archives_client.go create mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/archiveversions_client.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client_example_test.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/connectedregistries_client_example_test.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client_example_test.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/exportpipelines_client_example_test.go create mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/fake/archives_server.go create mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/fake/archiveversions_server.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/importpipelines_client_example_test.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/operations_client_example_test.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/pipelineruns_client_example_test.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_client_example_test.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/registries_client_example_test.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client_example_test.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/runs_client_example_test.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_client_example_test.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/taskruns_client_example_test.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/tasks_client_example_test.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_client_example_test.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client_example_test.go diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/CHANGELOG.md b/sdk/resourcemanager/containerregistry/armcontainerregistry/CHANGELOG.md index 1d61c6f9adba..28b2b653038a 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/CHANGELOG.md +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/CHANGELOG.md @@ -1,5 +1,42 @@ # Release History +## 1.1.0-beta.4 (2023-08-16) +### Breaking Changes + +- Type of `ErrorResponse.Error` has been changed from `*ErrorResponseBody` to `*ErrorDetail` + +### Features Added + +- New enum type `PackageSourceType` with values `PackageSourceTypeRemote` +- New function `NewArchiveVersionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ArchiveVersionsClient, error)` +- New function `*ArchiveVersionsClient.BeginCreate(context.Context, string, string, string, string, string, *ArchiveVersionsClientBeginCreateOptions) (*runtime.Poller[ArchiveVersionsClientCreateResponse], error)` +- New function `*ArchiveVersionsClient.BeginDelete(context.Context, string, string, string, string, string, *ArchiveVersionsClientBeginDeleteOptions) (*runtime.Poller[ArchiveVersionsClientDeleteResponse], error)` +- New function `*ArchiveVersionsClient.Get(context.Context, string, string, string, string, string, *ArchiveVersionsClientGetOptions) (ArchiveVersionsClientGetResponse, error)` +- New function `*ArchiveVersionsClient.NewListPager(string, string, string, string, *ArchiveVersionsClientListOptions) *runtime.Pager[ArchiveVersionsClientListResponse]` +- New function `NewArchivesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ArchivesClient, error)` +- New function `*ArchivesClient.BeginCreate(context.Context, string, string, string, string, Archive, *ArchivesClientBeginCreateOptions) (*runtime.Poller[ArchivesClientCreateResponse], error)` +- New function `*ArchivesClient.BeginDelete(context.Context, string, string, string, string, *ArchivesClientBeginDeleteOptions) (*runtime.Poller[ArchivesClientDeleteResponse], error)` +- New function `*ArchivesClient.Get(context.Context, string, string, string, string, *ArchivesClientGetOptions) (ArchivesClientGetResponse, error)` +- New function `*ArchivesClient.NewListPager(string, string, string, *ArchivesClientListOptions) *runtime.Pager[ArchivesClientListResponse]` +- New function `*ArchivesClient.Update(context.Context, string, string, string, string, ArchiveUpdateParameters, *ArchivesClientUpdateOptions) (ArchivesClientUpdateResponse, error)` +- New function `*ClientFactory.NewArchiveVersionsClient() *ArchiveVersionsClient` +- New function `*ClientFactory.NewArchivesClient() *ArchivesClient` +- New struct `Archive` +- New struct `ArchiveListResult` +- New struct `ArchivePackageSourceProperties` +- New struct `ArchiveProperties` +- New struct `ArchiveUpdateParameters` +- New struct `ArchiveUpdateProperties` +- New struct `ArchiveVersion` +- New struct `ArchiveVersionListResult` +- New struct `ArchiveVersionProperties` +- New struct `DebianArchivePackageSourceProperties` +- New struct `DebianArchiveProperties` +- 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 deleted file mode 100644 index 97a427859a0b..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/agentpools_client_example_test.go +++ /dev/null @@ -1,221 +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/2019-06-01-preview/examples/AgentPoolsGet.json -func ExampleAgentPoolsClient_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.NewAgentPoolsClient().Get(ctx, "myResourceGroup", "myRegistry", "myAgentPool", 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.AgentPool = armcontainerregistry.AgentPool{ - // Name: to.Ptr("myAgentPool"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/agentPools"), - // ID: to.Ptr("/subscriptions/f9d7ebed-adbd-4cb4-b973-aaf82c136138/resourceGroups/huanwudfwestgroup/providers/Microsoft.ContainerRegistry/registries/huanglidfwest01/agentPools/testagent26"), - // Location: to.Ptr("WESTUS"), - // Properties: &armcontainerregistry.AgentPoolProperties{ - // Count: to.Ptr[int32](1), - // OS: to.Ptr(armcontainerregistry.OSLinux), - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Tier: to.Ptr("S1"), - // }, - // } -} - -// 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 -func ExampleAgentPoolsClient_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.NewAgentPoolsClient().BeginCreate(ctx, "myResourceGroup", "myRegistry", "myAgentPool", armcontainerregistry.AgentPool{ - Location: to.Ptr("WESTUS"), - Tags: map[string]*string{ - "key": to.Ptr("value"), - }, - Properties: &armcontainerregistry.AgentPoolProperties{ - Count: to.Ptr[int32](1), - OS: to.Ptr(armcontainerregistry.OSLinux), - Tier: to.Ptr("S1"), - }, - }, 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.AgentPool = armcontainerregistry.AgentPool{ - // Name: to.Ptr("myAgentPool"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/agentPools"), - // ID: to.Ptr("/subscriptions/f9d7ebed-adbd-4cb4-b973-aaf82c136138/resourceGroups/huanwudfwestgroup/providers/Microsoft.ContainerRegistry/registries/huanglidfwest01/agentPools/testagent26"), - // Location: to.Ptr("WESTUS"), - // Properties: &armcontainerregistry.AgentPoolProperties{ - // Count: to.Ptr[int32](1), - // OS: to.Ptr(armcontainerregistry.OSLinux), - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Tier: to.Ptr("S1"), - // }, - // } -} - -// 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 -func ExampleAgentPoolsClient_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.NewAgentPoolsClient().BeginDelete(ctx, "myResourceGroup", "myRegistry", "myAgentPool", 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/2019-06-01-preview/examples/AgentPoolsUpdate.json -func ExampleAgentPoolsClient_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.NewAgentPoolsClient().BeginUpdate(ctx, "myResourceGroup", "myRegistry", "myAgentPool", armcontainerregistry.AgentPoolUpdateParameters{ - Properties: &armcontainerregistry.AgentPoolPropertiesUpdateParameters{ - Count: to.Ptr[int32](1), - }, - }, 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.AgentPool = armcontainerregistry.AgentPool{ - // Name: to.Ptr("myAgentPool"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/agentPools"), - // ID: to.Ptr("/subscriptions/f9d7ebed-adbd-4cb4-b973-aaf82c136138/resourceGroups/huanwudfwestgroup/providers/Microsoft.ContainerRegistry/registries/huanglidfwest01/agentPools/testagent26"), - // Location: to.Ptr("WESTUS"), - // Properties: &armcontainerregistry.AgentPoolProperties{ - // Count: to.Ptr[int32](1), - // OS: to.Ptr(armcontainerregistry.OSLinux), - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Tier: to.Ptr("S1"), - // }, - // } -} - -// 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 -func ExampleAgentPoolsClient_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.NewAgentPoolsClient().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.AgentPoolListResult = armcontainerregistry.AgentPoolListResult{ - // Value: []*armcontainerregistry.AgentPool{ - // { - // Name: to.Ptr("myAgentPool"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/agentPools"), - // ID: to.Ptr("/subscriptions/f9d7ebed-adbd-4cb4-b973-aaf82c136138/resourceGroups/huanwudfwestgroup/providers/Microsoft.ContainerRegistry/registries/huanglidfwest01/agentPools/testagent26"), - // Location: to.Ptr("WESTUS"), - // Properties: &armcontainerregistry.AgentPoolProperties{ - // Count: to.Ptr[int32](1), - // OS: to.Ptr(armcontainerregistry.OSLinux), - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Tier: to.Ptr("S1"), - // }, - // }}, - // } - } -} - -// 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 -func ExampleAgentPoolsClient_GetQueueStatus() { - 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.NewAgentPoolsClient().GetQueueStatus(ctx, "myResourceGroup", "myRegistry", "myAgentPool", 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.AgentPoolQueueStatus = armcontainerregistry.AgentPoolQueueStatus{ - // Count: to.Ptr[int32](10), - // } -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/archives_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/archives_client.go new file mode 100644 index 000000000000..ec75bfb55176 --- /dev/null +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/archives_client.go @@ -0,0 +1,427 @@ +//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" +) + +// ArchivesClient contains the methods for the Archives group. +// Don't use this type directly, use NewArchivesClient() instead. +type ArchivesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewArchivesClient creates a new instance of ArchivesClient 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 NewArchivesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ArchivesClient, error) { + cl, err := arm.NewClient(moduleName+".ArchivesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ArchivesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Creates a archive for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - packageType - The type of the package resource. +// - archiveName - The name of the archive resource. +// - archiveCreateParameters - The parameters for creating a archive. +// - options - ArchivesClientBeginCreateOptions contains the optional parameters for the ArchivesClient.BeginCreate method. +func (client *ArchivesClient) BeginCreate(ctx context.Context, resourceGroupName string, registryName string, packageType string, archiveName string, archiveCreateParameters Archive, options *ArchivesClientBeginCreateOptions) (*runtime.Poller[ArchivesClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, registryName, packageType, archiveName, archiveCreateParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ArchivesClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ArchivesClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Create - Creates a archive for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +func (client *ArchivesClient) create(ctx context.Context, resourceGroupName string, registryName string, packageType string, archiveName string, archiveCreateParameters Archive, options *ArchivesClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "ArchivesClient.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, packageType, archiveName, archiveCreateParameters, 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 *ArchivesClient) createCreateRequest(ctx context.Context, resourceGroupName string, registryName string, packageType string, archiveName string, archiveCreateParameters Archive, options *ArchivesClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/packages/{packageType}/archives/{archiveName}" + 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 packageType == "" { + return nil, errors.New("parameter packageType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{packageType}", url.PathEscape(packageType)) + if archiveName == "" { + return nil, errors.New("parameter archiveName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{archiveName}", url.PathEscape(archiveName)) + 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-07-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, archiveCreateParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a archive from a container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - packageType - The type of the package resource. +// - archiveName - The name of the archive resource. +// - options - ArchivesClientBeginDeleteOptions contains the optional parameters for the ArchivesClient.BeginDelete method. +func (client *ArchivesClient) BeginDelete(ctx context.Context, resourceGroupName string, registryName string, packageType string, archiveName string, options *ArchivesClientBeginDeleteOptions) (*runtime.Poller[ArchivesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, registryName, packageType, archiveName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ArchivesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ArchivesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes a archive from a container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +func (client *ArchivesClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, packageType string, archiveName string, options *ArchivesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "ArchivesClient.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, packageType, archiveName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ArchivesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, registryName string, packageType string, archiveName string, options *ArchivesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/packages/{packageType}/archives/{archiveName}" + 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 packageType == "" { + return nil, errors.New("parameter packageType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{packageType}", url.PathEscape(packageType)) + if archiveName == "" { + return nil, errors.New("parameter archiveName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{archiveName}", url.PathEscape(archiveName)) + 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-07-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the properties of the archive. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - packageType - The type of the package resource. +// - archiveName - The name of the archive resource. +// - options - ArchivesClientGetOptions contains the optional parameters for the ArchivesClient.Get method. +func (client *ArchivesClient) Get(ctx context.Context, resourceGroupName string, registryName string, packageType string, archiveName string, options *ArchivesClientGetOptions) (ArchivesClientGetResponse, error) { + var err error + const operationName = "ArchivesClient.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, packageType, archiveName, options) + if err != nil { + return ArchivesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ArchivesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ArchivesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ArchivesClient) getCreateRequest(ctx context.Context, resourceGroupName string, registryName string, packageType string, archiveName string, options *ArchivesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/packages/{packageType}/archives/{archiveName}" + 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 packageType == "" { + return nil, errors.New("parameter packageType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{packageType}", url.PathEscape(packageType)) + if archiveName == "" { + return nil, errors.New("parameter archiveName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{archiveName}", url.PathEscape(archiveName)) + 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-07-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 *ArchivesClient) getHandleResponse(resp *http.Response) (ArchivesClientGetResponse, error) { + result := ArchivesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Archive); err != nil { + return ArchivesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all archives for the specified container registry and package type. +// +// Generated from API version 2023-07-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - packageType - The type of the package resource. +// - options - ArchivesClientListOptions contains the optional parameters for the ArchivesClient.NewListPager method. +func (client *ArchivesClient) NewListPager(resourceGroupName string, registryName string, packageType string, options *ArchivesClientListOptions) *runtime.Pager[ArchivesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ArchivesClientListResponse]{ + More: func(page ArchivesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ArchivesClientListResponse) (ArchivesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ArchivesClient.NewListPager") + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, registryName, packageType, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ArchivesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ArchivesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ArchivesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ArchivesClient) listCreateRequest(ctx context.Context, resourceGroupName string, registryName string, packageType string, options *ArchivesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/packages/{packageType}/archives" + 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 packageType == "" { + return nil, errors.New("parameter packageType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{packageType}", url.PathEscape(packageType)) + 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-07-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 *ArchivesClient) listHandleResponse(resp *http.Response) (ArchivesClientListResponse, error) { + result := ArchivesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ArchiveListResult); err != nil { + return ArchivesClientListResponse{}, err + } + return result, nil +} + +// Update - Updates a archive for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - packageType - The type of the package resource. +// - archiveName - The name of the archive resource. +// - archiveUpdateParameters - The parameters for updating a archive. +// - options - ArchivesClientUpdateOptions contains the optional parameters for the ArchivesClient.Update method. +func (client *ArchivesClient) Update(ctx context.Context, resourceGroupName string, registryName string, packageType string, archiveName string, archiveUpdateParameters ArchiveUpdateParameters, options *ArchivesClientUpdateOptions) (ArchivesClientUpdateResponse, error) { + var err error + const operationName = "ArchivesClient.Update" + 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, packageType, archiveName, archiveUpdateParameters, options) + if err != nil { + return ArchivesClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ArchivesClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ArchivesClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *ArchivesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, registryName string, packageType string, archiveName string, archiveUpdateParameters ArchiveUpdateParameters, options *ArchivesClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/packages/{packageType}/archives/{archiveName}" + 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 packageType == "" { + return nil, errors.New("parameter packageType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{packageType}", url.PathEscape(packageType)) + if archiveName == "" { + return nil, errors.New("parameter archiveName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{archiveName}", url.PathEscape(archiveName)) + 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-07-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, archiveUpdateParameters); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *ArchivesClient) updateHandleResponse(resp *http.Response) (ArchivesClientUpdateResponse, error) { + result := ArchivesClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Archive); err != nil { + return ArchivesClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/archiveversions_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/archiveversions_client.go new file mode 100644 index 000000000000..ddb5014f46be --- /dev/null +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/archiveversions_client.go @@ -0,0 +1,371 @@ +//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" +) + +// ArchiveVersionsClient contains the methods for the ArchiveVersions group. +// Don't use this type directly, use NewArchiveVersionsClient() instead. +type ArchiveVersionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewArchiveVersionsClient creates a new instance of ArchiveVersionsClient 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 NewArchiveVersionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ArchiveVersionsClient, error) { + cl, err := arm.NewClient(moduleName+".ArchiveVersionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ArchiveVersionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Creates a archive for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - packageType - The type of the package resource. +// - archiveName - The name of the archive resource. +// - archiveVersionName - The name of the archive version resource. +// - options - ArchiveVersionsClientBeginCreateOptions contains the optional parameters for the ArchiveVersionsClient.BeginCreate +// method. +func (client *ArchiveVersionsClient) BeginCreate(ctx context.Context, resourceGroupName string, registryName string, packageType string, archiveName string, archiveVersionName string, options *ArchiveVersionsClientBeginCreateOptions) (*runtime.Poller[ArchiveVersionsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, registryName, packageType, archiveName, archiveVersionName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ArchiveVersionsClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ArchiveVersionsClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Create - Creates a archive for a container registry with the specified parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +func (client *ArchiveVersionsClient) create(ctx context.Context, resourceGroupName string, registryName string, packageType string, archiveName string, archiveVersionName string, options *ArchiveVersionsClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "ArchiveVersionsClient.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, packageType, archiveName, archiveVersionName, 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 *ArchiveVersionsClient) createCreateRequest(ctx context.Context, resourceGroupName string, registryName string, packageType string, archiveName string, archiveVersionName string, options *ArchiveVersionsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/packages/{packageType}/archives/{archiveName}/versions/{archiveVersionName}" + 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 packageType == "" { + return nil, errors.New("parameter packageType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{packageType}", url.PathEscape(packageType)) + if archiveName == "" { + return nil, errors.New("parameter archiveName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{archiveName}", url.PathEscape(archiveName)) + if archiveVersionName == "" { + return nil, errors.New("parameter archiveVersionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{archiveVersionName}", url.PathEscape(archiveVersionName)) + 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-07-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginDelete - Deletes a archive version from a container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - packageType - The type of the package resource. +// - archiveName - The name of the archive resource. +// - archiveVersionName - The name of the archive version resource. +// - options - ArchiveVersionsClientBeginDeleteOptions contains the optional parameters for the ArchiveVersionsClient.BeginDelete +// method. +func (client *ArchiveVersionsClient) BeginDelete(ctx context.Context, resourceGroupName string, registryName string, packageType string, archiveName string, archiveVersionName string, options *ArchiveVersionsClientBeginDeleteOptions) (*runtime.Poller[ArchiveVersionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, registryName, packageType, archiveName, archiveVersionName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ArchiveVersionsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ArchiveVersionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes a archive version from a container registry. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +func (client *ArchiveVersionsClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, packageType string, archiveName string, archiveVersionName string, options *ArchiveVersionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "ArchiveVersionsClient.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, packageType, archiveName, archiveVersionName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ArchiveVersionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, registryName string, packageType string, archiveName string, archiveVersionName string, options *ArchiveVersionsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/packages/{packageType}/archives/{archiveName}/versions/{archiveVersionName}" + 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 packageType == "" { + return nil, errors.New("parameter packageType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{packageType}", url.PathEscape(packageType)) + if archiveName == "" { + return nil, errors.New("parameter archiveName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{archiveName}", url.PathEscape(archiveName)) + if archiveVersionName == "" { + return nil, errors.New("parameter archiveVersionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{archiveVersionName}", url.PathEscape(archiveVersionName)) + 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-07-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the properties of the archive version. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-07-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - packageType - The type of the package resource. +// - archiveName - The name of the archive resource. +// - archiveVersionName - The name of the archive version resource. +// - options - ArchiveVersionsClientGetOptions contains the optional parameters for the ArchiveVersionsClient.Get method. +func (client *ArchiveVersionsClient) Get(ctx context.Context, resourceGroupName string, registryName string, packageType string, archiveName string, archiveVersionName string, options *ArchiveVersionsClientGetOptions) (ArchiveVersionsClientGetResponse, error) { + var err error + const operationName = "ArchiveVersionsClient.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, packageType, archiveName, archiveVersionName, options) + if err != nil { + return ArchiveVersionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ArchiveVersionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ArchiveVersionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ArchiveVersionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, registryName string, packageType string, archiveName string, archiveVersionName string, options *ArchiveVersionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/packages/{packageType}/archives/{archiveName}/versions/{archiveVersionName}" + 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 packageType == "" { + return nil, errors.New("parameter packageType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{packageType}", url.PathEscape(packageType)) + if archiveName == "" { + return nil, errors.New("parameter archiveName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{archiveName}", url.PathEscape(archiveName)) + if archiveVersionName == "" { + return nil, errors.New("parameter archiveVersionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{archiveVersionName}", url.PathEscape(archiveVersionName)) + 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-07-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 *ArchiveVersionsClient) getHandleResponse(resp *http.Response) (ArchiveVersionsClientGetResponse, error) { + result := ArchiveVersionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ArchiveVersion); err != nil { + return ArchiveVersionsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all archive versions for the specified container registry, repository type and archive name. +// +// Generated from API version 2023-07-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - registryName - The name of the container registry. +// - packageType - The type of the package resource. +// - archiveName - The name of the archive resource. +// - options - ArchiveVersionsClientListOptions contains the optional parameters for the ArchiveVersionsClient.NewListPager +// method. +func (client *ArchiveVersionsClient) NewListPager(resourceGroupName string, registryName string, packageType string, archiveName string, options *ArchiveVersionsClientListOptions) *runtime.Pager[ArchiveVersionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ArchiveVersionsClientListResponse]{ + More: func(page ArchiveVersionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ArchiveVersionsClientListResponse) (ArchiveVersionsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ArchiveVersionsClient.NewListPager") + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, registryName, packageType, archiveName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ArchiveVersionsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ArchiveVersionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ArchiveVersionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ArchiveVersionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, registryName string, packageType string, archiveName string, options *ArchiveVersionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/packages/{packageType}/archives/{archiveName}/versions" + 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 packageType == "" { + return nil, errors.New("parameter packageType cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{packageType}", url.PathEscape(packageType)) + if archiveName == "" { + return nil, errors.New("parameter archiveName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{archiveName}", url.PathEscape(archiveName)) + 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-07-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 *ArchiveVersionsClient) listHandleResponse(resp *http.Response) (ArchiveVersionsClientListResponse, error) { + result := ArchiveVersionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ArchiveVersionListResult); err != nil { + return ArchiveVersionsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/autorest.md b/sdk/resourcemanager/containerregistry/armcontainerregistry/autorest.md index 7fc47482764d..2728df00ef89 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/autorest.md +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/autorest.md @@ -5,11 +5,11 @@ ``` 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 +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/containerregistry/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/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 diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client.go index 2878954f63a2..feb7b25a7cc2 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-preview // - 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-preview 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-preview") 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-preview // - 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-preview 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-preview") 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-preview // - 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-preview") 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-preview // - 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-preview") 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-preview // - 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-preview 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-preview") 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 deleted file mode 100644 index 03cfd49e22ca..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client_example_test.go +++ /dev/null @@ -1,194 +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/CacheRuleList.json -func ExampleCacheRulesClient_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.NewCacheRulesClient().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.CacheRulesListResult = armcontainerregistry.CacheRulesListResult{ - // Value: []*armcontainerregistry.CacheRule{ - // { - // Name: to.Ptr("myCacheRule"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/cacheRules"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/cacheRules/myCacheRule"), - // Properties: &armcontainerregistry.CacheRuleProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-07T18:20:33.8374968+00:00"); return t}()), - // CredentialSetResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/credentialSets/myCredentialSet"), - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // SourceRepository: to.Ptr("docker.io/library/hello-world"), - // TargetRepository: to.Ptr("cached-docker-hub/hello-world"), - // }, - // }}, - // } - } -} - -// 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 -func ExampleCacheRulesClient_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.NewCacheRulesClient().Get(ctx, "myResourceGroup", "myRegistry", "myCacheRule", 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.CacheRule = armcontainerregistry.CacheRule{ - // Name: to.Ptr("myCacheRule"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/cacheRules"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/cacheRules/myCacheRule"), - // Properties: &armcontainerregistry.CacheRuleProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-07T18:20:33.8374968+00:00"); return t}()), - // CredentialSetResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/credentialSets/myCredentialSet"), - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // SourceRepository: to.Ptr("docker.io/library/hello-world"), - // TargetRepository: to.Ptr("cached-docker-hub/hello-world"), - // }, - // } -} - -// 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 -func ExampleCacheRulesClient_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.NewCacheRulesClient().BeginCreate(ctx, "myResourceGroup", "myRegistry", "myCacheRule", armcontainerregistry.CacheRule{ - Properties: &armcontainerregistry.CacheRuleProperties{ - CredentialSetResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/credentialSets/myCredentialSet"), - SourceRepository: to.Ptr("docker.io/library/hello-world"), - TargetRepository: to.Ptr("cached-docker-hub/hello-world"), - }, - }, 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.CacheRule = armcontainerregistry.CacheRule{ - // Name: to.Ptr("myCacheRule"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/cacheRules"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/cacheRules/myCacheRule"), - // Properties: &armcontainerregistry.CacheRuleProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-07T18:20:33.8374968+00:00"); return t}()), - // CredentialSetResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/credentialSets/myCredentialSet"), - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // SourceRepository: to.Ptr("docker.io/library/hello-world"), - // TargetRepository: to.Ptr("cached-docker-hub/hello-world"), - // }, - // } -} - -// 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 -func ExampleCacheRulesClient_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.NewCacheRulesClient().BeginDelete(ctx, "myResourceGroup", "myRegistry", "myCacheRule", 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/CacheRuleUpdate.json -func ExampleCacheRulesClient_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.NewCacheRulesClient().BeginUpdate(ctx, "myResourceGroup", "myRegistry", "myCacheRule", armcontainerregistry.CacheRuleUpdateParameters{ - Properties: &armcontainerregistry.CacheRuleUpdateProperties{ - CredentialSetResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/credentialSets/myCredentialSet2"), - }, - }, 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.CacheRule = armcontainerregistry.CacheRule{ - // Name: to.Ptr("myCacheRule"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/cacheRules"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/cacheRules/myCacheRule"), - // Properties: &armcontainerregistry.CacheRuleProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-07T18:20:33.8374968+00:00"); return t}()), - // CredentialSetResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/credentialSets/myCredentialSet2"), - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // SourceRepository: to.Ptr("docker.io/library/hello-world"), - // TargetRepository: to.Ptr("cached-docker-hub/hello-world"), - // }, - // } -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/client_factory.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/client_factory.go index acfab33500ae..74ea91f46197 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/client_factory.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/client_factory.go @@ -42,6 +42,16 @@ func (c *ClientFactory) NewAgentPoolsClient() *AgentPoolsClient { return subClient } +func (c *ClientFactory) NewArchiveVersionsClient() *ArchiveVersionsClient { + subClient, _ := NewArchiveVersionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewArchivesClient() *ArchivesClient { + subClient, _ := NewArchivesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewCacheRulesClient() *CacheRulesClient { subClient, _ := NewCacheRulesClient(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 index dab2285fd747..d0782c987777 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/connectedregistries_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/connectedregistries_client.go @@ -46,7 +46,7 @@ func NewConnectedRegistriesClient(subscriptionID string, credential azcore.Token // 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 +// Generated from API version 2023-07-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. @@ -71,7 +71,7 @@ func (client *ConnectedRegistriesClient) BeginCreate(ctx context.Context, resour // 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 +// Generated from API version 2023-07-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" @@ -114,7 +114,7 @@ func (client *ConnectedRegistriesClient) createCreateRequest(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-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, connectedRegistryCreateParameters); err != nil { @@ -126,7 +126,7 @@ func (client *ConnectedRegistriesClient) createCreateRequest(ctx context.Context // BeginDeactivate - Deactivates the connected registry instance. // 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-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. @@ -150,7 +150,7 @@ func (client *ConnectedRegistriesClient) BeginDeactivate(ctx context.Context, re // Deactivate - Deactivates the connected registry instance. // 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-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" @@ -193,7 +193,7 @@ func (client *ConnectedRegistriesClient) deactivateCreateRequest(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-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -202,7 +202,7 @@ func (client *ConnectedRegistriesClient) deactivateCreateRequest(ctx context.Con // 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 +// Generated from API version 2023-07-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. @@ -226,7 +226,7 @@ func (client *ConnectedRegistriesClient) BeginDelete(ctx context.Context, resour // 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 +// Generated from API version 2023-07-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" @@ -269,7 +269,7 @@ func (client *ConnectedRegistriesClient) deleteCreateRequest(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-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -278,7 +278,7 @@ func (client *ConnectedRegistriesClient) deleteCreateRequest(ctx context.Context // 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 +// Generated from API version 2023-07-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. @@ -326,7 +326,7 @@ func (client *ConnectedRegistriesClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -343,7 +343,7 @@ func (client *ConnectedRegistriesClient) getHandleResponse(resp *http.Response) // NewListPager - Lists all connected registries for the specified container registry. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-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 @@ -395,7 +395,7 @@ func (client *ConnectedRegistriesClient) listCreateRequest(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-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -416,7 +416,7 @@ func (client *ConnectedRegistriesClient) listHandleResponse(resp *http.Response) // 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 +// Generated from API version 2023-07-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. @@ -441,7 +441,7 @@ func (client *ConnectedRegistriesClient) BeginUpdate(ctx context.Context, resour // 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 +// Generated from API version 2023-07-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" @@ -484,7 +484,7 @@ func (client *ConnectedRegistriesClient) updateCreateRequest(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-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, connectedRegistryUpdateParameters); err != 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..22f9b6514ad3 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. @@ -408,6 +408,20 @@ func PossibleOSValues() []OS { } } +// PackageSourceType - The type of package source for a archive. +type PackageSourceType string + +const ( + PackageSourceTypeRemote PackageSourceType = "remote" +) + +// PossiblePackageSourceTypeValues returns the possible values for the PackageSourceType const type. +func PossiblePackageSourceTypeValues() []PackageSourceType { + return []PackageSourceType{ + PackageSourceTypeRemote, + } +} + // PasswordName - The password name. type PasswordName string diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client.go index daf741dfa898..9018ad9407df 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-preview // - 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-preview 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-preview") 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-preview // - 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-preview 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-preview") 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-preview // - 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-preview") 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-preview // - 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-preview") 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-preview // - 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-preview 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-preview") 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 deleted file mode 100644 index a701d815aefa..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client_example_test.go +++ /dev/null @@ -1,254 +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/CredentialSetList.json -func ExampleCredentialSetsClient_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.NewCredentialSetsClient().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.CredentialSetListResult = armcontainerregistry.CredentialSetListResult{ - // Value: []*armcontainerregistry.CredentialSet{ - // { - // Name: to.Ptr("myCredentialSet"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/credentialSets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/credentialSets/myCredentialSet"), - // Identity: &armcontainerregistry.IdentityProperties{ - // Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // Properties: &armcontainerregistry.CredentialSetProperties{ - // AuthCredentials: []*armcontainerregistry.AuthCredential{ - // { - // Name: to.Ptr(armcontainerregistry.CredentialNameCredential1), - // CredentialHealth: &armcontainerregistry.CredentialHealth{ - // Status: to.Ptr(armcontainerregistry.CredentialHealthStatusHealthy), - // }, - // PasswordSecretIdentifier: to.Ptr("https://myvault.vault.azure.net/secrets/password"), - // UsernameSecretIdentifier: to.Ptr("https://myvault.vault.azure.net/secrets/username"), - // }}, - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-07T18:20:08.012276+00:00"); return t}()), - // LoginServer: to.Ptr("docker.io"), - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// 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 -func ExampleCredentialSetsClient_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.NewCredentialSetsClient().Get(ctx, "myResourceGroup", "myRegistry", "myCredentialSet", 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.CredentialSet = armcontainerregistry.CredentialSet{ - // Name: to.Ptr("myCredentialSet"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/credentialSets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/credentialSets/myCredentialSet"), - // Identity: &armcontainerregistry.IdentityProperties{ - // Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // Properties: &armcontainerregistry.CredentialSetProperties{ - // AuthCredentials: []*armcontainerregistry.AuthCredential{ - // { - // Name: to.Ptr(armcontainerregistry.CredentialNameCredential1), - // CredentialHealth: &armcontainerregistry.CredentialHealth{ - // Status: to.Ptr(armcontainerregistry.CredentialHealthStatusHealthy), - // }, - // PasswordSecretIdentifier: to.Ptr("https://myvault.vault.azure.net/secrets/password"), - // UsernameSecretIdentifier: to.Ptr("https://myvault.vault.azure.net/secrets/username"), - // }}, - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-07T18:20:08.012276+00:00"); return t}()), - // LoginServer: to.Ptr("docker.io"), - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // }, - // } -} - -// 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 -func ExampleCredentialSetsClient_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.NewCredentialSetsClient().BeginCreate(ctx, "myResourceGroup", "myRegistry", "myCredentialSet", armcontainerregistry.CredentialSet{ - Identity: &armcontainerregistry.IdentityProperties{ - Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeSystemAssigned), - }, - Properties: &armcontainerregistry.CredentialSetProperties{ - AuthCredentials: []*armcontainerregistry.AuthCredential{ - { - Name: to.Ptr(armcontainerregistry.CredentialNameCredential1), - PasswordSecretIdentifier: to.Ptr("https://myvault.vault.azure.net/secrets/password"), - UsernameSecretIdentifier: to.Ptr("https://myvault.vault.azure.net/secrets/username"), - }}, - LoginServer: to.Ptr("docker.io"), - }, - }, 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.CredentialSet = armcontainerregistry.CredentialSet{ - // Name: to.Ptr("myCredentialSet"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/credentialSets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/credentialSets/myCredentialSet"), - // Identity: &armcontainerregistry.IdentityProperties{ - // Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // Properties: &armcontainerregistry.CredentialSetProperties{ - // AuthCredentials: []*armcontainerregistry.AuthCredential{ - // { - // Name: to.Ptr(armcontainerregistry.CredentialNameCredential1), - // CredentialHealth: &armcontainerregistry.CredentialHealth{ - // Status: to.Ptr(armcontainerregistry.CredentialHealthStatusHealthy), - // }, - // PasswordSecretIdentifier: to.Ptr("https://myvault.vault.azure.net/secrets/password"), - // UsernameSecretIdentifier: to.Ptr("https://myvault.vault.azure.net/secrets/username"), - // }}, - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-07T18:20:08.012276+00:00"); return t}()), - // LoginServer: to.Ptr("docker.io"), - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // }, - // } -} - -// 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 -func ExampleCredentialSetsClient_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.NewCredentialSetsClient().BeginDelete(ctx, "myResourceGroup", "myRegistry", "myCredentialSet", 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/CredentialSetUpdate.json -func ExampleCredentialSetsClient_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.NewCredentialSetsClient().BeginUpdate(ctx, "myResourceGroup", "myRegistry", "myCredentialSet", armcontainerregistry.CredentialSetUpdateParameters{ - Properties: &armcontainerregistry.CredentialSetUpdateProperties{ - AuthCredentials: []*armcontainerregistry.AuthCredential{ - { - Name: to.Ptr(armcontainerregistry.CredentialNameCredential1), - PasswordSecretIdentifier: to.Ptr("https://myvault.vault.azure.net/secrets/password2"), - UsernameSecretIdentifier: to.Ptr("https://myvault.vault.azure.net/secrets/username2"), - }}, - }, - }, 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.CredentialSet = armcontainerregistry.CredentialSet{ - // Name: to.Ptr("myCredentialSet"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/credentialSets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/credentialSets/myCredentialSet"), - // Identity: &armcontainerregistry.IdentityProperties{ - // Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // Properties: &armcontainerregistry.CredentialSetProperties{ - // AuthCredentials: []*armcontainerregistry.AuthCredential{ - // { - // Name: to.Ptr(armcontainerregistry.CredentialNameCredential1), - // CredentialHealth: &armcontainerregistry.CredentialHealth{ - // Status: to.Ptr(armcontainerregistry.CredentialHealthStatusHealthy), - // }, - // PasswordSecretIdentifier: to.Ptr("https://myvault.vault.azure.net/secrets/password2"), - // UsernameSecretIdentifier: to.Ptr("https://myvault.vault.azure.net/secrets/username2"), - // }}, - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-07T18:20:08.012276+00:00"); return t}()), - // LoginServer: to.Ptr("docker.io"), - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // }, - // } -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/exportpipelines_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/exportpipelines_client.go index 782b4446aefb..6b09813fe5aa 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/exportpipelines_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/exportpipelines_client.go @@ -46,7 +46,7 @@ func NewExportPipelinesClient(subscriptionID string, credential azcore.TokenCred // 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 +// Generated from API version 2023-07-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. @@ -71,7 +71,7 @@ func (client *ExportPipelinesClient) BeginCreate(ctx context.Context, resourceGr // 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 +// Generated from API version 2023-07-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" @@ -114,7 +114,7 @@ func (client *ExportPipelinesClient) createCreateRequest(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-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, exportPipelineCreateParameters); err != nil { @@ -126,7 +126,7 @@ func (client *ExportPipelinesClient) createCreateRequest(ctx context.Context, re // 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 +// Generated from API version 2023-07-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. @@ -150,7 +150,7 @@ func (client *ExportPipelinesClient) BeginDelete(ctx context.Context, resourceGr // 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 +// Generated from API version 2023-07-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" @@ -193,7 +193,7 @@ func (client *ExportPipelinesClient) deleteCreateRequest(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-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -202,7 +202,7 @@ func (client *ExportPipelinesClient) deleteCreateRequest(ctx context.Context, re // 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 +// Generated from API version 2023-07-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. @@ -250,7 +250,7 @@ func (client *ExportPipelinesClient) getCreateRequest(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-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -267,7 +267,7 @@ func (client *ExportPipelinesClient) getHandleResponse(resp *http.Response) (Exp // NewListPager - Lists all export pipelines for the specified container registry. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-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 @@ -319,7 +319,7 @@ func (client *ExportPipelinesClient) listCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, 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/archives_server.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/archives_server.go new file mode 100644 index 000000000000..28ddf6b86eaf --- /dev/null +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/archives_server.go @@ -0,0 +1,339 @@ +//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" +) + +// ArchivesServer is a fake server for instances of the armcontainerregistry.ArchivesClient type. +type ArchivesServer struct { + // BeginCreate is the fake for method ArchivesClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreate func(ctx context.Context, resourceGroupName string, registryName string, packageType string, archiveName string, archiveCreateParameters armcontainerregistry.Archive, options *armcontainerregistry.ArchivesClientBeginCreateOptions) (resp azfake.PollerResponder[armcontainerregistry.ArchivesClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method ArchivesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, registryName string, packageType string, archiveName string, options *armcontainerregistry.ArchivesClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerregistry.ArchivesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ArchivesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, registryName string, packageType string, archiveName string, options *armcontainerregistry.ArchivesClientGetOptions) (resp azfake.Responder[armcontainerregistry.ArchivesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method ArchivesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, registryName string, packageType string, options *armcontainerregistry.ArchivesClientListOptions) (resp azfake.PagerResponder[armcontainerregistry.ArchivesClientListResponse]) + + // Update is the fake for method ArchivesClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, registryName string, packageType string, archiveName string, archiveUpdateParameters armcontainerregistry.ArchiveUpdateParameters, options *armcontainerregistry.ArchivesClientUpdateOptions) (resp azfake.Responder[armcontainerregistry.ArchivesClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewArchivesServerTransport creates a new instance of ArchivesServerTransport with the provided implementation. +// The returned ArchivesServerTransport instance is connected to an instance of armcontainerregistry.ArchivesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewArchivesServerTransport(srv *ArchivesServer) *ArchivesServerTransport { + return &ArchivesServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armcontainerregistry.ArchivesClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armcontainerregistry.ArchivesClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armcontainerregistry.ArchivesClientListResponse]](), + } +} + +// ArchivesServerTransport connects instances of armcontainerregistry.ArchivesClient to instances of ArchivesServer. +// Don't use this type directly, use NewArchivesServerTransport instead. +type ArchivesServerTransport struct { + srv *ArchivesServer + beginCreate *tracker[azfake.PollerResponder[armcontainerregistry.ArchivesClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armcontainerregistry.ArchivesClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armcontainerregistry.ArchivesClientListResponse]] +} + +// Do implements the policy.Transporter interface for ArchivesServerTransport. +func (a *ArchivesServerTransport) 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 "ArchivesClient.BeginCreate": + resp, err = a.dispatchBeginCreate(req) + case "ArchivesClient.BeginDelete": + resp, err = a.dispatchBeginDelete(req) + case "ArchivesClient.Get": + resp, err = a.dispatchGet(req) + case "ArchivesClient.NewListPager": + resp, err = a.dispatchNewListPager(req) + case "ArchivesClient.Update": + resp, err = a.dispatchUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (a *ArchivesServerTransport) 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~%@]+)/packages/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/archives/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.Archive](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 + } + packageTypeUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("packageType")]) + if err != nil { + return nil, err + } + archiveNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("archiveName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginCreate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, packageTypeUnescaped, archiveNameUnescaped, 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 *ArchivesServerTransport) 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~%@]+)/packages/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/archives/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + 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 + } + packageTypeUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("packageType")]) + if err != nil { + return nil, err + } + archiveNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("archiveName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginDelete(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, packageTypeUnescaped, archiveNameUnescaped, 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.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + a.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) { + a.beginDelete.remove(req) + } + + return resp, nil +} + +func (a *ArchivesServerTransport) 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~%@]+)/packages/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/archives/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + 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 + } + packageTypeUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("packageType")]) + if err != nil { + return nil, err + } + archiveNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("archiveName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, packageTypeUnescaped, archiveNameUnescaped, 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).Archive, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *ArchivesServerTransport) 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~%@]+)/packages/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/archives` + 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 + } + packageTypeUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("packageType")]) + if err != nil { + return nil, err + } + resp := a.srv.NewListPager(resourceGroupNameUnescaped, registryNameUnescaped, packageTypeUnescaped, nil) + newListPager = &resp + a.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcontainerregistry.ArchivesClientListResponse, 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 *ArchivesServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if a.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update 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~%@]+)/packages/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/archives/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.ArchiveUpdateParameters](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 + } + packageTypeUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("packageType")]) + if err != nil { + return nil, err + } + archiveNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("archiveName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Update(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, packageTypeUnescaped, archiveNameUnescaped, 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).Archive, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/archiveversions_server.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/archiveversions_server.go new file mode 100644 index 000000000000..8e9578edf594 --- /dev/null +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/archiveversions_server.go @@ -0,0 +1,300 @@ +//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" +) + +// ArchiveVersionsServer is a fake server for instances of the armcontainerregistry.ArchiveVersionsClient type. +type ArchiveVersionsServer struct { + // BeginCreate is the fake for method ArchiveVersionsClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreate func(ctx context.Context, resourceGroupName string, registryName string, packageType string, archiveName string, archiveVersionName string, options *armcontainerregistry.ArchiveVersionsClientBeginCreateOptions) (resp azfake.PollerResponder[armcontainerregistry.ArchiveVersionsClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method ArchiveVersionsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, registryName string, packageType string, archiveName string, archiveVersionName string, options *armcontainerregistry.ArchiveVersionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerregistry.ArchiveVersionsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ArchiveVersionsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, registryName string, packageType string, archiveName string, archiveVersionName string, options *armcontainerregistry.ArchiveVersionsClientGetOptions) (resp azfake.Responder[armcontainerregistry.ArchiveVersionsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method ArchiveVersionsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, registryName string, packageType string, archiveName string, options *armcontainerregistry.ArchiveVersionsClientListOptions) (resp azfake.PagerResponder[armcontainerregistry.ArchiveVersionsClientListResponse]) +} + +// NewArchiveVersionsServerTransport creates a new instance of ArchiveVersionsServerTransport with the provided implementation. +// The returned ArchiveVersionsServerTransport instance is connected to an instance of armcontainerregistry.ArchiveVersionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewArchiveVersionsServerTransport(srv *ArchiveVersionsServer) *ArchiveVersionsServerTransport { + return &ArchiveVersionsServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armcontainerregistry.ArchiveVersionsClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armcontainerregistry.ArchiveVersionsClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armcontainerregistry.ArchiveVersionsClientListResponse]](), + } +} + +// ArchiveVersionsServerTransport connects instances of armcontainerregistry.ArchiveVersionsClient to instances of ArchiveVersionsServer. +// Don't use this type directly, use NewArchiveVersionsServerTransport instead. +type ArchiveVersionsServerTransport struct { + srv *ArchiveVersionsServer + beginCreate *tracker[azfake.PollerResponder[armcontainerregistry.ArchiveVersionsClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armcontainerregistry.ArchiveVersionsClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armcontainerregistry.ArchiveVersionsClientListResponse]] +} + +// Do implements the policy.Transporter interface for ArchiveVersionsServerTransport. +func (a *ArchiveVersionsServerTransport) 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 "ArchiveVersionsClient.BeginCreate": + resp, err = a.dispatchBeginCreate(req) + case "ArchiveVersionsClient.BeginDelete": + resp, err = a.dispatchBeginDelete(req) + case "ArchiveVersionsClient.Get": + resp, err = a.dispatchGet(req) + case "ArchiveVersionsClient.NewListPager": + resp, err = a.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (a *ArchiveVersionsServerTransport) 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~%@]+)/packages/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/archives/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/versions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 6 { + 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 + } + packageTypeUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("packageType")]) + if err != nil { + return nil, err + } + archiveNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("archiveName")]) + if err != nil { + return nil, err + } + archiveVersionNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("archiveVersionName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginCreate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, packageTypeUnescaped, archiveNameUnescaped, archiveVersionNameUnescaped, 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 *ArchiveVersionsServerTransport) 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~%@]+)/packages/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/archives/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/versions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 6 { + 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 + } + packageTypeUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("packageType")]) + if err != nil { + return nil, err + } + archiveNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("archiveName")]) + if err != nil { + return nil, err + } + archiveVersionNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("archiveVersionName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginDelete(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, packageTypeUnescaped, archiveNameUnescaped, archiveVersionNameUnescaped, 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.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + a.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) { + a.beginDelete.remove(req) + } + + return resp, nil +} + +func (a *ArchiveVersionsServerTransport) 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~%@]+)/packages/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/archives/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/versions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 6 { + 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 + } + packageTypeUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("packageType")]) + if err != nil { + return nil, err + } + archiveNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("archiveName")]) + if err != nil { + return nil, err + } + archiveVersionNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("archiveVersionName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, packageTypeUnescaped, archiveNameUnescaped, archiveVersionNameUnescaped, 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).ArchiveVersion, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *ArchiveVersionsServerTransport) 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~%@]+)/packages/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/archives/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/versions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + 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 + } + packageTypeUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("packageType")]) + if err != nil { + return nil, err + } + archiveNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("archiveName")]) + if err != nil { + return nil, err + } + resp := a.srv.NewListPager(resourceGroupNameUnescaped, registryNameUnescaped, packageTypeUnescaped, archiveNameUnescaped, nil) + newListPager = &resp + a.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcontainerregistry.ArchiveVersionsClientListResponse, 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 +} 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/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/go.mod b/sdk/resourcemanager/containerregistry/armcontainerregistry/go.mod index 7475306a0b93..53ee4067fdc1 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/go.mod +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/go.mod @@ -4,12 +4,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/resourcemanager/internal v1.1.2 github.com/stretchr/testify v1.7.0 ) require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 // indirect 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 diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/importpipelines_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/importpipelines_client.go index 9f586ca37df7..f62a0fd75243 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/importpipelines_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/importpipelines_client.go @@ -46,7 +46,7 @@ func NewImportPipelinesClient(subscriptionID string, credential azcore.TokenCred // 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 +// Generated from API version 2023-07-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. @@ -71,7 +71,7 @@ func (client *ImportPipelinesClient) BeginCreate(ctx context.Context, resourceGr // 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 +// Generated from API version 2023-07-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" @@ -114,7 +114,7 @@ func (client *ImportPipelinesClient) createCreateRequest(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-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, importPipelineCreateParameters); err != nil { @@ -126,7 +126,7 @@ func (client *ImportPipelinesClient) createCreateRequest(ctx context.Context, re // 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 +// Generated from API version 2023-07-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. @@ -150,7 +150,7 @@ func (client *ImportPipelinesClient) BeginDelete(ctx context.Context, resourceGr // 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 +// Generated from API version 2023-07-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" @@ -193,7 +193,7 @@ func (client *ImportPipelinesClient) deleteCreateRequest(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-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -202,7 +202,7 @@ func (client *ImportPipelinesClient) deleteCreateRequest(ctx context.Context, re // 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 +// Generated from API version 2023-07-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. @@ -250,7 +250,7 @@ func (client *ImportPipelinesClient) getCreateRequest(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-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -267,7 +267,7 @@ func (client *ImportPipelinesClient) getHandleResponse(resp *http.Response) (Imp // NewListPager - Lists all import pipelines for the specified container registry. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-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 @@ -319,7 +319,7 @@ func (client *ImportPipelinesClient) listCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, 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..db47fd76af48 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/models.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/models.go @@ -111,6 +111,108 @@ type AgentProperties struct { CPU *int32 } +// Archive - An object that represents a archive for a container registry. +type Archive struct { + // The properties of the archive. + Properties *ArchiveProperties + + // 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 +} + +// ArchiveListResult - The result of a request to list archives for a container registry. +type ArchiveListResult struct { + // The URI that can be used to request the next list of archives. + NextLink *string + + // The list of archives. Since this list may be incomplete, the nextLink field should be used to request the next list of + // distributions. + Value []*Archive +} + +// ArchivePackageSourceProperties - The properties of the archive package source. +type ArchivePackageSourceProperties struct { + // The type of package source for a archive. + Type *PackageSourceType + + // The external repository url. + URL *string +} + +// ArchiveProperties - The properties of a archive. +type ArchiveProperties struct { + // The package source of the archive. + PackageSource *ArchivePackageSourceProperties + + // The published version of the archive. + PublishedVersion *string + RepositoryEndpointPrefix *string + + // READ-ONLY; The provisioning state of the archive at the time the operation was called. + ProvisioningState *ProvisioningState + + // READ-ONLY + RepositoryEndpoint *string +} + +// ArchiveUpdateParameters - The parameters for updating a archive. +type ArchiveUpdateParameters struct { + // The properties of the connected registry update parameters. + Properties *ArchiveUpdateProperties +} + +// ArchiveUpdateProperties - The properties of a archive. +type ArchiveUpdateProperties struct { + // The published version of the archive. + PublishedVersion *string +} + +// ArchiveVersion - An object that represents an export pipeline for a container registry. +type ArchiveVersion struct { + // The properties of the archive. + Properties *ArchiveVersionProperties + + // 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 +} + +// ArchiveVersionListResult - The result of a request to list export pipelines for a container registry. +type ArchiveVersionListResult 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 []*ArchiveVersion +} + +// ArchiveVersionProperties - The properties of an export pipeline. +type ArchiveVersionProperties struct { + // The detailed error message for the archive version in the case of failure. + ArchiveVersionErrorMessage *string + + // READ-ONLY; The provisioning state of the archive at the time the operation was called. + ProvisioningState *ProvisioningState +} + // Argument - The properties of a run argument. type Argument struct { // REQUIRED; The name of the argument. @@ -489,6 +591,37 @@ type CustomRegistryCredentials struct { UserName *SecretObject } +// DebianArchivePackageSourceProperties - The properties of the archive package source. +type DebianArchivePackageSourceProperties struct { + // Upstream Debian distribution Name. + DistributionName *string + + // The type of package source for a archive. + Type *PackageSourceType + + // The external repository url. + URL *string +} + +// DebianArchiveProperties - The properties of the Debian package Archive. +type DebianArchiveProperties struct { + // Debian distribution Name. + DistributionName *string + + // The package source of the archive. + PackageSource *ArchivePackageSourceProperties + + // The published version of the archive. + PublishedVersion *string + RepositoryEndpointPrefix *string + + // READ-ONLY; The provisioning state of the archive at the time the operation was called. + ProvisioningState *ProvisioningState + + // READ-ONLY + RepositoryEndpoint *string +} + // DockerBuildRequest - The parameters for a docker quick build. type DockerBuildRequest struct { // REQUIRED; The Docker file path relative to the source location. @@ -752,10 +885,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 +934,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. @@ -1074,12 +1241,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 +1248,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. @@ -2955,10 +3122,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..41c4864e09b5 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/models_serde.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/models_serde.go @@ -337,6 +337,313 @@ func (a *AgentProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Archive. +func (a Archive) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Archive. +func (a *Archive) 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 "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + 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 ArchiveListResult. +func (a ArchiveListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ArchiveListResult. +func (a *ArchiveListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + 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 ArchivePackageSourceProperties. +func (a ArchivePackageSourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "type", a.Type) + populate(objectMap, "url", a.URL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ArchivePackageSourceProperties. +func (a *ArchivePackageSourceProperties) 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 "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + case "url": + err = unpopulate(val, "URL", &a.URL) + 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 ArchiveProperties. +func (a ArchiveProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "packageSource", a.PackageSource) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "publishedVersion", a.PublishedVersion) + populate(objectMap, "repositoryEndpoint", a.RepositoryEndpoint) + populate(objectMap, "repositoryEndpointPrefix", a.RepositoryEndpointPrefix) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ArchiveProperties. +func (a *ArchiveProperties) 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 "packageSource": + err = unpopulate(val, "PackageSource", &a.PackageSource) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "publishedVersion": + err = unpopulate(val, "PublishedVersion", &a.PublishedVersion) + delete(rawMsg, key) + case "repositoryEndpoint": + err = unpopulate(val, "RepositoryEndpoint", &a.RepositoryEndpoint) + delete(rawMsg, key) + case "repositoryEndpointPrefix": + err = unpopulate(val, "RepositoryEndpointPrefix", &a.RepositoryEndpointPrefix) + 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 ArchiveUpdateParameters. +func (a ArchiveUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", a.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ArchiveUpdateParameters. +func (a *ArchiveUpdateParameters) 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 "properties": + err = unpopulate(val, "Properties", &a.Properties) + 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 ArchiveUpdateProperties. +func (a ArchiveUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "publishedVersion", a.PublishedVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ArchiveUpdateProperties. +func (a *ArchiveUpdateProperties) 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 "publishedVersion": + err = unpopulate(val, "PublishedVersion", &a.PublishedVersion) + 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 ArchiveVersion. +func (a ArchiveVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ArchiveVersion. +func (a *ArchiveVersion) 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 "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + 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 ArchiveVersionListResult. +func (a ArchiveVersionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ArchiveVersionListResult. +func (a *ArchiveVersionListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + 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 ArchiveVersionProperties. +func (a ArchiveVersionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "archiveVersionErrorMessage", a.ArchiveVersionErrorMessage) + populate(objectMap, "provisioningState", a.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ArchiveVersionProperties. +func (a *ArchiveVersionProperties) 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 "archiveVersionErrorMessage": + err = unpopulate(val, "ArchiveVersionErrorMessage", &a.ArchiveVersionErrorMessage) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + 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 Argument. func (a Argument) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1342,6 +1649,88 @@ func (c *CustomRegistryCredentials) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type DebianArchivePackageSourceProperties. +func (d DebianArchivePackageSourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "distributionName", d.DistributionName) + populate(objectMap, "type", d.Type) + populate(objectMap, "url", d.URL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DebianArchivePackageSourceProperties. +func (d *DebianArchivePackageSourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "distributionName": + err = unpopulate(val, "DistributionName", &d.DistributionName) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + case "url": + err = unpopulate(val, "URL", &d.URL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DebianArchiveProperties. +func (d DebianArchiveProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "distributionName", d.DistributionName) + populate(objectMap, "packageSource", d.PackageSource) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "publishedVersion", d.PublishedVersion) + populate(objectMap, "repositoryEndpoint", d.RepositoryEndpoint) + populate(objectMap, "repositoryEndpointPrefix", d.RepositoryEndpointPrefix) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DebianArchiveProperties. +func (d *DebianArchiveProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "distributionName": + err = unpopulate(val, "DistributionName", &d.DistributionName) + delete(rawMsg, key) + case "packageSource": + err = unpopulate(val, "PackageSource", &d.PackageSource) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + case "publishedVersion": + err = unpopulate(val, "PublishedVersion", &d.PublishedVersion) + delete(rawMsg, key) + case "repositoryEndpoint": + err = unpopulate(val, "RepositoryEndpoint", &d.RepositoryEndpoint) + delete(rawMsg, key) + case "repositoryEndpointPrefix": + err = unpopulate(val, "RepositoryEndpointPrefix", &d.RepositoryEndpointPrefix) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type DockerBuildRequest. func (d DockerBuildRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1747,6 +2136,80 @@ 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) @@ -1813,6 +2276,33 @@ func (e *ErrorResponseBody) UnmarshalJSON(data []byte) error { 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) @@ -7732,6 +8222,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..84db58af8f53 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-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -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-preview") 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 deleted file mode 100644 index b7c60317b641..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/operations_client_example_test.go +++ /dev/null @@ -1,55 +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/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/OperationList.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armcontainerregistry.OperationListResult{ - // Value: []*armcontainerregistry.OperationDefinition{ - // { - // Name: to.Ptr("Microsoft.ContainerRegistry/locations/deleteVirtualNetworkOrSubnets/action"), - // Display: &armcontainerregistry.OperationDisplayDefinition{ - // Description: to.Ptr("Notifies Microsoft.ContainerRegistry that virtual network or subnet is being deleted"), - // Operation: to.Ptr("Delete virtual network or subnets notifications"), - // Provider: to.Ptr("Microsoft ContainerRegistry"), - // Resource: to.Ptr(""), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/options.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/options.go index 1ea8a0f2fb24..11dc1c99ab0d 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/options.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/options.go @@ -41,6 +41,55 @@ type AgentPoolsClientListOptions struct { // placeholder for future optional parameters } +// ArchiveVersionsClientBeginCreateOptions contains the optional parameters for the ArchiveVersionsClient.BeginCreate method. +type ArchiveVersionsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ArchiveVersionsClientBeginDeleteOptions contains the optional parameters for the ArchiveVersionsClient.BeginDelete method. +type ArchiveVersionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ArchiveVersionsClientGetOptions contains the optional parameters for the ArchiveVersionsClient.Get method. +type ArchiveVersionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ArchiveVersionsClientListOptions contains the optional parameters for the ArchiveVersionsClient.NewListPager method. +type ArchiveVersionsClientListOptions struct { + // placeholder for future optional parameters +} + +// ArchivesClientBeginCreateOptions contains the optional parameters for the ArchivesClient.BeginCreate method. +type ArchivesClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ArchivesClientBeginDeleteOptions contains the optional parameters for the ArchivesClient.BeginDelete method. +type ArchivesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ArchivesClientGetOptions contains the optional parameters for the ArchivesClient.Get method. +type ArchivesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ArchivesClientListOptions contains the optional parameters for the ArchivesClient.NewListPager method. +type ArchivesClientListOptions struct { + // placeholder for future optional parameters +} + +// ArchivesClientUpdateOptions contains the optional parameters for the ArchivesClient.Update method. +type ArchivesClientUpdateOptions struct { + // placeholder for future optional parameters +} + // CacheRulesClientBeginCreateOptions contains the optional parameters for the CacheRulesClient.BeginCreate method. type CacheRulesClientBeginCreateOptions struct { // Resumes the LRO from the provided token. diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/pipelineruns_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/pipelineruns_client.go index 142b438a75bc..5116c473823a 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/pipelineruns_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/pipelineruns_client.go @@ -46,7 +46,7 @@ func NewPipelineRunsClient(subscriptionID string, credential azcore.TokenCredent // 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 +// Generated from API version 2023-07-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. @@ -71,7 +71,7 @@ func (client *PipelineRunsClient) BeginCreate(ctx context.Context, resourceGroup // 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 +// Generated from API version 2023-07-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" @@ -114,7 +114,7 @@ func (client *PipelineRunsClient) 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-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, pipelineRunCreateParameters); err != nil { @@ -126,7 +126,7 @@ func (client *PipelineRunsClient) createCreateRequest(ctx context.Context, resou // 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 +// Generated from API version 2023-07-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. @@ -150,7 +150,7 @@ func (client *PipelineRunsClient) BeginDelete(ctx context.Context, resourceGroup // 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 +// Generated from API version 2023-07-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" @@ -193,7 +193,7 @@ func (client *PipelineRunsClient) 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-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -202,7 +202,7 @@ func (client *PipelineRunsClient) deleteCreateRequest(ctx context.Context, resou // 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 +// Generated from API version 2023-07-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. @@ -250,7 +250,7 @@ func (client *PipelineRunsClient) 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-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -267,7 +267,7 @@ func (client *PipelineRunsClient) getHandleResponse(resp *http.Response) (Pipeli // NewListPager - Lists all the pipeline runs for the specified container registry. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-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. @@ -318,7 +318,7 @@ func (client *PipelineRunsClient) 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-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, 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..2d97031fcebb 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-preview // - 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-preview 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-preview") 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-preview // - 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-preview 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-preview") 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-preview // - 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-preview") 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-preview // - 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-preview") 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 deleted file mode 100644 index 5da6c619f819..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_client_example_test.go +++ /dev/null @@ -1,167 +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/PrivateEndpointConnectionList.json -func ExamplePrivateEndpointConnectionsClient_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.NewPrivateEndpointConnectionsClient().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.PrivateEndpointConnectionListResult = armcontainerregistry.PrivateEndpointConnectionListResult{ - // Value: []*armcontainerregistry.PrivateEndpointConnection{ - // { - // Name: to.Ptr("myConnection"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/privateEndpointConnections/myConnection"), - // Properties: &armcontainerregistry.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armcontainerregistry.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/peexample01"), - // }, - // PrivateLinkServiceConnectionState: &armcontainerregistry.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr(armcontainerregistry.ActionsRequiredNone), - // Status: to.Ptr(armcontainerregistry.ConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// 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 -func ExamplePrivateEndpointConnectionsClient_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.NewPrivateEndpointConnectionsClient().Get(ctx, "myResourceGroup", "myRegistry", "myConnection", 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.PrivateEndpointConnection = armcontainerregistry.PrivateEndpointConnection{ - // Name: to.Ptr("myConnection"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/privateEndpointConnections/myConnection"), - // Properties: &armcontainerregistry.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armcontainerregistry.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/peexample01"), - // }, - // PrivateLinkServiceConnectionState: &armcontainerregistry.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr(armcontainerregistry.ActionsRequiredNone), - // Status: to.Ptr(armcontainerregistry.ConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // }, - // } -} - -// 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 -func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { - 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.NewPrivateEndpointConnectionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myRegistry", "myConnection", armcontainerregistry.PrivateEndpointConnection{ - Properties: &armcontainerregistry.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armcontainerregistry.PrivateLinkServiceConnectionState{ - Description: to.Ptr("Auto-Approved"), - Status: to.Ptr(armcontainerregistry.ConnectionStatusApproved), - }, - }, - }, 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.PrivateEndpointConnection = armcontainerregistry.PrivateEndpointConnection{ - // Name: to.Ptr("myConnection"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/privateEndpointConnections/myConnection"), - // Properties: &armcontainerregistry.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armcontainerregistry.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/peexample01"), - // }, - // PrivateLinkServiceConnectionState: &armcontainerregistry.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr(armcontainerregistry.ActionsRequiredNone), - // Status: to.Ptr(armcontainerregistry.ConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // }, - // } -} - -// 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 -func ExamplePrivateEndpointConnectionsClient_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.NewPrivateEndpointConnectionsClient().BeginDelete(ctx, "myResourceGroup", "myRegistry", "myConnection", 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/registries_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/registries_client.go index 9221d6f8b7d1..132eeced953c 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-preview // - 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-preview") 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-preview // - 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-preview 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-preview") 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-preview // - 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-preview 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-preview") 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-preview // - 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-preview 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-preview") 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-preview // - 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-preview") 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-preview // - 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-preview") 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-preview // - 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-preview 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-preview") 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-preview // - 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-preview") 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-preview // - 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-preview") 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-preview // - 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-preview") 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-preview // - 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-preview") 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-preview // - 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-preview") 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-preview // - 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-preview") 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-preview // - 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-preview 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-preview") 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 deleted file mode 100644 index 9b0992bca8d8..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/registries_client_example_test.go +++ /dev/null @@ -1,1389 +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" - - "time" - - "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/ImportImageByManifestDigest.json -func ExampleRegistriesClient_BeginImportImage_importImageByManifestDigest() { - 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.NewRegistriesClient().BeginImportImage(ctx, "myResourceGroup", "myRegistry", armcontainerregistry.ImportImageParameters{ - Mode: to.Ptr(armcontainerregistry.ImportModeForce), - Source: &armcontainerregistry.ImportSource{ - ResourceID: to.Ptr("/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/sourceResourceGroup/providers/Microsoft.ContainerRegistry/registries/sourceRegistry"), - SourceImage: to.Ptr("sourceRepository@sha256:0000000000000000000000000000000000000000000000000000000000000000"), - }, - TargetTags: []*string{ - to.Ptr("targetRepository:targetTag")}, - UntaggedTargetRepositories: []*string{ - to.Ptr("targetRepository1")}, - }, 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/ImportImageByTag.json -func ExampleRegistriesClient_BeginImportImage_importImageByTag() { - 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.NewRegistriesClient().BeginImportImage(ctx, "myResourceGroup", "myRegistry", armcontainerregistry.ImportImageParameters{ - Mode: to.Ptr(armcontainerregistry.ImportModeForce), - Source: &armcontainerregistry.ImportSource{ - ResourceID: to.Ptr("/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/sourceResourceGroup/providers/Microsoft.ContainerRegistry/registries/sourceRegistry"), - SourceImage: to.Ptr("sourceRepository:sourceTag"), - }, - TargetTags: []*string{ - to.Ptr("targetRepository:targetTag")}, - UntaggedTargetRepositories: []*string{ - to.Ptr("targetRepository1")}, - }, 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/ImportImageFromPublicRegistry.json -func ExampleRegistriesClient_BeginImportImage_importImageFromPublicRegistry() { - 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.NewRegistriesClient().BeginImportImage(ctx, "myResourceGroup", "myRegistry", armcontainerregistry.ImportImageParameters{ - Mode: to.Ptr(armcontainerregistry.ImportModeForce), - Source: &armcontainerregistry.ImportSource{ - RegistryURI: to.Ptr("registry.hub.docker.com"), - SourceImage: to.Ptr("library/hello-world"), - }, - TargetTags: []*string{ - to.Ptr("targetRepository:targetTag")}, - UntaggedTargetRepositories: []*string{ - to.Ptr("targetRepository1")}, - }, 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/RegistryCheckNameAvailable.json -func ExampleRegistriesClient_CheckNameAvailability_registryCheckNameAvailable() { - 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.NewRegistriesClient().CheckNameAvailability(ctx, armcontainerregistry.RegistryNameCheckRequest{ - Name: to.Ptr("myRegistry"), - Type: to.Ptr("Microsoft.ContainerRegistry/registries"), - }, 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.RegistryNameStatus = armcontainerregistry.RegistryNameStatus{ - // NameAvailable: to.Ptr(true), - // } -} - -// 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 -func ExampleRegistriesClient_CheckNameAvailability_registryCheckNameNotAvailable() { - 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.NewRegistriesClient().CheckNameAvailability(ctx, armcontainerregistry.RegistryNameCheckRequest{ - Name: to.Ptr("myRegistry"), - Type: to.Ptr("Microsoft.ContainerRegistry/registries"), - }, 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.RegistryNameStatus = armcontainerregistry.RegistryNameStatus{ - // Message: to.Ptr("The registry myRegistry is already in use."), - // NameAvailable: to.Ptr(false), - // Reason: to.Ptr("AlreadyExists"), - // } -} - -// 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 -func ExampleRegistriesClient_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.NewRegistriesClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RegistryListResult = armcontainerregistry.RegistryListResult{ - // Value: []*armcontainerregistry.Registry{ - // { - // Name: to.Ptr("myRegistry"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // 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{ - // }, - // Encryption: &armcontainerregistry.EncryptionProperty{ - // Status: to.Ptr(armcontainerregistry.EncryptionStatusDisabled), - // }, - // LoginServer: to.Ptr("myRegistry.azurecr-test.io"), - // NetworkRuleBypassOptions: to.Ptr(armcontainerregistry.NetworkRuleBypassOptionsAzureServices), - // NetworkRuleSet: &armcontainerregistry.NetworkRuleSet{ - // DefaultAction: to.Ptr(armcontainerregistry.DefaultActionAllow), - // IPRules: []*armcontainerregistry.IPRule{ - // }, - // }, - // Policies: &armcontainerregistry.Policies{ - // ExportPolicy: &armcontainerregistry.ExportPolicy{ - // Status: to.Ptr(armcontainerregistry.ExportPolicyStatusEnabled), - // }, - // QuarantinePolicy: &armcontainerregistry.QuarantinePolicy{ - // Status: to.Ptr(armcontainerregistry.PolicyStatusDisabled), - // }, - // RetentionPolicy: &armcontainerregistry.RetentionPolicy{ - // Days: to.Ptr[int32](7), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-15T21:40:12.8506835+00:00"); return t}()), - // Status: to.Ptr(armcontainerregistry.PolicyStatusDisabled), - // }, - // TrustPolicy: &armcontainerregistry.TrustPolicy{ - // Type: to.Ptr(armcontainerregistry.TrustPolicyTypeNotary), - // Status: to.Ptr(armcontainerregistry.PolicyStatusDisabled), - // }, - // }, - // PrivateEndpointConnections: []*armcontainerregistry.PrivateEndpointConnection{ - // }, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armcontainerregistry.PublicNetworkAccessEnabled), - // ZoneRedundancy: to.Ptr(armcontainerregistry.ZoneRedundancyDisabled), - // }, - // SKU: &armcontainerregistry.SKU{ - // Name: to.Ptr(armcontainerregistry.SKUNameStandard), - // Tier: to.Ptr(armcontainerregistry.SKUTierStandard), - // }, - // }}, - // } - } -} - -// 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 -func ExampleRegistriesClient_NewListByResourceGroupPager() { - 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.NewRegistriesClient().NewListByResourceGroupPager("myResourceGroup", 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.RegistryListResult = armcontainerregistry.RegistryListResult{ - // Value: []*armcontainerregistry.Registry{ - // { - // Name: to.Ptr("myRegistry"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // 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{ - // }, - // Encryption: &armcontainerregistry.EncryptionProperty{ - // Status: to.Ptr(armcontainerregistry.EncryptionStatusDisabled), - // }, - // LoginServer: to.Ptr("myRegistry.azurecr-test.io"), - // NetworkRuleBypassOptions: to.Ptr(armcontainerregistry.NetworkRuleBypassOptionsAzureServices), - // NetworkRuleSet: &armcontainerregistry.NetworkRuleSet{ - // DefaultAction: to.Ptr(armcontainerregistry.DefaultActionAllow), - // IPRules: []*armcontainerregistry.IPRule{ - // }, - // }, - // Policies: &armcontainerregistry.Policies{ - // ExportPolicy: &armcontainerregistry.ExportPolicy{ - // Status: to.Ptr(armcontainerregistry.ExportPolicyStatusEnabled), - // }, - // QuarantinePolicy: &armcontainerregistry.QuarantinePolicy{ - // Status: to.Ptr(armcontainerregistry.PolicyStatusDisabled), - // }, - // RetentionPolicy: &armcontainerregistry.RetentionPolicy{ - // Days: to.Ptr[int32](7), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-15T21:40:12.8506835+00:00"); return t}()), - // Status: to.Ptr(armcontainerregistry.PolicyStatusDisabled), - // }, - // TrustPolicy: &armcontainerregistry.TrustPolicy{ - // Type: to.Ptr(armcontainerregistry.TrustPolicyTypeNotary), - // Status: to.Ptr(armcontainerregistry.PolicyStatusDisabled), - // }, - // }, - // PrivateEndpointConnections: []*armcontainerregistry.PrivateEndpointConnection{ - // }, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armcontainerregistry.PublicNetworkAccessEnabled), - // ZoneRedundancy: to.Ptr(armcontainerregistry.ZoneRedundancyDisabled), - // }, - // SKU: &armcontainerregistry.SKU{ - // Name: to.Ptr(armcontainerregistry.SKUNameStandard), - // Tier: to.Ptr(armcontainerregistry.SKUTierStandard), - // }, - // }}, - // } - } -} - -// 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 -func ExampleRegistriesClient_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.NewRegistriesClient().Get(ctx, "myResourceGroup", "myRegistry", 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.Registry = armcontainerregistry.Registry{ - // Name: to.Ptr("myRegistry"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // 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{ - // }, - // Encryption: &armcontainerregistry.EncryptionProperty{ - // Status: to.Ptr(armcontainerregistry.EncryptionStatusDisabled), - // }, - // LoginServer: to.Ptr("myRegistry.azurecr-test.io"), - // NetworkRuleBypassOptions: to.Ptr(armcontainerregistry.NetworkRuleBypassOptionsAzureServices), - // NetworkRuleSet: &armcontainerregistry.NetworkRuleSet{ - // DefaultAction: to.Ptr(armcontainerregistry.DefaultActionAllow), - // IPRules: []*armcontainerregistry.IPRule{ - // }, - // }, - // Policies: &armcontainerregistry.Policies{ - // ExportPolicy: &armcontainerregistry.ExportPolicy{ - // Status: to.Ptr(armcontainerregistry.ExportPolicyStatusEnabled), - // }, - // QuarantinePolicy: &armcontainerregistry.QuarantinePolicy{ - // Status: to.Ptr(armcontainerregistry.PolicyStatusDisabled), - // }, - // RetentionPolicy: &armcontainerregistry.RetentionPolicy{ - // Days: to.Ptr[int32](7), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-15T21:40:12.8506835+00:00"); return t}()), - // Status: to.Ptr(armcontainerregistry.PolicyStatusDisabled), - // }, - // TrustPolicy: &armcontainerregistry.TrustPolicy{ - // Type: to.Ptr(armcontainerregistry.TrustPolicyTypeNotary), - // Status: to.Ptr(armcontainerregistry.PolicyStatusDisabled), - // }, - // }, - // PrivateEndpointConnections: []*armcontainerregistry.PrivateEndpointConnection{ - // }, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armcontainerregistry.PublicNetworkAccessEnabled), - // ZoneRedundancy: to.Ptr(armcontainerregistry.ZoneRedundancyDisabled), - // }, - // SKU: &armcontainerregistry.SKU{ - // Name: to.Ptr(armcontainerregistry.SKUNameStandard), - // Tier: to.Ptr(armcontainerregistry.SKUTierStandard), - // }, - // } -} - -// 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 -func ExampleRegistriesClient_BeginCreate_registryCreate() { - 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.NewRegistriesClient().BeginCreate(ctx, "myResourceGroup", "myRegistry", armcontainerregistry.Registry{ - Location: to.Ptr("westus"), - Tags: map[string]*string{ - "key": to.Ptr("value"), - }, - Properties: &armcontainerregistry.RegistryProperties{ - AdminUserEnabled: to.Ptr(true), - }, - SKU: &armcontainerregistry.SKU{ - Name: to.Ptr(armcontainerregistry.SKUNameStandard), - }, - }, 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.Registry = armcontainerregistry.Registry{ - // Name: to.Ptr("myRegistry"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // 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{ - // }, - // Encryption: &armcontainerregistry.EncryptionProperty{ - // Status: to.Ptr(armcontainerregistry.EncryptionStatusDisabled), - // }, - // LoginServer: to.Ptr("myRegistry.azurecr-test.io"), - // NetworkRuleBypassOptions: to.Ptr(armcontainerregistry.NetworkRuleBypassOptionsAzureServices), - // NetworkRuleSet: &armcontainerregistry.NetworkRuleSet{ - // DefaultAction: to.Ptr(armcontainerregistry.DefaultActionAllow), - // IPRules: []*armcontainerregistry.IPRule{ - // }, - // }, - // Policies: &armcontainerregistry.Policies{ - // ExportPolicy: &armcontainerregistry.ExportPolicy{ - // Status: to.Ptr(armcontainerregistry.ExportPolicyStatusEnabled), - // }, - // QuarantinePolicy: &armcontainerregistry.QuarantinePolicy{ - // Status: to.Ptr(armcontainerregistry.PolicyStatusDisabled), - // }, - // RetentionPolicy: &armcontainerregistry.RetentionPolicy{ - // Days: to.Ptr[int32](7), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-15T21:40:12.8506835+00:00"); return t}()), - // Status: to.Ptr(armcontainerregistry.PolicyStatusDisabled), - // }, - // TrustPolicy: &armcontainerregistry.TrustPolicy{ - // Type: to.Ptr(armcontainerregistry.TrustPolicyTypeNotary), - // Status: to.Ptr(armcontainerregistry.PolicyStatusDisabled), - // }, - // }, - // PrivateEndpointConnections: []*armcontainerregistry.PrivateEndpointConnection{ - // }, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armcontainerregistry.PublicNetworkAccessEnabled), - // ZoneRedundancy: to.Ptr(armcontainerregistry.ZoneRedundancyDisabled), - // }, - // SKU: &armcontainerregistry.SKU{ - // Name: to.Ptr(armcontainerregistry.SKUNameStandard), - // Tier: to.Ptr(armcontainerregistry.SKUTierStandard), - // }, - // } -} - -// 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 -func ExampleRegistriesClient_BeginCreate_registryCreateZoneRedundant() { - 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.NewRegistriesClient().BeginCreate(ctx, "myResourceGroup", "myRegistry", armcontainerregistry.Registry{ - Location: to.Ptr("westus"), - Tags: map[string]*string{ - "key": to.Ptr("value"), - }, - Properties: &armcontainerregistry.RegistryProperties{ - ZoneRedundancy: to.Ptr(armcontainerregistry.ZoneRedundancyEnabled), - }, - SKU: &armcontainerregistry.SKU{ - Name: to.Ptr(armcontainerregistry.SKUNameStandard), - }, - }, 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.Registry = armcontainerregistry.Registry{ - // Name: to.Ptr("myRegistry"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // 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{ - // }, - // Encryption: &armcontainerregistry.EncryptionProperty{ - // Status: to.Ptr(armcontainerregistry.EncryptionStatusDisabled), - // }, - // LoginServer: to.Ptr("myRegistry.azurecr-test.io"), - // NetworkRuleBypassOptions: to.Ptr(armcontainerregistry.NetworkRuleBypassOptionsAzureServices), - // NetworkRuleSet: &armcontainerregistry.NetworkRuleSet{ - // DefaultAction: to.Ptr(armcontainerregistry.DefaultActionAllow), - // IPRules: []*armcontainerregistry.IPRule{ - // }, - // }, - // Policies: &armcontainerregistry.Policies{ - // ExportPolicy: &armcontainerregistry.ExportPolicy{ - // Status: to.Ptr(armcontainerregistry.ExportPolicyStatusEnabled), - // }, - // QuarantinePolicy: &armcontainerregistry.QuarantinePolicy{ - // Status: to.Ptr(armcontainerregistry.PolicyStatusDisabled), - // }, - // RetentionPolicy: &armcontainerregistry.RetentionPolicy{ - // Days: to.Ptr[int32](7), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-15T21:40:12.8506835+00:00"); return t}()), - // Status: to.Ptr(armcontainerregistry.PolicyStatusDisabled), - // }, - // TrustPolicy: &armcontainerregistry.TrustPolicy{ - // Type: to.Ptr(armcontainerregistry.TrustPolicyTypeNotary), - // Status: to.Ptr(armcontainerregistry.PolicyStatusDisabled), - // }, - // }, - // PrivateEndpointConnections: []*armcontainerregistry.PrivateEndpointConnection{ - // }, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armcontainerregistry.PublicNetworkAccessEnabled), - // ZoneRedundancy: to.Ptr(armcontainerregistry.ZoneRedundancyEnabled), - // }, - // SKU: &armcontainerregistry.SKU{ - // Name: to.Ptr(armcontainerregistry.SKUNameStandard), - // Tier: to.Ptr(armcontainerregistry.SKUTierStandard), - // }, - // } -} - -// 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 -func ExampleRegistriesClient_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.NewRegistriesClient().BeginDelete(ctx, "myResourceGroup", "myRegistry", 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/RegistryUpdate.json -func ExampleRegistriesClient_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.NewRegistriesClient().BeginUpdate(ctx, "myResourceGroup", "myRegistry", armcontainerregistry.RegistryUpdateParameters{ - Properties: &armcontainerregistry.RegistryPropertiesUpdateParameters{ - AdminUserEnabled: to.Ptr(true), - }, - SKU: &armcontainerregistry.SKU{ - Name: to.Ptr(armcontainerregistry.SKUNameStandard), - }, - Tags: map[string]*string{ - "key": to.Ptr("value"), - }, - }, 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.Registry = armcontainerregistry.Registry{ - // Name: to.Ptr("myRegistry"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // 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{ - // }, - // Encryption: &armcontainerregistry.EncryptionProperty{ - // Status: to.Ptr(armcontainerregistry.EncryptionStatusDisabled), - // }, - // LoginServer: to.Ptr("myRegistry.azurecr-test.io"), - // NetworkRuleBypassOptions: to.Ptr(armcontainerregistry.NetworkRuleBypassOptionsAzureServices), - // NetworkRuleSet: &armcontainerregistry.NetworkRuleSet{ - // DefaultAction: to.Ptr(armcontainerregistry.DefaultActionAllow), - // IPRules: []*armcontainerregistry.IPRule{ - // }, - // }, - // Policies: &armcontainerregistry.Policies{ - // ExportPolicy: &armcontainerregistry.ExportPolicy{ - // Status: to.Ptr(armcontainerregistry.ExportPolicyStatusEnabled), - // }, - // QuarantinePolicy: &armcontainerregistry.QuarantinePolicy{ - // Status: to.Ptr(armcontainerregistry.PolicyStatusDisabled), - // }, - // RetentionPolicy: &armcontainerregistry.RetentionPolicy{ - // Days: to.Ptr[int32](7), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-15T21:40:12.8506835+00:00"); return t}()), - // Status: to.Ptr(armcontainerregistry.PolicyStatusDisabled), - // }, - // TrustPolicy: &armcontainerregistry.TrustPolicy{ - // Type: to.Ptr(armcontainerregistry.TrustPolicyTypeNotary), - // Status: to.Ptr(armcontainerregistry.PolicyStatusDisabled), - // }, - // }, - // PrivateEndpointConnections: []*armcontainerregistry.PrivateEndpointConnection{ - // }, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armcontainerregistry.PublicNetworkAccessEnabled), - // ZoneRedundancy: to.Ptr(armcontainerregistry.ZoneRedundancyDisabled), - // }, - // SKU: &armcontainerregistry.SKU{ - // Name: to.Ptr(armcontainerregistry.SKUNameStandard), - // Tier: to.Ptr(armcontainerregistry.SKUTierStandard), - // }, - // } -} - -// 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 -func ExampleRegistriesClient_ListUsages() { - 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.NewRegistriesClient().ListUsages(ctx, "myResourceGroup", "myRegistry", 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.RegistryUsageListResult = armcontainerregistry.RegistryUsageListResult{ - // Value: []*armcontainerregistry.RegistryUsage{ - // { - // Name: to.Ptr("Size"), - // CurrentValue: to.Ptr[int64](12345678), - // Limit: to.Ptr[int64](107374182400), - // Unit: to.Ptr(armcontainerregistry.RegistryUsageUnitBytes), - // }, - // { - // Name: to.Ptr("Webhooks"), - // CurrentValue: to.Ptr[int64](2), - // Limit: to.Ptr[int64](10), - // Unit: to.Ptr(armcontainerregistry.RegistryUsageUnitCount), - // }}, - // } -} - -// 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 -func ExampleRegistriesClient_NewListPrivateLinkResourcesPager() { - 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.NewRegistriesClient().NewListPrivateLinkResourcesPager("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.PrivateLinkResourceListResult = armcontainerregistry.PrivateLinkResourceListResult{ - // Value: []*armcontainerregistry.PrivateLinkResource{ - // { - // Name: to.Ptr("registry"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/privateLinkResources"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/privateLinkResources/registry"), - // Properties: &armcontainerregistry.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("registry"), - // RequiredMembers: []*string{ - // to.Ptr("registry"), - // to.Ptr("registry_data_myregion")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.azurecr.io")}, - // }, - // }}, - // } - } -} - -// 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 -func ExampleRegistriesClient_GetPrivateLinkResource() { - 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.NewRegistriesClient().GetPrivateLinkResource(ctx, "myResourceGroup", "myRegistry", "registry", 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.PrivateLinkResource = armcontainerregistry.PrivateLinkResource{ - // Name: to.Ptr("registry"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/privateLinkResources"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/privateLinkResources/registry"), - // Properties: &armcontainerregistry.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("registry"), - // RequiredMembers: []*string{ - // to.Ptr("registry"), - // to.Ptr("registry_data_myregion")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.azurecr.io")}, - // }, - // } -} - -// 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 -func ExampleRegistriesClient_ListCredentials() { - 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.NewRegistriesClient().ListCredentials(ctx, "myResourceGroup", "myRegistry", 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.RegistryListCredentialsResult = armcontainerregistry.RegistryListCredentialsResult{ - // Passwords: []*armcontainerregistry.RegistryPassword{ - // { - // Name: to.Ptr(armcontainerregistry.PasswordNamePassword), - // Value: to.Ptr("00000000000000000000000000000000"), - // }, - // { - // Name: to.Ptr(armcontainerregistry.PasswordNamePassword2), - // Value: to.Ptr("00000000000000000000000000000000"), - // }}, - // Username: to.Ptr("myRegistry"), - // } -} - -// 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 -func ExampleRegistriesClient_RegenerateCredential() { - 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.NewRegistriesClient().RegenerateCredential(ctx, "myResourceGroup", "myRegistry", armcontainerregistry.RegenerateCredentialParameters{ - Name: to.Ptr(armcontainerregistry.PasswordNamePassword), - }, 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.RegistryListCredentialsResult = armcontainerregistry.RegistryListCredentialsResult{ - // Passwords: []*armcontainerregistry.RegistryPassword{ - // { - // Name: to.Ptr(armcontainerregistry.PasswordNamePassword), - // Value: to.Ptr("00000000000000000000000000000000"), - // }, - // { - // Name: to.Ptr(armcontainerregistry.PasswordNamePassword2), - // Value: to.Ptr("00000000000000000000000000000000"), - // }}, - // Username: to.Ptr("myRegistry"), - // } -} - -// 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 -func ExampleRegistriesClient_BeginGenerateCredentials() { - 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.NewRegistriesClient().BeginGenerateCredentials(ctx, "myResourceGroup", "myRegistry", armcontainerregistry.GenerateCredentialsParameters{ - Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-31T15:59:59.0707808Z"); return t }()), - TokenID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/myToken"), - }, 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.GenerateCredentialsResult = armcontainerregistry.GenerateCredentialsResult{ - // Passwords: []*armcontainerregistry.TokenPassword{ - // { - // Name: to.Ptr(armcontainerregistry.TokenPasswordNamePassword1), - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-31T15:59:59.0707808Z"); return t}()), - // Value: to.Ptr("00000000000000000000000000000000"), - // }, - // { - // Name: to.Ptr(armcontainerregistry.TokenPasswordNamePassword2), - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-31T15:59:59.0707808Z"); return t}()), - // Value: to.Ptr("00000000000000000000000000000000"), - // }}, - // Username: to.Ptr("myToken"), - // } -} - -// 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 -func ExampleRegistriesClient_BeginScheduleRun_registriesScheduleRun() { - 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.NewRegistriesClient().BeginScheduleRun(ctx, "myResourceGroup", "myRegistry", &armcontainerregistry.DockerBuildRequest{ - Type: to.Ptr("DockerBuildRequest"), - IsArchiveEnabled: to.Ptr(true), - AgentConfiguration: &armcontainerregistry.AgentProperties{ - CPU: to.Ptr[int32](2), - }, - Arguments: []*armcontainerregistry.Argument{ - { - Name: to.Ptr("mytestargument"), - IsSecret: to.Ptr(false), - Value: to.Ptr("mytestvalue"), - }, - { - Name: to.Ptr("mysecrettestargument"), - IsSecret: to.Ptr(true), - Value: to.Ptr("mysecrettestvalue"), - }}, - DockerFilePath: to.Ptr("DockerFile"), - ImageNames: []*string{ - to.Ptr("azurerest:testtag")}, - IsPushEnabled: to.Ptr(true), - NoCache: to.Ptr(true), - Platform: &armcontainerregistry.PlatformProperties{ - Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - OS: to.Ptr(armcontainerregistry.OSLinux), - }, - SourceLocation: to.Ptr("https://myaccount.blob.core.windows.net/sascontainer/source.zip?sv=2015-04-05&st=2015-04-29T22%3A18%3A26Z&se=2015-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=Z%2FRHIX5Xcg0Mq2rqI3OlWTjEg2tYkboXr1P9ZUXDtkk%3D"), - }, 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.Run = armcontainerregistry.Run{ - // Name: to.Ptr("0accec26-d6de-4757-8e74-d080f38eaaab"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/run"), - // ID: to.Ptr("/subscriptions/4385cf00-2d3a-425a-832f-f4285b1c9dce/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/runs/0accec26-d6de-4757-8e74-d080f38eaaab"), - // Properties: &armcontainerregistry.RunProperties{ - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T05:13:51.617Z"); return t}()), - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // RunID: to.Ptr("0accec26-d6de-4757-8e74-d080f38eaaab"), - // Status: to.Ptr(armcontainerregistry.RunStatusSucceeded), - // }, - // } -} - -// 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 -func ExampleRegistriesClient_BeginScheduleRun_registriesScheduleRunEncodedTaskRun() { - 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.NewRegistriesClient().BeginScheduleRun(ctx, "myResourceGroup", "myRegistry", &armcontainerregistry.EncodedTaskRunRequest{ - Type: to.Ptr("EncodedTaskRunRequest"), - AgentConfiguration: &armcontainerregistry.AgentProperties{ - CPU: to.Ptr[int32](2), - }, - EncodedTaskContent: to.Ptr("c3RlcHM6Cnt7IGlmIFZhbHVlcy5lbnZpcm9ubWVudCA9PSAncHJvZCcgfX0KICAtIHJ1bjogcHJvZCBzZXR1cAp7eyBlbHNlIGlmIFZhbHVlcy5lbnZpcm9ubWVudCA9PSAnc3RhZ2luZycgfX0KICAtIHJ1bjogc3RhZ2luZyBzZXR1cAp7eyBlbHNlIH19CiAgLSBydW46IGRlZmF1bHQgc2V0dXAKe3sgZW5kIH19CgogIC0gcnVuOiBidWlsZCAtdCBGYW5jeVRoaW5nOnt7LlZhbHVlcy5lbnZpcm9ubWVudH19LXt7LlZhbHVlcy52ZXJzaW9ufX0gLgoKcHVzaDogWydGYW5jeVRoaW5nOnt7LlZhbHVlcy5lbnZpcm9ubWVudH19LXt7LlZhbHVlcy52ZXJzaW9ufX0nXQ=="), - EncodedValuesContent: to.Ptr("ZW52aXJvbm1lbnQ6IHByb2QKdmVyc2lvbjogMQ=="), - Platform: &armcontainerregistry.PlatformProperties{ - OS: to.Ptr(armcontainerregistry.OSLinux), - }, - Values: []*armcontainerregistry.SetValue{ - { - Name: to.Ptr("mytestargument"), - IsSecret: to.Ptr(false), - Value: to.Ptr("mytestvalue"), - }, - { - Name: to.Ptr("mysecrettestargument"), - IsSecret: to.Ptr(true), - Value: to.Ptr("mysecrettestvalue"), - }}, - }, 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.Run = armcontainerregistry.Run{ - // Name: to.Ptr("0accec26-d6de-4757-8e74-d080f38eaaab"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/run"), - // ID: to.Ptr("/subscriptions/4385cf00-2d3a-425a-832f-f4285b1c9dce/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/runs/0accec26-d6de-4757-8e74-d080f38eaaab"), - // Properties: &armcontainerregistry.RunProperties{ - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T05:13:51.617Z"); return t}()), - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // RunID: to.Ptr("0accec26-d6de-4757-8e74-d080f38eaaab"), - // Status: to.Ptr(armcontainerregistry.RunStatusSucceeded), - // }, - // } -} - -// 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 -func ExampleRegistriesClient_BeginScheduleRun_registriesScheduleRunFileTaskRun() { - 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.NewRegistriesClient().BeginScheduleRun(ctx, "myResourceGroup", "myRegistry", &armcontainerregistry.FileTaskRunRequest{ - Type: to.Ptr("FileTaskRunRequest"), - AgentConfiguration: &armcontainerregistry.AgentProperties{ - CPU: to.Ptr[int32](2), - }, - Platform: &armcontainerregistry.PlatformProperties{ - OS: to.Ptr(armcontainerregistry.OSLinux), - }, - SourceLocation: to.Ptr("https://myaccount.blob.core.windows.net/sascontainer/source.zip?sv=2015-04-05&st=2015-04-29T22%3A18%3A26Z&se=2015-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=Z%2FRHIX5Xcg0Mq2rqI3OlWTjEg2tYkboXr1P9ZUXDtkk%3D"), - TaskFilePath: to.Ptr("acb.yaml"), - Values: []*armcontainerregistry.SetValue{ - { - Name: to.Ptr("mytestargument"), - IsSecret: to.Ptr(false), - Value: to.Ptr("mytestvalue"), - }, - { - Name: to.Ptr("mysecrettestargument"), - IsSecret: to.Ptr(true), - Value: to.Ptr("mysecrettestvalue"), - }}, - ValuesFilePath: to.Ptr("prod-values.yaml"), - }, 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.Run = armcontainerregistry.Run{ - // Name: to.Ptr("0accec26-d6de-4757-8e74-d080f38eaaab"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/run"), - // ID: to.Ptr("/subscriptions/4385cf00-2d3a-425a-832f-f4285b1c9dce/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/runs/0accec26-d6de-4757-8e74-d080f38eaaab"), - // Properties: &armcontainerregistry.RunProperties{ - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T05:13:51.617Z"); return t}()), - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // RunID: to.Ptr("0accec26-d6de-4757-8e74-d080f38eaaab"), - // Status: to.Ptr(armcontainerregistry.RunStatusSucceeded), - // }, - // } -} - -// 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 -func ExampleRegistriesClient_BeginScheduleRun_registriesScheduleRunTask() { - 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.NewRegistriesClient().BeginScheduleRun(ctx, "myResourceGroup", "myRegistry", &armcontainerregistry.TaskRunRequest{ - Type: to.Ptr("TaskRunRequest"), - OverrideTaskStepProperties: &armcontainerregistry.OverrideTaskStepProperties{ - Arguments: []*armcontainerregistry.Argument{ - { - Name: to.Ptr("mytestargument"), - IsSecret: to.Ptr(false), - Value: to.Ptr("mytestvalue"), - }, - { - Name: to.Ptr("mysecrettestargument"), - IsSecret: to.Ptr(true), - Value: to.Ptr("mysecrettestvalue"), - }}, - File: to.Ptr("overriddenDockerfile"), - Target: to.Ptr("build"), - UpdateTriggerToken: to.Ptr("aGVsbG8gd29ybGQ="), - Values: []*armcontainerregistry.SetValue{ - { - Name: to.Ptr("mytestname"), - IsSecret: to.Ptr(false), - Value: to.Ptr("mytestvalue"), - }, - { - Name: to.Ptr("mysecrettestname"), - IsSecret: to.Ptr(true), - Value: to.Ptr("mysecrettestvalue"), - }}, - }, - TaskID: to.Ptr("myTask"), - }, 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.Run = armcontainerregistry.Run{ - // Name: to.Ptr("0accec26-d6de-4757-8e74-d080f38eaaab"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/run"), - // ID: to.Ptr("/subscriptions/4385cf00-2d3a-425a-832f-f4285b1c9dce/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/runs/0accec26-d6de-4757-8e74-d080f38eaaab"), - // Properties: &armcontainerregistry.RunProperties{ - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T05:13:51.617Z"); return t}()), - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // RunID: to.Ptr("0accec26-d6de-4757-8e74-d080f38eaaab"), - // Status: to.Ptr(armcontainerregistry.RunStatusSucceeded), - // }, - // } -} - -// 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 -func ExampleRegistriesClient_BeginScheduleRun_registriesScheduleRunTaskWithCustomCredentials() { - 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.NewRegistriesClient().BeginScheduleRun(ctx, "myResourceGroup", "myRegistry", &armcontainerregistry.FileTaskRunRequest{ - Type: to.Ptr("FileTaskRunRequest"), - Credentials: &armcontainerregistry.Credentials{ - CustomRegistries: map[string]*armcontainerregistry.CustomRegistryCredentials{ - "myregistry.azurecr.io": { - Password: &armcontainerregistry.SecretObject{ - Type: to.Ptr(armcontainerregistry.SecretObjectTypeOpaque), - Value: to.Ptr("***"), - }, - UserName: &armcontainerregistry.SecretObject{ - Type: to.Ptr(armcontainerregistry.SecretObjectTypeOpaque), - Value: to.Ptr("reg1"), - }, - }, - }, - SourceRegistry: &armcontainerregistry.SourceRegistryCredentials{ - LoginMode: to.Ptr(armcontainerregistry.SourceRegistryLoginModeDefault), - }, - }, - Platform: &armcontainerregistry.PlatformProperties{ - OS: to.Ptr(armcontainerregistry.OSLinux), - }, - TaskFilePath: to.Ptr("acb.yaml"), - Values: []*armcontainerregistry.SetValue{ - { - Name: to.Ptr("mytestargument"), - IsSecret: to.Ptr(false), - Value: to.Ptr("mytestvalue"), - }, - { - Name: to.Ptr("mysecrettestargument"), - IsSecret: to.Ptr(true), - Value: to.Ptr("mysecrettestvalue"), - }}, - }, 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.Run = armcontainerregistry.Run{ - // Name: to.Ptr("0accec26-d6de-4757-8e74-d080f38eaaab"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/run"), - // ID: to.Ptr("/subscriptions/4385cf00-2d3a-425a-832f-f4285b1c9dce/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/runs/0accec26-d6de-4757-8e74-d080f38eaaab"), - // Properties: &armcontainerregistry.RunProperties{ - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T05:13:51.617Z"); return t}()), - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // RunID: to.Ptr("0accec26-d6de-4757-8e74-d080f38eaaab"), - // Status: to.Ptr(armcontainerregistry.RunStatusSucceeded), - // }, - // } -} - -// 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 -func ExampleRegistriesClient_BeginScheduleRun_registriesScheduleRunWithCustomCredentials() { - 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.NewRegistriesClient().BeginScheduleRun(ctx, "myResourceGroup", "myRegistry", &armcontainerregistry.DockerBuildRequest{ - Type: to.Ptr("DockerBuildRequest"), - IsArchiveEnabled: to.Ptr(true), - AgentConfiguration: &armcontainerregistry.AgentProperties{ - CPU: to.Ptr[int32](2), - }, - Arguments: []*armcontainerregistry.Argument{ - { - Name: to.Ptr("mytestargument"), - IsSecret: to.Ptr(false), - Value: to.Ptr("mytestvalue"), - }, - { - Name: to.Ptr("mysecrettestargument"), - IsSecret: to.Ptr(true), - Value: to.Ptr("mysecrettestvalue"), - }}, - Credentials: &armcontainerregistry.Credentials{ - CustomRegistries: map[string]*armcontainerregistry.CustomRegistryCredentials{ - "myregistry.azurecr.io": { - Password: &armcontainerregistry.SecretObject{ - Type: to.Ptr(armcontainerregistry.SecretObjectTypeOpaque), - Value: to.Ptr("***"), - }, - UserName: &armcontainerregistry.SecretObject{ - Type: to.Ptr(armcontainerregistry.SecretObjectTypeOpaque), - Value: to.Ptr("reg1"), - }, - }, - "myregistry2.azurecr.io": { - Password: &armcontainerregistry.SecretObject{ - Type: to.Ptr(armcontainerregistry.SecretObjectTypeOpaque), - Value: to.Ptr("***"), - }, - UserName: &armcontainerregistry.SecretObject{ - Type: to.Ptr(armcontainerregistry.SecretObjectTypeOpaque), - Value: to.Ptr("reg2"), - }, - }, - }, - SourceRegistry: &armcontainerregistry.SourceRegistryCredentials{ - LoginMode: to.Ptr(armcontainerregistry.SourceRegistryLoginModeDefault), - }, - }, - DockerFilePath: to.Ptr("DockerFile"), - ImageNames: []*string{ - to.Ptr("azurerest:testtag")}, - IsPushEnabled: to.Ptr(true), - NoCache: to.Ptr(true), - Platform: &armcontainerregistry.PlatformProperties{ - Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - OS: to.Ptr(armcontainerregistry.OSLinux), - }, - SourceLocation: to.Ptr("https://myaccount.blob.core.windows.net/sascontainer/source.zip?sv=2015-04-05&st=2015-04-29T22%3A18%3A26Z&se=2015-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=Z%2FRHIX5Xcg0Mq2rqI3OlWTjEg2tYkboXr1P9ZUXDtkk%3D"), - Target: to.Ptr("stage1"), - }, 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.Run = armcontainerregistry.Run{ - // Name: to.Ptr("0accec26-d6de-4757-8e74-d080f38eaaab"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/run"), - // ID: to.Ptr("/subscriptions/4385cf00-2d3a-425a-832f-f4285b1c9dce/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/runs/0accec26-d6de-4757-8e74-d080f38eaaab"), - // Properties: &armcontainerregistry.RunProperties{ - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T05:13:51.617Z"); return t}()), - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // RunID: to.Ptr("0accec26-d6de-4757-8e74-d080f38eaaab"), - // Status: to.Ptr(armcontainerregistry.RunStatusSucceeded), - // }, - // } -} - -// 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 -func ExampleRegistriesClient_BeginScheduleRun_registriesScheduleRunWithLogTemplate() { - 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.NewRegistriesClient().BeginScheduleRun(ctx, "myResourceGroup", "myRegistry", &armcontainerregistry.DockerBuildRequest{ - Type: to.Ptr("DockerBuildRequest"), - IsArchiveEnabled: to.Ptr(true), - LogTemplate: to.Ptr("acr/tasks:{{.Run.OS}}"), - AgentConfiguration: &armcontainerregistry.AgentProperties{ - CPU: to.Ptr[int32](2), - }, - Arguments: []*armcontainerregistry.Argument{ - { - Name: to.Ptr("mytestargument"), - IsSecret: to.Ptr(false), - Value: to.Ptr("mytestvalue"), - }, - { - Name: to.Ptr("mysecrettestargument"), - IsSecret: to.Ptr(true), - Value: to.Ptr("mysecrettestvalue"), - }}, - DockerFilePath: to.Ptr("DockerFile"), - ImageNames: []*string{ - to.Ptr("azurerest:testtag")}, - IsPushEnabled: to.Ptr(true), - NoCache: to.Ptr(true), - Platform: &armcontainerregistry.PlatformProperties{ - Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - OS: to.Ptr(armcontainerregistry.OSLinux), - }, - SourceLocation: to.Ptr("https://myaccount.blob.core.windows.net/sascontainer/source.zip?sv=2015-04-05&st=2015-04-29T22%3A18%3A26Z&se=2015-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=Z%2FRHIX5Xcg0Mq2rqI3OlWTjEg2tYkboXr1P9ZUXDtkk%3D"), - }, 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.Run = armcontainerregistry.Run{ - // Name: to.Ptr("0accec26-d6de-4757-8e74-d080f38eaaab"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/run"), - // ID: to.Ptr("/subscriptions/4385cf00-2d3a-425a-832f-f4285b1c9dce/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/runs/0accec26-d6de-4757-8e74-d080f38eaaab"), - // Properties: &armcontainerregistry.RunProperties{ - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T05:13:51.617Z"); return t}()), - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // RunID: to.Ptr("0accec26-d6de-4757-8e74-d080f38eaaab"), - // Status: to.Ptr(armcontainerregistry.RunStatusSucceeded), - // }, - // } -} - -// 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 -func ExampleRegistriesClient_GetBuildSourceUploadURL() { - 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.NewRegistriesClient().GetBuildSourceUploadURL(ctx, "myResourceGroup", "myRegistry", 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.SourceUploadDefinition = armcontainerregistry.SourceUploadDefinition{ - // RelativePath: to.Ptr("source/201802130000/b52f12d8-c3d6-4d75-9107-220f0bfc681d.tar.gz"), - // UploadURL: to.Ptr("https://registrystorageaccount.blob.core.windows.net/registrycontainer/source/201802130000/b52f12d8-c3d6-4d75-9107-220f0bfc681d.tar.gz?sv=2015-04-05&st=2015-04-29T22%3A18%3A26Z&se=2015-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=Z%2FRHIX5Xcg0Mq2rqI3OlWTjEg2tYkboXr1P9ZUXDtkk%3D"), - // } -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client.go index 10164bc4722c..8f6a511b8a1d 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-preview // - 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-preview 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-preview") 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-preview // - 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-preview 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-preview") 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-preview // - 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-preview") 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-preview // - 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-preview") 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-preview // - 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-preview 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-preview") 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 deleted file mode 100644 index 2829a153c6d5..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client_example_test.go +++ /dev/null @@ -1,273 +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/ReplicationList.json -func ExampleReplicationsClient_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.NewReplicationsClient().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.ReplicationListResult = armcontainerregistry.ReplicationListResult{ - // Value: []*armcontainerregistry.Replication{ - // { - // Name: to.Ptr("myReplication"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/replications"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/replications/myReplication"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armcontainerregistry.ReplicationProperties{ - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // RegionEndpointEnabled: to.Ptr(true), - // Status: &armcontainerregistry.Status{ - // DisplayStatus: to.Ptr("Ready"), - // Message: to.Ptr("The replication is ready."), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T23:15:37.0707808Z"); return t}()), - // }, - // ZoneRedundancy: to.Ptr(armcontainerregistry.ZoneRedundancyDisabled), - // }, - // }}, - // } - } -} - -// 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 -func ExampleReplicationsClient_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.NewReplicationsClient().Get(ctx, "myResourceGroup", "myRegistry", "myReplication", 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.Replication = armcontainerregistry.Replication{ - // Name: to.Ptr("myReplication"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/replications"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/replications/myReplication"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armcontainerregistry.ReplicationProperties{ - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // RegionEndpointEnabled: to.Ptr(true), - // Status: &armcontainerregistry.Status{ - // DisplayStatus: to.Ptr("Ready"), - // Message: to.Ptr("The replication is ready."), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T23:15:37.0707808Z"); return t}()), - // }, - // ZoneRedundancy: to.Ptr(armcontainerregistry.ZoneRedundancyDisabled), - // }, - // } -} - -// 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 -func ExampleReplicationsClient_BeginCreate_replicationCreate() { - 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.NewReplicationsClient().BeginCreate(ctx, "myResourceGroup", "myRegistry", "myReplication", armcontainerregistry.Replication{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{ - "key": to.Ptr("value"), - }, - }, 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.Replication = armcontainerregistry.Replication{ - // Name: to.Ptr("myReplication"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/replications"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/replications/myReplication"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armcontainerregistry.ReplicationProperties{ - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // RegionEndpointEnabled: to.Ptr(true), - // Status: &armcontainerregistry.Status{ - // DisplayStatus: to.Ptr("Ready"), - // Message: to.Ptr("The replication is ready."), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T23:15:37.0707808Z"); return t}()), - // }, - // ZoneRedundancy: to.Ptr(armcontainerregistry.ZoneRedundancyDisabled), - // }, - // } -} - -// 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 -func ExampleReplicationsClient_BeginCreate_replicationCreateZoneRedundant() { - 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.NewReplicationsClient().BeginCreate(ctx, "myResourceGroup", "myRegistry", "myReplication", armcontainerregistry.Replication{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{ - "key": to.Ptr("value"), - }, - Properties: &armcontainerregistry.ReplicationProperties{ - RegionEndpointEnabled: to.Ptr(true), - ZoneRedundancy: to.Ptr(armcontainerregistry.ZoneRedundancyEnabled), - }, - }, 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.Replication = armcontainerregistry.Replication{ - // Name: to.Ptr("myReplication"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/replications"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/replications/myReplication"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armcontainerregistry.ReplicationProperties{ - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // RegionEndpointEnabled: to.Ptr(true), - // Status: &armcontainerregistry.Status{ - // DisplayStatus: to.Ptr("Ready"), - // Message: to.Ptr("The replication is ready."), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T23:15:37.0707808Z"); return t}()), - // }, - // ZoneRedundancy: to.Ptr(armcontainerregistry.ZoneRedundancyEnabled), - // }, - // } -} - -// 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 -func ExampleReplicationsClient_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.NewReplicationsClient().BeginDelete(ctx, "myResourceGroup", "myRegistry", "myReplication", 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/ReplicationUpdate.json -func ExampleReplicationsClient_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.NewReplicationsClient().BeginUpdate(ctx, "myResourceGroup", "myRegistry", "myReplication", armcontainerregistry.ReplicationUpdateParameters{ - Tags: map[string]*string{ - "key": to.Ptr("value"), - }, - }, 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.Replication = armcontainerregistry.Replication{ - // Name: to.Ptr("myReplication"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/replications"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/replications/myReplication"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armcontainerregistry.ReplicationProperties{ - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // RegionEndpointEnabled: to.Ptr(true), - // Status: &armcontainerregistry.Status{ - // DisplayStatus: to.Ptr("Ready"), - // Message: to.Ptr("The replication is ready."), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T23:15:37.0707808Z"); return t}()), - // }, - // ZoneRedundancy: to.Ptr(armcontainerregistry.ZoneRedundancyDisabled), - // }, - // } -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/response_types.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/response_types.go index bea783b0e839..78d2b0720534 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/response_types.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/response_types.go @@ -46,6 +46,58 @@ type AgentPoolsClientUpdateResponse struct { AgentPool } +// ArchiveVersionsClientCreateResponse contains the response from method ArchiveVersionsClient.BeginCreate. +type ArchiveVersionsClientCreateResponse struct { + // An object that represents an export pipeline for a container registry. + ArchiveVersion +} + +// ArchiveVersionsClientDeleteResponse contains the response from method ArchiveVersionsClient.BeginDelete. +type ArchiveVersionsClientDeleteResponse struct { + // placeholder for future response values +} + +// ArchiveVersionsClientGetResponse contains the response from method ArchiveVersionsClient.Get. +type ArchiveVersionsClientGetResponse struct { + // An object that represents an export pipeline for a container registry. + ArchiveVersion +} + +// ArchiveVersionsClientListResponse contains the response from method ArchiveVersionsClient.NewListPager. +type ArchiveVersionsClientListResponse struct { + // The result of a request to list export pipelines for a container registry. + ArchiveVersionListResult +} + +// ArchivesClientCreateResponse contains the response from method ArchivesClient.BeginCreate. +type ArchivesClientCreateResponse struct { + // An object that represents a archive for a container registry. + Archive +} + +// ArchivesClientDeleteResponse contains the response from method ArchivesClient.BeginDelete. +type ArchivesClientDeleteResponse struct { + // placeholder for future response values +} + +// ArchivesClientGetResponse contains the response from method ArchivesClient.Get. +type ArchivesClientGetResponse struct { + // An object that represents a archive for a container registry. + Archive +} + +// ArchivesClientListResponse contains the response from method ArchivesClient.NewListPager. +type ArchivesClientListResponse struct { + // The result of a request to list archives for a container registry. + ArchiveListResult +} + +// ArchivesClientUpdateResponse contains the response from method ArchivesClient.Update. +type ArchivesClientUpdateResponse struct { + // An object that represents a archive for a container registry. + Archive +} + // CacheRulesClientCreateResponse contains the response from method CacheRulesClient.BeginCreate. type CacheRulesClientCreateResponse struct { // An object that represents a cache rule 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 deleted file mode 100644 index 5b3e40647ba9..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/runs_client_example_test.go +++ /dev/null @@ -1,283 +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/2019-06-01-preview/examples/RunsList.json -func ExampleRunsClient_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.NewRunsClient().NewListPager("myResourceGroup", "myRegistry", &armcontainerregistry.RunsClientListOptions{Filter: to.Ptr(""), - Top: to.Ptr[int32](10), - }) - 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.RunListResult = armcontainerregistry.RunListResult{ - // Value: []*armcontainerregistry.Run{ - // { - // Name: to.Ptr("0accec26-d6de-4757-8e74-d080f38eaaab"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/runs"), - // ID: to.Ptr("/subscriptions/4385cf00-2d3a-425a-832f-f4285b1c9dce/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/runs/0accec26-d6de-4757-8e74-d080f38eaaab"), - // Properties: &armcontainerregistry.RunProperties{ - // AgentConfiguration: &armcontainerregistry.AgentProperties{ - // CPU: to.Ptr[int32](2), - // }, - // CreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T05:13:51.618Z"); return t}()), - // FinishTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T06:13:51.618Z"); return t}()), - // ImageUpdateTrigger: &armcontainerregistry.ImageUpdateTrigger{ - // ID: to.Ptr("c0c43143-da5d-41ef-b9e1-e7d749272e88"), - // Images: []*armcontainerregistry.ImageDescriptor{ - // { - // Digest: to.Ptr("sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0"), - // Registry: to.Ptr("registry.hub.docker.com"), - // Repository: to.Ptr("mybaseimage"), - // Tag: to.Ptr("latest"), - // }}, - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T05:13:51.618Z"); return t}()), - // }, - // IsArchiveEnabled: to.Ptr(true), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T05:13:51.617Z"); return t}()), - // LogArtifact: &armcontainerregistry.ImageDescriptor{ - // Digest: to.Ptr("sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0"), - // Registry: to.Ptr("myregistry"), - // Repository: to.Ptr("acr/tasks"), - // Tag: to.Ptr("mytask-0accec26-d6de-4757-8e74-d080f38eaaab-log"), - // }, - // OutputImages: []*armcontainerregistry.ImageDescriptor{ - // { - // Digest: to.Ptr("sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0"), - // Registry: to.Ptr("myregistry.azurecr.io"), - // Repository: to.Ptr("myimage"), - // Tag: to.Ptr("latest"), - // }}, - // Platform: &armcontainerregistry.PlatformProperties{ - // Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - // OS: to.Ptr(armcontainerregistry.OSLinux), - // }, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // RunID: to.Ptr("0accec26-d6de-4757-8e74-d080f38eaaab"), - // RunType: to.Ptr(armcontainerregistry.RunTypeAutoBuild), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T05:50:51.618Z"); return t}()), - // Status: to.Ptr(armcontainerregistry.RunStatusSucceeded), - // Task: to.Ptr("myTask"), - // }, - // }}, - // } - } -} - -// 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 -func ExampleRunsClient_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.NewRunsClient().Get(ctx, "myResourceGroup", "myRegistry", "0accec26-d6de-4757-8e74-d080f38eaaab", 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.Run = armcontainerregistry.Run{ - // Name: to.Ptr("0accec26-d6de-4757-8e74-d080f38eaaab"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/runs"), - // ID: to.Ptr("/subscriptions/4385cf00-2d3a-425a-832f-f4285b1c9dce/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/runs/0accec26-d6de-4757-8e74-d080f38eaaab"), - // Properties: &armcontainerregistry.RunProperties{ - // AgentConfiguration: &armcontainerregistry.AgentProperties{ - // CPU: to.Ptr[int32](2), - // }, - // CreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T05:13:51.618Z"); return t}()), - // FinishTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T06:13:51.618Z"); return t}()), - // ImageUpdateTrigger: &armcontainerregistry.ImageUpdateTrigger{ - // ID: to.Ptr("c0c43143-da5d-41ef-b9e1-e7d749272e88"), - // Images: []*armcontainerregistry.ImageDescriptor{ - // { - // Digest: to.Ptr("sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0"), - // Registry: to.Ptr("registry.hub.docker.com"), - // Repository: to.Ptr("mybaseimage"), - // Tag: to.Ptr("latest"), - // }}, - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T05:13:51.618Z"); return t}()), - // }, - // IsArchiveEnabled: to.Ptr(true), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T05:13:51.617Z"); return t}()), - // LogArtifact: &armcontainerregistry.ImageDescriptor{ - // Digest: to.Ptr("sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0"), - // Registry: to.Ptr("myregistry"), - // Repository: to.Ptr("acr/tasks"), - // Tag: to.Ptr("mytask-0accec26-d6de-4757-8e74-d080f38eaaab-log"), - // }, - // OutputImages: []*armcontainerregistry.ImageDescriptor{ - // { - // Digest: to.Ptr("sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0"), - // Registry: to.Ptr("myregistry.azurecr.io"), - // Repository: to.Ptr("myimage"), - // Tag: to.Ptr("latest"), - // }}, - // Platform: &armcontainerregistry.PlatformProperties{ - // Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - // OS: to.Ptr(armcontainerregistry.OSLinux), - // }, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // RunID: to.Ptr("0accec26-d6de-4757-8e74-d080f38eaaab"), - // RunType: to.Ptr(armcontainerregistry.RunTypeAutoBuild), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T05:50:51.618Z"); return t}()), - // Status: to.Ptr(armcontainerregistry.RunStatusSucceeded), - // Task: to.Ptr("myTask"), - // }, - // } -} - -// 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 -func ExampleRunsClient_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.NewRunsClient().BeginUpdate(ctx, "myResourceGroup", "myRegistry", "0accec26-d6de-4757-8e74-d080f38eaaab", armcontainerregistry.RunUpdateParameters{ - IsArchiveEnabled: to.Ptr(true), - }, 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.Run = armcontainerregistry.Run{ - // Name: to.Ptr("0accec26-d6de-4757-8e74-d080f38eaaab"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/runs"), - // ID: to.Ptr("/subscriptions/4385cf00-2d3a-425a-832f-f4285b1c9dce/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/runs/0accec26-d6de-4757-8e74-d080f38eaaab"), - // Properties: &armcontainerregistry.RunProperties{ - // AgentConfiguration: &armcontainerregistry.AgentProperties{ - // CPU: to.Ptr[int32](2), - // }, - // CreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T05:13:51.618Z"); return t}()), - // FinishTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T06:13:51.618Z"); return t}()), - // ImageUpdateTrigger: &armcontainerregistry.ImageUpdateTrigger{ - // ID: to.Ptr("c0c43143-da5d-41ef-b9e1-e7d749272e88"), - // Images: []*armcontainerregistry.ImageDescriptor{ - // { - // Digest: to.Ptr("sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0"), - // Registry: to.Ptr("registry.hub.docker.com"), - // Repository: to.Ptr("mybaseimage"), - // Tag: to.Ptr("latest"), - // }}, - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T05:13:51.618Z"); return t}()), - // }, - // IsArchiveEnabled: to.Ptr(true), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T05:13:51.617Z"); return t}()), - // LogArtifact: &armcontainerregistry.ImageDescriptor{ - // Digest: to.Ptr("sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0"), - // Registry: to.Ptr("myregistry"), - // Repository: to.Ptr("acr/tasks"), - // Tag: to.Ptr("mytask-0accec26-d6de-4757-8e74-d080f38eaaab-log"), - // }, - // OutputImages: []*armcontainerregistry.ImageDescriptor{ - // { - // Digest: to.Ptr("sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0"), - // Registry: to.Ptr("myregistry.azurecr.io"), - // Repository: to.Ptr("myimage"), - // Tag: to.Ptr("latest"), - // }}, - // Platform: &armcontainerregistry.PlatformProperties{ - // Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - // OS: to.Ptr(armcontainerregistry.OSLinux), - // }, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // RunID: to.Ptr("0accec26-d6de-4757-8e74-d080f38eaaab"), - // RunType: to.Ptr(armcontainerregistry.RunTypeAutoBuild), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T05:50:51.618Z"); return t}()), - // Status: to.Ptr(armcontainerregistry.RunStatusSucceeded), - // Task: to.Ptr("myTask"), - // }, - // } -} - -// 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 -func ExampleRunsClient_GetLogSasURL() { - 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.NewRunsClient().GetLogSasURL(ctx, "myResourceGroup", "myRegistry", "0accec26-d6de-4757-8e74-d080f38eaaab", 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.RunGetLogResult = armcontainerregistry.RunGetLogResult{ - // LogLink: to.Ptr("https://registrystorageaccount.blob.core.windows.net/sascontainer/logs/0accec26-d6de-4757-8e74-d080f38eaaab/rawtext.log?sv=2015-04-05&st=2015-04-29T22%3A18%3A26Z&se=2015-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=Z%2FRHIX5Xcg0Mq2rqI3OlWTjEg2tYkboXr1P9ZUXDtkk%3D"), - // } -} - -// 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 -func ExampleRunsClient_BeginCancel() { - 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.NewRunsClient().BeginCancel(ctx, "myResourceGroup", "myRegistry", "0accec26-d6de-4757-8e74-d080f38eaaab", 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/scopemaps_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_client.go index 0b9ef2bb561d..c76613f751b1 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-preview // - 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-preview 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-preview") 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-preview // - 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-preview 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-preview") 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-preview // - 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-preview") 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-preview // - 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-preview") 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-preview // - 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-preview 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-preview") 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 deleted file mode 100644 index 099746cb6619..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_client_example_test.go +++ /dev/null @@ -1,202 +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/ScopeMapList.json -func ExampleScopeMapsClient_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.NewScopeMapsClient().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.ScopeMapListResult = armcontainerregistry.ScopeMapListResult{ - // Value: []*armcontainerregistry.ScopeMap{ - // { - // Name: to.Ptr("myScopeMap"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/scopeMaps"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/scopeMaps/myScopeMap"), - // Properties: &armcontainerregistry.ScopeMapProperties{ - // Type: to.Ptr("IsUserDefined"), - // Actions: []*string{ - // to.Ptr("repositories/myrepository/contentWrite"), - // to.Ptr("repositories/myrepository/delete")}, - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T23:14:37.0707808Z"); return t}()), - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// 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 -func ExampleScopeMapsClient_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.NewScopeMapsClient().Get(ctx, "myResourceGroup", "myRegistry", "myScopeMap", 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.ScopeMap = armcontainerregistry.ScopeMap{ - // Name: to.Ptr("myScopeMap"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/scopeMaps"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/scopeMaps/myScopeMap"), - // Properties: &armcontainerregistry.ScopeMapProperties{ - // Type: to.Ptr("IsUserDefined"), - // Actions: []*string{ - // to.Ptr("repositories/myrepository/contentWrite"), - // to.Ptr("repositories/myrepository/delete")}, - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T23:14:37.0707808Z"); return t}()), - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // }, - // } -} - -// 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 -func ExampleScopeMapsClient_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.NewScopeMapsClient().BeginCreate(ctx, "myResourceGroup", "myRegistry", "myScopeMap", armcontainerregistry.ScopeMap{ - Properties: &armcontainerregistry.ScopeMapProperties{ - Description: to.Ptr("Developer Scopes"), - Actions: []*string{ - to.Ptr("repositories/myrepository/contentWrite"), - to.Ptr("repositories/myrepository/delete")}, - }, - }, 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.ScopeMap = armcontainerregistry.ScopeMap{ - // Name: to.Ptr("myScopeMap"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/scopeMaps"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/scopeMaps/myScopeMap"), - // Properties: &armcontainerregistry.ScopeMapProperties{ - // Type: to.Ptr("IsUserDefined"), - // Actions: []*string{ - // to.Ptr("repositories/myrepository/contentWrite"), - // to.Ptr("repositories/myrepository/delete")}, - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T23:14:37.0707808Z"); return t}()), - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // }, - // } -} - -// 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 -func ExampleScopeMapsClient_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.NewScopeMapsClient().BeginDelete(ctx, "myResourceGroup", "myRegistry", "myScopeMap", 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/ScopeMapUpdate.json -func ExampleScopeMapsClient_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.NewScopeMapsClient().BeginUpdate(ctx, "myResourceGroup", "myRegistry", "myScopeMap", armcontainerregistry.ScopeMapUpdateParameters{ - Properties: &armcontainerregistry.ScopeMapPropertiesUpdateParameters{ - Description: to.Ptr("Developer Scopes"), - Actions: []*string{ - to.Ptr("repositories/myrepository/contentWrite"), - to.Ptr("repositories/myrepository/contentRead")}, - }, - }, 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.ScopeMap = armcontainerregistry.ScopeMap{ - // Name: to.Ptr("myScopeMap"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/scopeMaps"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/scopeMaps/myScopeMap"), - // Properties: &armcontainerregistry.ScopeMapProperties{ - // Type: to.Ptr("IsUserDefined"), - // Actions: []*string{ - // to.Ptr("repositories/myrepository/contentWrite"), - // to.Ptr("repositories/myrepository/contentRead")}, - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T23:14:37.0707808Z"); return t}()), - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // }, - // } -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/taskruns_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/taskruns_client_example_test.go deleted file mode 100644 index 4ec6b2012a69..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/taskruns_client_example_test.go +++ /dev/null @@ -1,408 +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/2019-06-01-preview/examples/TaskRunsGet.json -func ExampleTaskRunsClient_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.NewTaskRunsClient().Get(ctx, "myResourceGroup", "myRegistry", "myRun", 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.TaskRun = armcontainerregistry.TaskRun{ - // Name: to.Ptr("myRun"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/TaskRuns"), - // ID: to.Ptr("/subscriptions/3647315e-0c5b-4ce4-8739-b071e144b2c9/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/taskRuns/myRun"), - // Properties: &armcontainerregistry.TaskRunProperties{ - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // RunRequest: &armcontainerregistry.EncodedTaskRunRequest{ - // Type: to.Ptr("EncodedTaskRunRequest"), - // IsArchiveEnabled: to.Ptr(true), - // Credentials: &armcontainerregistry.Credentials{ - // }, - // EncodedTaskContent: to.Ptr("c3RlcHM6IAogIC0gY21kOiB7eyAuVmFsdWVzLmNvbW1hbmQgfX0K"), - // EncodedValuesContent: to.Ptr("Y29tbWFuZDogYmFzaCBlY2hvIHt7LlJ1bi5SZWdpc3RyeX19Cg=="), - // Platform: &armcontainerregistry.PlatformProperties{ - // Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - // OS: to.Ptr(armcontainerregistry.OSLinux), - // }, - // Values: []*armcontainerregistry.SetValue{ - // }, - // }, - // RunResult: &armcontainerregistry.Run{ - // Name: to.Ptr("yd5"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/runs"), - // ID: to.Ptr("/subscriptions/3647315e-0c5b-4ce4-8739-b071e144b2c9/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/runs/yd5"), - // Properties: &armcontainerregistry.RunProperties{ - // AgentConfiguration: &armcontainerregistry.AgentProperties{ - // CPU: to.Ptr[int32](2), - // }, - // CreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-06T17:23:21.9261521+00:00"); return t}()), - // FinishTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-06T17:23:29.8792157+00:00"); return t}()), - // IsArchiveEnabled: to.Ptr(true), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-06T17:23:29+00:00"); return t}()), - // Platform: &armcontainerregistry.PlatformProperties{ - // Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - // OS: to.Ptr(armcontainerregistry.OSLinux), - // }, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // RunID: to.Ptr("yd5"), - // RunType: to.Ptr(armcontainerregistry.RunTypeQuickRun), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-06T17:23:22.1348714+00:00"); return t}()), - // Status: to.Ptr(armcontainerregistry.RunStatusSucceeded), - // }, - // }, - // }, - // } -} - -// 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 -func ExampleTaskRunsClient_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.NewTaskRunsClient().BeginCreate(ctx, "myResourceGroup", "myRegistry", "myRun", armcontainerregistry.TaskRun{ - Properties: &armcontainerregistry.TaskRunProperties{ - ForceUpdateTag: to.Ptr("test"), - RunRequest: &armcontainerregistry.EncodedTaskRunRequest{ - Type: to.Ptr("EncodedTaskRunRequest"), - Credentials: &armcontainerregistry.Credentials{}, - EncodedTaskContent: to.Ptr("c3RlcHM6IAogIC0gY21kOiB7eyAuVmFsdWVzLmNvbW1hbmQgfX0K"), - EncodedValuesContent: to.Ptr("Y29tbWFuZDogYmFzaCBlY2hvIHt7LlJ1bi5SZWdpc3RyeX19Cg=="), - Platform: &armcontainerregistry.PlatformProperties{ - Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - OS: to.Ptr(armcontainerregistry.OSLinux), - }, - Values: []*armcontainerregistry.SetValue{}, - }, - }, - }, 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.TaskRun = armcontainerregistry.TaskRun{ - // Name: to.Ptr("myrun"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/TaskRuns"), - // ID: to.Ptr("/subscriptions/4385cf00-2d3a-425a-832f-f4285b1c9dce/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/taskRuns/myRun"), - // Properties: &armcontainerregistry.TaskRunProperties{ - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // RunRequest: &armcontainerregistry.EncodedTaskRunRequest{ - // Type: to.Ptr("EncodedTaskRunRequest"), - // IsArchiveEnabled: to.Ptr(true), - // Credentials: &armcontainerregistry.Credentials{ - // }, - // EncodedTaskContent: to.Ptr("c3RlcHM6IAogIC0gY21kOiB7eyAuVmFsdWVzLmNvbW1hbmQgfX0K"), - // EncodedValuesContent: to.Ptr("Y29tbWFuZDogYmFzaCBlY2hvIHt7LlJ1bi5SZWdpc3RyeX19Cg=="), - // Platform: &armcontainerregistry.PlatformProperties{ - // Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - // OS: to.Ptr(armcontainerregistry.OSLinux), - // }, - // Values: []*armcontainerregistry.SetValue{ - // }, - // }, - // RunResult: &armcontainerregistry.Run{ - // Name: to.Ptr("yd5"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/runs"), - // ID: to.Ptr("/subscriptions/4385cf00-2d3a-425a-832f-f4285b1c9dce/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/runs/yd5"), - // Properties: &armcontainerregistry.RunProperties{ - // AgentConfiguration: &armcontainerregistry.AgentProperties{ - // CPU: to.Ptr[int32](2), - // }, - // CreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-06T17:23:21.9261521+00:00"); return t}()), - // IsArchiveEnabled: to.Ptr(true), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-06T17:23:21+00:00"); return t}()), - // Platform: &armcontainerregistry.PlatformProperties{ - // Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - // OS: to.Ptr(armcontainerregistry.OSLinux), - // }, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // RunID: to.Ptr("yd5"), - // RunType: to.Ptr(armcontainerregistry.RunTypeQuickRun), - // Status: to.Ptr(armcontainerregistry.RunStatusQueued), - // }, - // }, - // }, - // } -} - -// 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 -func ExampleTaskRunsClient_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.NewTaskRunsClient().BeginDelete(ctx, "myResourceGroup", "myRegistry", "myRun", 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/2019-06-01-preview/examples/TaskRunsUpdate.json -func ExampleTaskRunsClient_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.NewTaskRunsClient().BeginUpdate(ctx, "myResourceGroup", "myRegistry", "myRun", armcontainerregistry.TaskRunUpdateParameters{ - Properties: &armcontainerregistry.TaskRunPropertiesUpdateParameters{ - ForceUpdateTag: to.Ptr("test"), - RunRequest: &armcontainerregistry.EncodedTaskRunRequest{ - Type: to.Ptr("EncodedTaskRunRequest"), - IsArchiveEnabled: to.Ptr(true), - Credentials: &armcontainerregistry.Credentials{}, - EncodedTaskContent: to.Ptr("c3RlcHM6IAogIC0gY21kOiB7eyAuVmFsdWVzLmNvbW1hbmQgfX0K"), - EncodedValuesContent: to.Ptr("Y29tbWFuZDogYmFzaCBlY2hvIHt7LlJ1bi5SZWdpc3RyeX19Cg=="), - Platform: &armcontainerregistry.PlatformProperties{ - Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - OS: to.Ptr(armcontainerregistry.OSLinux), - }, - Values: []*armcontainerregistry.SetValue{}, - }, - }, - }, 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.TaskRun = armcontainerregistry.TaskRun{ - // Name: to.Ptr("mytestrun"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/TaskRuns"), - // ID: to.Ptr("/subscriptions/4385cf00-2d3a-425a-832f-f4285b1c9dce/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/taskRuns/myRun"), - // Properties: &armcontainerregistry.TaskRunProperties{ - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // RunRequest: &armcontainerregistry.EncodedTaskRunRequest{ - // Type: to.Ptr("EncodedTaskRunRequest"), - // IsArchiveEnabled: to.Ptr(true), - // Credentials: &armcontainerregistry.Credentials{ - // }, - // EncodedTaskContent: to.Ptr("c3RlcHM6IAogIC0gY21kOiB7eyAuVmFsdWVzLmNvbW1hbmQgfX0K"), - // EncodedValuesContent: to.Ptr("Y29tbWFuZDogYmFzaCBlY2hvIHt7LlJ1bi5SZWdpc3RyeX19Cg=="), - // Platform: &armcontainerregistry.PlatformProperties{ - // Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - // OS: to.Ptr(armcontainerregistry.OSLinux), - // }, - // Values: []*armcontainerregistry.SetValue{ - // }, - // }, - // RunResult: &armcontainerregistry.Run{ - // Name: to.Ptr("yd6"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/runs"), - // ID: to.Ptr("/subscriptions/4385cf00-2d3a-425a-832f-f4285b1c9dce/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/runs/yd6"), - // Properties: &armcontainerregistry.RunProperties{ - // AgentConfiguration: &armcontainerregistry.AgentProperties{ - // CPU: to.Ptr[int32](2), - // }, - // CreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-06T17:31:34.1184031+00:00"); return t}()), - // IsArchiveEnabled: to.Ptr(true), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-06T17:31:34+00:00"); return t}()), - // Platform: &armcontainerregistry.PlatformProperties{ - // Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - // OS: to.Ptr(armcontainerregistry.OSLinux), - // }, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // RunID: to.Ptr("yd6"), - // RunType: to.Ptr(armcontainerregistry.RunTypeQuickRun), - // Status: to.Ptr(armcontainerregistry.RunStatusQueued), - // }, - // }, - // }, - // } -} - -// 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 -func ExampleTaskRunsClient_GetDetails() { - 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.NewTaskRunsClient().GetDetails(ctx, "myResourceGroup", "myRegistry", "myRun", 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.TaskRun = armcontainerregistry.TaskRun{ - // Name: to.Ptr("myRun"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/TaskRuns"), - // ID: to.Ptr("/subscriptions/3647315e-0c5b-4ce4-8739-b071e144b2c9/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/taskRuns/myRun"), - // Properties: &armcontainerregistry.TaskRunProperties{ - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // RunRequest: &armcontainerregistry.EncodedTaskRunRequest{ - // Type: to.Ptr("EncodedTaskRunRequest"), - // IsArchiveEnabled: to.Ptr(true), - // Credentials: &armcontainerregistry.Credentials{ - // }, - // EncodedTaskContent: to.Ptr("c3RlcHM6IAogIC0gY21kOiB7eyAuVmFsdWVzLmNvbW1hbmQgfX0K"), - // EncodedValuesContent: to.Ptr("Y29tbWFuZDogYmFzaCBlY2hvIHt7LlJ1bi5SZWdpc3RyeX19Cg=="), - // Platform: &armcontainerregistry.PlatformProperties{ - // Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - // OS: to.Ptr(armcontainerregistry.OSLinux), - // }, - // Values: []*armcontainerregistry.SetValue{ - // }, - // }, - // RunResult: &armcontainerregistry.Run{ - // Name: to.Ptr("yd5"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/runs"), - // ID: to.Ptr("/subscriptions/3647315e-0c5b-4ce4-8739-b071e144b2c9/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/runs/yd5"), - // Properties: &armcontainerregistry.RunProperties{ - // AgentConfiguration: &armcontainerregistry.AgentProperties{ - // CPU: to.Ptr[int32](2), - // }, - // CreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-06T17:23:21.9261521+00:00"); return t}()), - // FinishTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-06T17:23:29.8792157+00:00"); return t}()), - // IsArchiveEnabled: to.Ptr(true), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-06T17:23:29+00:00"); return t}()), - // Platform: &armcontainerregistry.PlatformProperties{ - // Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - // OS: to.Ptr(armcontainerregistry.OSLinux), - // }, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // RunID: to.Ptr("yd5"), - // RunType: to.Ptr(armcontainerregistry.RunTypeQuickRun), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-06T17:23:22.1348714+00:00"); return t}()), - // Status: to.Ptr(armcontainerregistry.RunStatusSucceeded), - // }, - // }, - // }, - // } -} - -// 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 -func ExampleTaskRunsClient_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.NewTaskRunsClient().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.TaskRunListResult = armcontainerregistry.TaskRunListResult{ - // Value: []*armcontainerregistry.TaskRun{ - // { - // Name: to.Ptr("mytestrun"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/TaskRuns"), - // ID: to.Ptr("/subscriptions/4385cf00-2d3a-425a-832f-f4285b1c9dce/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/taskRuns/myRun"), - // Properties: &armcontainerregistry.TaskRunProperties{ - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // RunRequest: &armcontainerregistry.EncodedTaskRunRequest{ - // Type: to.Ptr("EncodedTaskRunRequest"), - // IsArchiveEnabled: to.Ptr(true), - // Credentials: &armcontainerregistry.Credentials{ - // }, - // EncodedTaskContent: to.Ptr("c3RlcHM6IAogIC0gY21kOiB7eyAuVmFsdWVzLmNvbW1hbmQgfX0K"), - // EncodedValuesContent: to.Ptr("Y29tbWFuZDogYmFzaCBlY2hvIHt7LlJ1bi5SZWdpc3RyeX19Cg=="), - // Platform: &armcontainerregistry.PlatformProperties{ - // Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - // OS: to.Ptr(armcontainerregistry.OSLinux), - // }, - // Values: []*armcontainerregistry.SetValue{ - // }, - // }, - // RunResult: &armcontainerregistry.Run{ - // Name: to.Ptr("yd4"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/runs"), - // ID: to.Ptr("/subscriptions/4385cf00-2d3a-425a-832f-f4285b1c9dce/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/runs/yd4"), - // Properties: &armcontainerregistry.RunProperties{ - // AgentConfiguration: &armcontainerregistry.AgentProperties{ - // CPU: to.Ptr[int32](2), - // }, - // CreateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-04T17:15:29.2278794+00:00"); return t}()), - // FinishTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-04T17:15:37.0349516+00:00"); return t}()), - // IsArchiveEnabled: to.Ptr(true), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-04T17:15:37+00:00"); return t}()), - // Platform: &armcontainerregistry.PlatformProperties{ - // Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - // OS: to.Ptr(armcontainerregistry.OSLinux), - // }, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // RunID: to.Ptr("yd4"), - // RunType: to.Ptr(armcontainerregistry.RunTypeQuickRun), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-04T17:15:29.4589616+00:00"); return t}()), - // Status: to.Ptr(armcontainerregistry.RunStatusSucceeded), - // }, - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/tasks_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/tasks_client_example_test.go deleted file mode 100644 index 09c531205fd1..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/tasks_client_example_test.go +++ /dev/null @@ -1,1651 +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/2019-06-01-preview/examples/TasksList.json -func ExampleTasksClient_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.NewTasksClient().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.TaskListResult = armcontainerregistry.TaskListResult{ - // Value: []*armcontainerregistry.Task{ - // { - // Name: to.Ptr("myTask"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/tasks"), - // ID: to.Ptr("/subscriptions/4385cf00-2d3a-425a-832f-f4285b1c9dce/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tasks/myTask"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "testkey": to.Ptr("value"), - // }, - // Identity: &armcontainerregistry.IdentityProperties{ - // Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("fa153151-b9fd-46f4-9088-5e6600f2689v"), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-abu4gm510ccd"), - // }, - // Properties: &armcontainerregistry.TaskProperties{ - // AgentConfiguration: &armcontainerregistry.AgentProperties{ - // CPU: to.Ptr[int32](2), - // }, - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T06:54:23.536Z"); return t}()), - // Credentials: &armcontainerregistry.Credentials{ - // CustomRegistries: map[string]*armcontainerregistry.CustomRegistryCredentials{ - // "myRegistry.azure.io": nil, - // }, - // }, - // IsSystemTask: to.Ptr(false), - // Platform: &armcontainerregistry.PlatformProperties{ - // Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - // OS: to.Ptr(armcontainerregistry.OSLinux), - // }, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Status: to.Ptr(armcontainerregistry.TaskStatusEnabled), - // Step: &armcontainerregistry.DockerBuildStep{ - // Type: to.Ptr(armcontainerregistry.StepTypeDocker), - // ContextPath: to.Ptr("src"), - // Arguments: []*armcontainerregistry.Argument{ - // { - // Name: to.Ptr("mytestargument"), - // IsSecret: to.Ptr(false), - // Value: to.Ptr("mytestvalue"), - // }}, - // DockerFilePath: to.Ptr("src/DockerFile"), - // ImageNames: []*string{ - // to.Ptr("azurerest:testtag")}, - // IsPushEnabled: to.Ptr(true), - // NoCache: to.Ptr(false), - // }, - // Trigger: &armcontainerregistry.TriggerProperties{ - // BaseImageTrigger: &armcontainerregistry.BaseImageTrigger{ - // Name: to.Ptr("myBaseImageTrigger"), - // BaseImageTriggerType: to.Ptr(armcontainerregistry.BaseImageTriggerTypeRuntime), - // Status: to.Ptr(armcontainerregistry.TriggerStatusEnabled), - // UpdateTriggerPayloadType: to.Ptr(armcontainerregistry.UpdateTriggerPayloadTypeDefault), - // }, - // SourceTriggers: []*armcontainerregistry.SourceTrigger{ - // { - // Name: to.Ptr("mySourceTrigger"), - // SourceRepository: &armcontainerregistry.SourceProperties{ - // Branch: to.Ptr("master"), - // RepositoryURL: to.Ptr("https://github.com/Azure/azure-rest-api-specs"), - // SourceControlType: to.Ptr(armcontainerregistry.SourceControlTypeGithub), - // }, - // SourceTriggerEvents: []*armcontainerregistry.SourceTriggerEvent{ - // to.Ptr(armcontainerregistry.SourceTriggerEventCommit)}, - // Status: to.Ptr(armcontainerregistry.TriggerStatusEnabled), - // }}, - // TimerTriggers: []*armcontainerregistry.TimerTrigger{ - // { - // Name: to.Ptr("myTimerTrigger"), - // Schedule: to.Ptr("30 9 * * 1-5"), - // 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/2019-06-01-preview/examples/TasksGet.json -func ExampleTasksClient_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.NewTasksClient().Get(ctx, "myResourceGroup", "myRegistry", "myTask", 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.Task = armcontainerregistry.Task{ - // Name: to.Ptr("myTask"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/tasks"), - // ID: to.Ptr("/subscriptions/4385cf00-2d3a-425a-832f-f4285b1c9dce/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tasks/myTask"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "testkey": to.Ptr("value"), - // }, - // Identity: &armcontainerregistry.IdentityProperties{ - // Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("fa153151-b9fd-46f4-9088-5e6600f2689v"), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-abu4gm510ccd"), - // }, - // Properties: &armcontainerregistry.TaskProperties{ - // AgentConfiguration: &armcontainerregistry.AgentProperties{ - // CPU: to.Ptr[int32](2), - // }, - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T06:54:23.536Z"); return t}()), - // Credentials: &armcontainerregistry.Credentials{ - // CustomRegistries: map[string]*armcontainerregistry.CustomRegistryCredentials{ - // "myregistry.azure.io": nil, - // }, - // }, - // IsSystemTask: to.Ptr(false), - // Platform: &armcontainerregistry.PlatformProperties{ - // Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - // OS: to.Ptr(armcontainerregistry.OSLinux), - // }, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Status: to.Ptr(armcontainerregistry.TaskStatusEnabled), - // Step: &armcontainerregistry.DockerBuildStep{ - // Type: to.Ptr(armcontainerregistry.StepTypeDocker), - // ContextPath: to.Ptr("src"), - // Arguments: []*armcontainerregistry.Argument{ - // { - // Name: to.Ptr("mytestargument"), - // IsSecret: to.Ptr(false), - // Value: to.Ptr("mytestvalue"), - // }}, - // DockerFilePath: to.Ptr("src/DockerFile"), - // ImageNames: []*string{ - // to.Ptr("azurerest:testtag")}, - // IsPushEnabled: to.Ptr(true), - // NoCache: to.Ptr(false), - // }, - // Trigger: &armcontainerregistry.TriggerProperties{ - // BaseImageTrigger: &armcontainerregistry.BaseImageTrigger{ - // Name: to.Ptr("myBaseImageTrigger"), - // BaseImageTriggerType: to.Ptr(armcontainerregistry.BaseImageTriggerTypeRuntime), - // Status: to.Ptr(armcontainerregistry.TriggerStatusEnabled), - // UpdateTriggerPayloadType: to.Ptr(armcontainerregistry.UpdateTriggerPayloadTypeToken), - // }, - // SourceTriggers: []*armcontainerregistry.SourceTrigger{ - // { - // Name: to.Ptr("mySourceTrigger"), - // SourceRepository: &armcontainerregistry.SourceProperties{ - // Branch: to.Ptr("master"), - // RepositoryURL: to.Ptr("https://github.com/Azure/azure-rest-api-specs"), - // SourceControlType: to.Ptr(armcontainerregistry.SourceControlTypeGithub), - // }, - // SourceTriggerEvents: []*armcontainerregistry.SourceTriggerEvent{ - // to.Ptr(armcontainerregistry.SourceTriggerEventCommit)}, - // Status: to.Ptr(armcontainerregistry.TriggerStatusEnabled), - // }}, - // TimerTriggers: []*armcontainerregistry.TimerTrigger{ - // { - // Name: to.Ptr("myTimerTrigger"), - // Schedule: to.Ptr("30 9 * * 1-5"), - // 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/2019-06-01-preview/examples/TasksCreate.json -func ExampleTasksClient_BeginCreate_tasksCreate() { - 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.NewTasksClient().BeginCreate(ctx, "myResourceGroup", "myRegistry", "mytTask", armcontainerregistry.Task{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{ - "testkey": to.Ptr("value"), - }, - Identity: &armcontainerregistry.IdentityProperties{ - Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeSystemAssigned), - }, - Properties: &armcontainerregistry.TaskProperties{ - AgentConfiguration: &armcontainerregistry.AgentProperties{ - CPU: to.Ptr[int32](2), - }, - IsSystemTask: to.Ptr(false), - LogTemplate: to.Ptr("acr/tasks:{{.Run.OS}}"), - Platform: &armcontainerregistry.PlatformProperties{ - Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - OS: to.Ptr(armcontainerregistry.OSLinux), - }, - Status: to.Ptr(armcontainerregistry.TaskStatusEnabled), - Step: &armcontainerregistry.DockerBuildStep{ - Type: to.Ptr(armcontainerregistry.StepTypeDocker), - ContextPath: to.Ptr("src"), - Arguments: []*armcontainerregistry.Argument{ - { - Name: to.Ptr("mytestargument"), - IsSecret: to.Ptr(false), - Value: to.Ptr("mytestvalue"), - }, - { - Name: to.Ptr("mysecrettestargument"), - IsSecret: to.Ptr(true), - Value: to.Ptr("mysecrettestvalue"), - }}, - DockerFilePath: to.Ptr("src/DockerFile"), - ImageNames: []*string{ - to.Ptr("azurerest:testtag")}, - IsPushEnabled: to.Ptr(true), - NoCache: to.Ptr(false), - }, - Trigger: &armcontainerregistry.TriggerProperties{ - BaseImageTrigger: &armcontainerregistry.BaseImageTrigger{ - Name: to.Ptr("myBaseImageTrigger"), - BaseImageTriggerType: to.Ptr(armcontainerregistry.BaseImageTriggerTypeRuntime), - UpdateTriggerEndpoint: to.Ptr("https://user:pass@mycicd.webhook.com?token=foo"), - UpdateTriggerPayloadType: to.Ptr(armcontainerregistry.UpdateTriggerPayloadTypeToken), - }, - SourceTriggers: []*armcontainerregistry.SourceTrigger{ - { - Name: to.Ptr("mySourceTrigger"), - SourceRepository: &armcontainerregistry.SourceProperties{ - Branch: to.Ptr("master"), - RepositoryURL: to.Ptr("https://github.com/Azure/azure-rest-api-specs"), - SourceControlAuthProperties: &armcontainerregistry.AuthInfo{ - Token: to.Ptr("xxxxx"), - TokenType: to.Ptr(armcontainerregistry.TokenTypePAT), - }, - SourceControlType: to.Ptr(armcontainerregistry.SourceControlTypeGithub), - }, - SourceTriggerEvents: []*armcontainerregistry.SourceTriggerEvent{ - to.Ptr(armcontainerregistry.SourceTriggerEventCommit)}, - }}, - TimerTriggers: []*armcontainerregistry.TimerTrigger{ - { - Name: to.Ptr("myTimerTrigger"), - Schedule: to.Ptr("30 9 * * 1-5"), - }}, - }, - }, - }, 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.Task = armcontainerregistry.Task{ - // Name: to.Ptr("myTask"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/tasks"), - // ID: to.Ptr("/subscriptions/4385cf00-2d3a-425a-832f-f4285b1c9dce/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tasks/myTask"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "testkey": to.Ptr("value"), - // }, - // Identity: &armcontainerregistry.IdentityProperties{ - // Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("fa153151-b9fd-46f4-9088-5e6600f2689v"), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-abu4gm510ccd"), - // }, - // Properties: &armcontainerregistry.TaskProperties{ - // AgentConfiguration: &armcontainerregistry.AgentProperties{ - // CPU: to.Ptr[int32](2), - // }, - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T06:54:23.536Z"); return t}()), - // IsSystemTask: to.Ptr(false), - // LogTemplate: to.Ptr("acr/tasks:{{.Run.OS}}"), - // Platform: &armcontainerregistry.PlatformProperties{ - // Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - // OS: to.Ptr(armcontainerregistry.OSLinux), - // }, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Status: to.Ptr(armcontainerregistry.TaskStatusEnabled), - // Step: &armcontainerregistry.DockerBuildStep{ - // Type: to.Ptr(armcontainerregistry.StepTypeDocker), - // ContextPath: to.Ptr("src"), - // Arguments: []*armcontainerregistry.Argument{ - // { - // Name: to.Ptr("mytestargument"), - // IsSecret: to.Ptr(false), - // Value: to.Ptr("mytestvalue"), - // }}, - // DockerFilePath: to.Ptr("src/DockerFile"), - // ImageNames: []*string{ - // to.Ptr("azurerest:testtag")}, - // IsPushEnabled: to.Ptr(true), - // NoCache: to.Ptr(false), - // }, - // Trigger: &armcontainerregistry.TriggerProperties{ - // BaseImageTrigger: &armcontainerregistry.BaseImageTrigger{ - // Name: to.Ptr("myBaseImageTrigger"), - // BaseImageTriggerType: to.Ptr(armcontainerregistry.BaseImageTriggerTypeRuntime), - // Status: to.Ptr(armcontainerregistry.TriggerStatusEnabled), - // UpdateTriggerPayloadType: to.Ptr(armcontainerregistry.UpdateTriggerPayloadTypeToken), - // }, - // SourceTriggers: []*armcontainerregistry.SourceTrigger{ - // { - // Name: to.Ptr("mySourceTrigger"), - // SourceRepository: &armcontainerregistry.SourceProperties{ - // Branch: to.Ptr("master"), - // RepositoryURL: to.Ptr("https://github.com/Azure/azure-rest-api-specs"), - // SourceControlType: to.Ptr(armcontainerregistry.SourceControlTypeGithub), - // }, - // SourceTriggerEvents: []*armcontainerregistry.SourceTriggerEvent{ - // to.Ptr(armcontainerregistry.SourceTriggerEventCommit)}, - // Status: to.Ptr(armcontainerregistry.TriggerStatusEnabled), - // }}, - // TimerTriggers: []*armcontainerregistry.TimerTrigger{ - // { - // Name: to.Ptr("myTimerTrigger"), - // Schedule: to.Ptr("30 9 * * 1-5"), - // 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/2019-06-01-preview/examples/TasksCreate_QuickTask.json -func ExampleTasksClient_BeginCreate_tasksCreateQuickTask() { - 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.NewTasksClient().BeginCreate(ctx, "myResourceGroup", "myRegistry", "quicktask", armcontainerregistry.Task{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{ - "testkey": to.Ptr("value"), - }, - Properties: &armcontainerregistry.TaskProperties{ - IsSystemTask: to.Ptr(true), - LogTemplate: to.Ptr("acr/tasks:{{.Run.OS}}"), - Status: to.Ptr(armcontainerregistry.TaskStatusEnabled), - }, - }, 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.Task = armcontainerregistry.Task{ - // Name: to.Ptr("quicktask"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/tasks"), - // ID: to.Ptr("/subscriptions/4385cf00-2d3a-425a-832f-f4285b1c9dce/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tasks/myTask"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "testkey": to.Ptr("value"), - // }, - // Properties: &armcontainerregistry.TaskProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T06:54:23.536Z"); return t}()), - // IsSystemTask: to.Ptr(true), - // LogTemplate: to.Ptr("acr/tasks:{{.Run.OS}}"), - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Status: to.Ptr(armcontainerregistry.TaskStatusEnabled), - // }, - // } -} - -// 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 -func ExampleTasksClient_BeginCreate_tasksCreateWithSystemAndUserIdentities() { - 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.NewTasksClient().BeginCreate(ctx, "myResourceGroup", "myRegistry", "mytTask", armcontainerregistry.Task{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{ - "testkey": to.Ptr("value"), - }, - Identity: &armcontainerregistry.IdentityProperties{ - Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeSystemAssignedUserAssigned), - UserAssignedIdentities: map[string]*armcontainerregistry.UserIdentityProperties{ - "/subscriptions/f9d7ebed-adbd-4cb4-b973-aaf82c136138/resourcegroups/myResourceGroup1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity2": {}, - }, - }, - Properties: &armcontainerregistry.TaskProperties{ - AgentConfiguration: &armcontainerregistry.AgentProperties{ - CPU: to.Ptr[int32](2), - }, - IsSystemTask: to.Ptr(false), - Platform: &armcontainerregistry.PlatformProperties{ - Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - OS: to.Ptr(armcontainerregistry.OSLinux), - }, - Status: to.Ptr(armcontainerregistry.TaskStatusEnabled), - Step: &armcontainerregistry.DockerBuildStep{ - Type: to.Ptr(armcontainerregistry.StepTypeDocker), - ContextPath: to.Ptr("src"), - Arguments: []*armcontainerregistry.Argument{ - { - Name: to.Ptr("mytestargument"), - IsSecret: to.Ptr(false), - Value: to.Ptr("mytestvalue"), - }, - { - Name: to.Ptr("mysecrettestargument"), - IsSecret: to.Ptr(true), - Value: to.Ptr("mysecrettestvalue"), - }}, - DockerFilePath: to.Ptr("src/DockerFile"), - ImageNames: []*string{ - to.Ptr("azurerest:testtag")}, - IsPushEnabled: to.Ptr(true), - NoCache: to.Ptr(false), - }, - Trigger: &armcontainerregistry.TriggerProperties{ - BaseImageTrigger: &armcontainerregistry.BaseImageTrigger{ - Name: to.Ptr("myBaseImageTrigger"), - BaseImageTriggerType: to.Ptr(armcontainerregistry.BaseImageTriggerTypeRuntime), - UpdateTriggerEndpoint: to.Ptr("https://user:pass@mycicd.webhook.com?token=foo"), - UpdateTriggerPayloadType: to.Ptr(armcontainerregistry.UpdateTriggerPayloadTypeDefault), - }, - SourceTriggers: []*armcontainerregistry.SourceTrigger{ - { - Name: to.Ptr("mySourceTrigger"), - SourceRepository: &armcontainerregistry.SourceProperties{ - Branch: to.Ptr("master"), - RepositoryURL: to.Ptr("https://github.com/Azure/azure-rest-api-specs"), - SourceControlAuthProperties: &armcontainerregistry.AuthInfo{ - Token: to.Ptr("xxxxx"), - TokenType: to.Ptr(armcontainerregistry.TokenTypePAT), - }, - SourceControlType: to.Ptr(armcontainerregistry.SourceControlTypeGithub), - }, - SourceTriggerEvents: []*armcontainerregistry.SourceTriggerEvent{ - to.Ptr(armcontainerregistry.SourceTriggerEventCommit)}, - }}, - TimerTriggers: []*armcontainerregistry.TimerTrigger{ - { - Name: to.Ptr("myTimerTrigger"), - Schedule: to.Ptr("30 9 * * 1-5"), - }}, - }, - }, - }, 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.Task = armcontainerregistry.Task{ - // Name: to.Ptr("myTask"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/tasks"), - // ID: to.Ptr("/subscriptions/4385cf00-2d3a-425a-832f-f4285b1c9dce/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tasks/myTask"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "testkey": to.Ptr("value"), - // }, - // Identity: &armcontainerregistry.IdentityProperties{ - // Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("fc99dc67-1ad9-45c8-9ebc-e438081c8e30"), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-ab578e110ccd"), - // UserAssignedIdentities: map[string]*armcontainerregistry.UserIdentityProperties{ - // "/subscriptions/f9d7ebed-adbd-4cb4-b973-aaf82c136138/resourcegroups/myResourceGroup1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity2": &armcontainerregistry.UserIdentityProperties{ - // ClientID: to.Ptr("e35621a5-f615-4a20-940e-de8a84b15abc"), - // PrincipalID: to.Ptr("e45e3m7c-176e-416a-b466-0c5ec8298f8a"), - // }, - // }, - // }, - // Properties: &armcontainerregistry.TaskProperties{ - // AgentConfiguration: &armcontainerregistry.AgentProperties{ - // CPU: to.Ptr[int32](2), - // }, - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T06:54:23.536Z"); return t}()), - // IsSystemTask: to.Ptr(false), - // Platform: &armcontainerregistry.PlatformProperties{ - // Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - // OS: to.Ptr(armcontainerregistry.OSLinux), - // }, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Status: to.Ptr(armcontainerregistry.TaskStatusEnabled), - // Step: &armcontainerregistry.DockerBuildStep{ - // Type: to.Ptr(armcontainerregistry.StepTypeDocker), - // ContextPath: to.Ptr("src"), - // Arguments: []*armcontainerregistry.Argument{ - // { - // Name: to.Ptr("mytestargument"), - // IsSecret: to.Ptr(false), - // Value: to.Ptr("mytestvalue"), - // }}, - // DockerFilePath: to.Ptr("src/DockerFile"), - // ImageNames: []*string{ - // to.Ptr("azurerest:testtag")}, - // IsPushEnabled: to.Ptr(true), - // NoCache: to.Ptr(false), - // }, - // Trigger: &armcontainerregistry.TriggerProperties{ - // BaseImageTrigger: &armcontainerregistry.BaseImageTrigger{ - // Name: to.Ptr("myBaseImageTrigger"), - // BaseImageTriggerType: to.Ptr(armcontainerregistry.BaseImageTriggerTypeRuntime), - // Status: to.Ptr(armcontainerregistry.TriggerStatusEnabled), - // UpdateTriggerPayloadType: to.Ptr(armcontainerregistry.UpdateTriggerPayloadTypeDefault), - // }, - // SourceTriggers: []*armcontainerregistry.SourceTrigger{ - // { - // Name: to.Ptr("mySourceTrigger"), - // SourceRepository: &armcontainerregistry.SourceProperties{ - // Branch: to.Ptr("master"), - // RepositoryURL: to.Ptr("https://github.com/Azure/azure-rest-api-specs"), - // SourceControlType: to.Ptr(armcontainerregistry.SourceControlTypeGithub), - // }, - // SourceTriggerEvents: []*armcontainerregistry.SourceTriggerEvent{ - // to.Ptr(armcontainerregistry.SourceTriggerEventCommit)}, - // Status: to.Ptr(armcontainerregistry.TriggerStatusEnabled), - // }}, - // TimerTriggers: []*armcontainerregistry.TimerTrigger{ - // { - // Name: to.Ptr("myTimerTrigger"), - // Schedule: to.Ptr("30 9 * * 1-5"), - // 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/2019-06-01-preview/examples/ManagedIdentity/TasksCreate_WithUserIdentities.json -func ExampleTasksClient_BeginCreate_tasksCreateWithUserIdentities() { - 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.NewTasksClient().BeginCreate(ctx, "myResourceGroup", "myRegistry", "mytTask", armcontainerregistry.Task{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{ - "testkey": to.Ptr("value"), - }, - 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/identity1": {}, - "/subscriptions/f9d7ebed-adbd-4cb4-b973-aaf82c136138/resourcegroups/myResourceGroup1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity2": {}, - }, - }, - Properties: &armcontainerregistry.TaskProperties{ - AgentConfiguration: &armcontainerregistry.AgentProperties{ - CPU: to.Ptr[int32](2), - }, - IsSystemTask: to.Ptr(false), - Platform: &armcontainerregistry.PlatformProperties{ - Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - OS: to.Ptr(armcontainerregistry.OSLinux), - }, - Status: to.Ptr(armcontainerregistry.TaskStatusEnabled), - Step: &armcontainerregistry.DockerBuildStep{ - Type: to.Ptr(armcontainerregistry.StepTypeDocker), - ContextPath: to.Ptr("src"), - Arguments: []*armcontainerregistry.Argument{ - { - Name: to.Ptr("mytestargument"), - IsSecret: to.Ptr(false), - Value: to.Ptr("mytestvalue"), - }, - { - Name: to.Ptr("mysecrettestargument"), - IsSecret: to.Ptr(true), - Value: to.Ptr("mysecrettestvalue"), - }}, - DockerFilePath: to.Ptr("src/DockerFile"), - ImageNames: []*string{ - to.Ptr("azurerest:testtag")}, - IsPushEnabled: to.Ptr(true), - NoCache: to.Ptr(false), - }, - Trigger: &armcontainerregistry.TriggerProperties{ - BaseImageTrigger: &armcontainerregistry.BaseImageTrigger{ - Name: to.Ptr("myBaseImageTrigger"), - BaseImageTriggerType: to.Ptr(armcontainerregistry.BaseImageTriggerTypeRuntime), - UpdateTriggerEndpoint: to.Ptr("https://user:pass@mycicd.webhook.com?token=foo"), - UpdateTriggerPayloadType: to.Ptr(armcontainerregistry.UpdateTriggerPayloadTypeDefault), - }, - SourceTriggers: []*armcontainerregistry.SourceTrigger{ - { - Name: to.Ptr("mySourceTrigger"), - SourceRepository: &armcontainerregistry.SourceProperties{ - Branch: to.Ptr("master"), - RepositoryURL: to.Ptr("https://github.com/Azure/azure-rest-api-specs"), - SourceControlAuthProperties: &armcontainerregistry.AuthInfo{ - Token: to.Ptr("xxxxx"), - TokenType: to.Ptr(armcontainerregistry.TokenTypePAT), - }, - SourceControlType: to.Ptr(armcontainerregistry.SourceControlTypeGithub), - }, - SourceTriggerEvents: []*armcontainerregistry.SourceTriggerEvent{ - to.Ptr(armcontainerregistry.SourceTriggerEventCommit)}, - }}, - TimerTriggers: []*armcontainerregistry.TimerTrigger{ - { - Name: to.Ptr("myTimerTrigger"), - Schedule: to.Ptr("30 9 * * 1-5"), - }}, - }, - }, - }, 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.Task = armcontainerregistry.Task{ - // Name: to.Ptr("myTask"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/tasks"), - // ID: to.Ptr("/subscriptions/4385cf00-2d3a-425a-832f-f4285b1c9dce/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tasks/myTask"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "testkey": to.Ptr("value"), - // }, - // 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/identity1": &armcontainerregistry.UserIdentityProperties{ - // ClientID: to.Ptr("d3ce1bc2-f7d7-4a5b-9979-950f4e57680e"), - // PrincipalID: to.Ptr("b6p9f58b-6fbf-4efd-a7e0-fvd46911a466"), - // }, - // "/subscriptions/f9d7ebed-adbd-4cb4-b973-aaf82c136138/resourcegroups/myResourceGroup1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity2": &armcontainerregistry.UserIdentityProperties{ - // ClientID: to.Ptr("e35621a5-f615-4a20-940e-de8a84b15abc"), - // PrincipalID: to.Ptr("e45e3m7c-176e-416a-b466-0c5ec8298f8a"), - // }, - // }, - // }, - // Properties: &armcontainerregistry.TaskProperties{ - // AgentConfiguration: &armcontainerregistry.AgentProperties{ - // CPU: to.Ptr[int32](2), - // }, - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T06:54:23.536Z"); return t}()), - // IsSystemTask: to.Ptr(false), - // Platform: &armcontainerregistry.PlatformProperties{ - // Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - // OS: to.Ptr(armcontainerregistry.OSLinux), - // }, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Status: to.Ptr(armcontainerregistry.TaskStatusEnabled), - // Step: &armcontainerregistry.DockerBuildStep{ - // Type: to.Ptr(armcontainerregistry.StepTypeDocker), - // ContextPath: to.Ptr("src"), - // Arguments: []*armcontainerregistry.Argument{ - // { - // Name: to.Ptr("mytestargument"), - // IsSecret: to.Ptr(false), - // Value: to.Ptr("mytestvalue"), - // }}, - // DockerFilePath: to.Ptr("src/DockerFile"), - // ImageNames: []*string{ - // to.Ptr("azurerest:testtag")}, - // IsPushEnabled: to.Ptr(true), - // NoCache: to.Ptr(false), - // }, - // Trigger: &armcontainerregistry.TriggerProperties{ - // BaseImageTrigger: &armcontainerregistry.BaseImageTrigger{ - // Name: to.Ptr("myBaseImageTrigger"), - // BaseImageTriggerType: to.Ptr(armcontainerregistry.BaseImageTriggerTypeRuntime), - // Status: to.Ptr(armcontainerregistry.TriggerStatusEnabled), - // UpdateTriggerPayloadType: to.Ptr(armcontainerregistry.UpdateTriggerPayloadTypeDefault), - // }, - // SourceTriggers: []*armcontainerregistry.SourceTrigger{ - // { - // Name: to.Ptr("mySourceTrigger"), - // SourceRepository: &armcontainerregistry.SourceProperties{ - // Branch: to.Ptr("master"), - // RepositoryURL: to.Ptr("https://github.com/Azure/azure-rest-api-specs"), - // SourceControlType: to.Ptr(armcontainerregistry.SourceControlTypeGithub), - // }, - // SourceTriggerEvents: []*armcontainerregistry.SourceTriggerEvent{ - // to.Ptr(armcontainerregistry.SourceTriggerEventCommit)}, - // Status: to.Ptr(armcontainerregistry.TriggerStatusEnabled), - // }}, - // TimerTriggers: []*armcontainerregistry.TimerTrigger{ - // { - // Name: to.Ptr("myTimerTrigger"), - // Schedule: to.Ptr("30 9 * * 1-5"), - // 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/2019-06-01-preview/examples/ManagedIdentity/TasksCreate_WithSystemIdentity.json -func ExampleTasksClient_BeginCreate_tasksCreateWithUserIdentitiesWithSystemIdentity() { - 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.NewTasksClient().BeginCreate(ctx, "myResourceGroup", "myRegistry", "mytTask", armcontainerregistry.Task{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{ - "testkey": to.Ptr("value"), - }, - Identity: &armcontainerregistry.IdentityProperties{ - Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeSystemAssigned), - }, - Properties: &armcontainerregistry.TaskProperties{ - AgentConfiguration: &armcontainerregistry.AgentProperties{ - CPU: to.Ptr[int32](2), - }, - IsSystemTask: to.Ptr(false), - Platform: &armcontainerregistry.PlatformProperties{ - Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - OS: to.Ptr(armcontainerregistry.OSLinux), - }, - Status: to.Ptr(armcontainerregistry.TaskStatusEnabled), - Step: &armcontainerregistry.DockerBuildStep{ - Type: to.Ptr(armcontainerregistry.StepTypeDocker), - ContextPath: to.Ptr("src"), - Arguments: []*armcontainerregistry.Argument{ - { - Name: to.Ptr("mytestargument"), - IsSecret: to.Ptr(false), - Value: to.Ptr("mytestvalue"), - }, - { - Name: to.Ptr("mysecrettestargument"), - IsSecret: to.Ptr(true), - Value: to.Ptr("mysecrettestvalue"), - }}, - DockerFilePath: to.Ptr("src/DockerFile"), - ImageNames: []*string{ - to.Ptr("azurerest:testtag")}, - IsPushEnabled: to.Ptr(true), - NoCache: to.Ptr(false), - }, - Trigger: &armcontainerregistry.TriggerProperties{ - BaseImageTrigger: &armcontainerregistry.BaseImageTrigger{ - Name: to.Ptr("myBaseImageTrigger"), - BaseImageTriggerType: to.Ptr(armcontainerregistry.BaseImageTriggerTypeRuntime), - }, - SourceTriggers: []*armcontainerregistry.SourceTrigger{ - { - Name: to.Ptr("mySourceTrigger"), - SourceRepository: &armcontainerregistry.SourceProperties{ - Branch: to.Ptr("master"), - RepositoryURL: to.Ptr("https://github.com/Azure/azure-rest-api-specs"), - SourceControlAuthProperties: &armcontainerregistry.AuthInfo{ - Token: to.Ptr("xxxxx"), - TokenType: to.Ptr(armcontainerregistry.TokenTypePAT), - }, - SourceControlType: to.Ptr(armcontainerregistry.SourceControlTypeGithub), - }, - SourceTriggerEvents: []*armcontainerregistry.SourceTriggerEvent{ - to.Ptr(armcontainerregistry.SourceTriggerEventCommit)}, - }}, - TimerTriggers: []*armcontainerregistry.TimerTrigger{ - { - Name: to.Ptr("myTimerTrigger"), - Schedule: to.Ptr("30 9 * * 1-5"), - }}, - }, - }, - }, 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.Task = armcontainerregistry.Task{ - // Name: to.Ptr("myTask"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/tasks"), - // ID: to.Ptr("/subscriptions/4385cf00-2d3a-425a-832f-f4285b1c9dce/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tasks/myTask"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "testkey": to.Ptr("value"), - // }, - // Identity: &armcontainerregistry.IdentityProperties{ - // Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("fa153151-b9fd-46f4-9088-5e6600f2689v"), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-abu4gm510ccd"), - // }, - // Properties: &armcontainerregistry.TaskProperties{ - // AgentConfiguration: &armcontainerregistry.AgentProperties{ - // CPU: to.Ptr[int32](2), - // }, - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T06:54:23.536Z"); return t}()), - // IsSystemTask: to.Ptr(false), - // Platform: &armcontainerregistry.PlatformProperties{ - // Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - // OS: to.Ptr(armcontainerregistry.OSLinux), - // }, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Status: to.Ptr(armcontainerregistry.TaskStatusEnabled), - // Step: &armcontainerregistry.DockerBuildStep{ - // Type: to.Ptr(armcontainerregistry.StepTypeDocker), - // ContextPath: to.Ptr("src"), - // Arguments: []*armcontainerregistry.Argument{ - // { - // Name: to.Ptr("mytestargument"), - // IsSecret: to.Ptr(false), - // Value: to.Ptr("mytestvalue"), - // }}, - // DockerFilePath: to.Ptr("src/DockerFile"), - // ImageNames: []*string{ - // to.Ptr("azurerest:testtag")}, - // IsPushEnabled: to.Ptr(true), - // NoCache: to.Ptr(false), - // }, - // Trigger: &armcontainerregistry.TriggerProperties{ - // BaseImageTrigger: &armcontainerregistry.BaseImageTrigger{ - // Name: to.Ptr("myBaseImageTrigger"), - // BaseImageTriggerType: to.Ptr(armcontainerregistry.BaseImageTriggerTypeRuntime), - // Status: to.Ptr(armcontainerregistry.TriggerStatusEnabled), - // }, - // SourceTriggers: []*armcontainerregistry.SourceTrigger{ - // { - // Name: to.Ptr("mySourceTrigger"), - // SourceRepository: &armcontainerregistry.SourceProperties{ - // Branch: to.Ptr("master"), - // RepositoryURL: to.Ptr("https://github.com/Azure/azure-rest-api-specs"), - // SourceControlType: to.Ptr(armcontainerregistry.SourceControlTypeGithub), - // }, - // SourceTriggerEvents: []*armcontainerregistry.SourceTriggerEvent{ - // to.Ptr(armcontainerregistry.SourceTriggerEventCommit)}, - // Status: to.Ptr(armcontainerregistry.TriggerStatusEnabled), - // }}, - // TimerTriggers: []*armcontainerregistry.TimerTrigger{ - // { - // Name: to.Ptr("myTimerTrigger"), - // Schedule: to.Ptr("30 9 * * 1-5"), - // 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/2019-06-01-preview/examples/TasksDelete.json -func ExampleTasksClient_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.NewTasksClient().BeginDelete(ctx, "myResourceGroup", "myRegistry", "myTask", 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/2019-06-01-preview/examples/TasksUpdate.json -func ExampleTasksClient_BeginUpdate_tasksUpdate() { - 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.NewTasksClient().BeginUpdate(ctx, "myResourceGroup", "myRegistry", "myTask", armcontainerregistry.TaskUpdateParameters{ - Properties: &armcontainerregistry.TaskPropertiesUpdateParameters{ - AgentConfiguration: &armcontainerregistry.AgentProperties{ - CPU: to.Ptr[int32](3), - }, - Credentials: &armcontainerregistry.Credentials{ - CustomRegistries: map[string]*armcontainerregistry.CustomRegistryCredentials{ - "myregistry.azurecr.io": { - Identity: to.Ptr("[system]"), - Password: &armcontainerregistry.SecretObject{ - Type: to.Ptr(armcontainerregistry.SecretObjectTypeVaultsecret), - Value: to.Ptr("https://myacbvault.vault.azure.net/secrets/password"), - }, - UserName: &armcontainerregistry.SecretObject{ - Type: to.Ptr(armcontainerregistry.SecretObjectTypeOpaque), - Value: to.Ptr("username"), - }, - }, - }, - }, - LogTemplate: to.Ptr("acr/tasks:{{.Run.OS}}"), - Status: to.Ptr(armcontainerregistry.TaskStatusEnabled), - Step: &armcontainerregistry.DockerBuildStepUpdateParameters{ - Type: to.Ptr(armcontainerregistry.StepTypeDocker), - DockerFilePath: to.Ptr("src/DockerFile"), - ImageNames: []*string{ - to.Ptr("azurerest:testtag1")}, - }, - Trigger: &armcontainerregistry.TriggerUpdateParameters{ - SourceTriggers: []*armcontainerregistry.SourceTriggerUpdateParameters{ - { - Name: to.Ptr("mySourceTrigger"), - SourceRepository: &armcontainerregistry.SourceUpdateParameters{ - SourceControlAuthProperties: &armcontainerregistry.AuthInfoUpdateParameters{ - Token: to.Ptr("xxxxx"), - TokenType: to.Ptr(armcontainerregistry.TokenTypePAT), - }, - }, - SourceTriggerEvents: []*armcontainerregistry.SourceTriggerEvent{ - to.Ptr(armcontainerregistry.SourceTriggerEventCommit)}, - }}, - }, - }, - Tags: map[string]*string{ - "testkey": to.Ptr("value"), - }, - }, 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.Task = armcontainerregistry.Task{ - // Name: to.Ptr("myTask"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/tasks"), - // ID: to.Ptr("/subscriptions/4385cf00-2d3a-425a-832f-f4285b1c9dce/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tasks/myTask"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "testkey": to.Ptr("value"), - // }, - // Identity: &armcontainerregistry.IdentityProperties{ - // Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("fa153151-b9fd-46f4-9088-5e6600f2689v"), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-abu4gm510ccd"), - // }, - // Properties: &armcontainerregistry.TaskProperties{ - // AgentConfiguration: &armcontainerregistry.AgentProperties{ - // CPU: to.Ptr[int32](3), - // }, - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T06:54:23.536Z"); return t}()), - // Credentials: &armcontainerregistry.Credentials{ - // CustomRegistries: map[string]*armcontainerregistry.CustomRegistryCredentials{ - // "myregistry.azurecr.io": nil, - // }, - // }, - // LogTemplate: to.Ptr("acr/tasks:{{.Run.OS}}"), - // Platform: &armcontainerregistry.PlatformProperties{ - // Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - // OS: to.Ptr(armcontainerregistry.OSLinux), - // }, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Status: to.Ptr(armcontainerregistry.TaskStatusEnabled), - // Step: &armcontainerregistry.DockerBuildStep{ - // Type: to.Ptr(armcontainerregistry.StepTypeDocker), - // ContextPath: to.Ptr("src"), - // Arguments: []*armcontainerregistry.Argument{ - // { - // Name: to.Ptr("mytestargument"), - // IsSecret: to.Ptr(false), - // Value: to.Ptr("mytestvalue"), - // }}, - // DockerFilePath: to.Ptr("src/DockerFile"), - // ImageNames: []*string{ - // to.Ptr("azurerest:testtag1")}, - // IsPushEnabled: to.Ptr(true), - // NoCache: to.Ptr(false), - // }, - // Trigger: &armcontainerregistry.TriggerProperties{ - // BaseImageTrigger: &armcontainerregistry.BaseImageTrigger{ - // Name: to.Ptr("myBaseImageTrigger"), - // BaseImageTriggerType: to.Ptr(armcontainerregistry.BaseImageTriggerTypeRuntime), - // Status: to.Ptr(armcontainerregistry.TriggerStatusEnabled), - // UpdateTriggerPayloadType: to.Ptr(armcontainerregistry.UpdateTriggerPayloadTypeDefault), - // }, - // SourceTriggers: []*armcontainerregistry.SourceTrigger{ - // { - // Name: to.Ptr("mySourceTrigger"), - // SourceRepository: &armcontainerregistry.SourceProperties{ - // Branch: to.Ptr("master"), - // RepositoryURL: to.Ptr("https://github.com/Azure/azure-rest-api-specs"), - // SourceControlType: to.Ptr(armcontainerregistry.SourceControlTypeGithub), - // }, - // SourceTriggerEvents: []*armcontainerregistry.SourceTriggerEvent{ - // to.Ptr(armcontainerregistry.SourceTriggerEventCommit)}, - // Status: to.Ptr(armcontainerregistry.TriggerStatusEnabled), - // }}, - // TimerTriggers: []*armcontainerregistry.TimerTrigger{ - // { - // Name: to.Ptr("myTimerTrigger"), - // Schedule: to.Ptr("30 9 * * 1-5"), - // 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/2019-06-01-preview/examples/TasksUpdate_QuickTask.json -func ExampleTasksClient_BeginUpdate_tasksUpdateQuickTask() { - 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.NewTasksClient().BeginUpdate(ctx, "myResourceGroup", "myRegistry", "quicktask", armcontainerregistry.TaskUpdateParameters{ - Properties: &armcontainerregistry.TaskPropertiesUpdateParameters{ - LogTemplate: to.Ptr("acr/tasks:{{.Run.OS}}"), - Status: to.Ptr(armcontainerregistry.TaskStatusEnabled), - }, - Tags: map[string]*string{ - "testkey": to.Ptr("value"), - }, - }, 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.Task = armcontainerregistry.Task{ - // Name: to.Ptr("myTask"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/tasks"), - // ID: to.Ptr("/subscriptions/4385cf00-2d3a-425a-832f-f4285b1c9dce/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tasks/myTask"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "testkey": to.Ptr("value"), - // }, - // Properties: &armcontainerregistry.TaskProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T06:54:23.536Z"); return t}()), - // LogTemplate: to.Ptr("acr/tasks:{{.Run.OS}}"), - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Status: to.Ptr(armcontainerregistry.TaskStatusEnabled), - // }, - // } -} - -// 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 -func ExampleTasksClient_BeginUpdate_tasksUpdateWithKeyVaultCustomCredentials() { - 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.NewTasksClient().BeginUpdate(ctx, "myResourceGroup", "myRegistry", "myTask", armcontainerregistry.TaskUpdateParameters{ - Properties: &armcontainerregistry.TaskPropertiesUpdateParameters{ - AgentConfiguration: &armcontainerregistry.AgentProperties{ - CPU: to.Ptr[int32](3), - }, - Credentials: &armcontainerregistry.Credentials{ - CustomRegistries: map[string]*armcontainerregistry.CustomRegistryCredentials{ - "myregistry.azurecr.io": { - Identity: to.Ptr("[system]"), - Password: &armcontainerregistry.SecretObject{ - Type: to.Ptr(armcontainerregistry.SecretObjectTypeVaultsecret), - Value: to.Ptr("https://myacbvault.vault.azure.net/secrets/password"), - }, - UserName: &armcontainerregistry.SecretObject{ - Type: to.Ptr(armcontainerregistry.SecretObjectTypeVaultsecret), - Value: to.Ptr("https://myacbvault.vault.azure.net/secrets/username"), - }, - }, - }, - }, - Status: to.Ptr(armcontainerregistry.TaskStatusEnabled), - Step: &armcontainerregistry.DockerBuildStepUpdateParameters{ - Type: to.Ptr(armcontainerregistry.StepTypeDocker), - DockerFilePath: to.Ptr("src/DockerFile"), - ImageNames: []*string{ - to.Ptr("azurerest:testtag1")}, - }, - Trigger: &armcontainerregistry.TriggerUpdateParameters{ - SourceTriggers: []*armcontainerregistry.SourceTriggerUpdateParameters{ - { - Name: to.Ptr("mySourceTrigger"), - SourceRepository: &armcontainerregistry.SourceUpdateParameters{ - SourceControlAuthProperties: &armcontainerregistry.AuthInfoUpdateParameters{ - Token: to.Ptr("xxxxx"), - TokenType: to.Ptr(armcontainerregistry.TokenTypePAT), - }, - }, - SourceTriggerEvents: []*armcontainerregistry.SourceTriggerEvent{ - to.Ptr(armcontainerregistry.SourceTriggerEventCommit)}, - }}, - }, - }, - Tags: map[string]*string{ - "testkey": to.Ptr("value"), - }, - }, 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.Task = armcontainerregistry.Task{ - // Name: to.Ptr("myTask"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/tasks"), - // ID: to.Ptr("/subscriptions/4385cf00-2d3a-425a-832f-f4285b1c9dce/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tasks/myTask"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "testkey": to.Ptr("value"), - // }, - // Identity: &armcontainerregistry.IdentityProperties{ - // Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("fa153151-b9fd-46f4-9088-5e6600f2689v"), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-abu4gm510ccd"), - // }, - // Properties: &armcontainerregistry.TaskProperties{ - // AgentConfiguration: &armcontainerregistry.AgentProperties{ - // CPU: to.Ptr[int32](3), - // }, - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T06:54:23.536Z"); return t}()), - // Credentials: &armcontainerregistry.Credentials{ - // CustomRegistries: map[string]*armcontainerregistry.CustomRegistryCredentials{ - // "myregistry.azurecr.io": nil, - // }, - // }, - // Platform: &armcontainerregistry.PlatformProperties{ - // Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - // OS: to.Ptr(armcontainerregistry.OSLinux), - // }, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Status: to.Ptr(armcontainerregistry.TaskStatusEnabled), - // Step: &armcontainerregistry.DockerBuildStep{ - // Type: to.Ptr(armcontainerregistry.StepTypeDocker), - // ContextPath: to.Ptr("src"), - // Arguments: []*armcontainerregistry.Argument{ - // { - // Name: to.Ptr("mytestargument"), - // IsSecret: to.Ptr(false), - // Value: to.Ptr("mytestvalue"), - // }}, - // DockerFilePath: to.Ptr("src/DockerFile"), - // ImageNames: []*string{ - // to.Ptr("azurerest:testtag1")}, - // IsPushEnabled: to.Ptr(true), - // NoCache: to.Ptr(false), - // }, - // Trigger: &armcontainerregistry.TriggerProperties{ - // BaseImageTrigger: &armcontainerregistry.BaseImageTrigger{ - // Name: to.Ptr("myBaseImageTrigger"), - // BaseImageTriggerType: to.Ptr(armcontainerregistry.BaseImageTriggerTypeRuntime), - // Status: to.Ptr(armcontainerregistry.TriggerStatusEnabled), - // UpdateTriggerEndpoint: to.Ptr("https://user:pass@mycicd.webhook.com?token=foo"), - // UpdateTriggerPayloadType: to.Ptr(armcontainerregistry.UpdateTriggerPayloadTypeToken), - // }, - // SourceTriggers: []*armcontainerregistry.SourceTrigger{ - // { - // Name: to.Ptr("mySourceTrigger"), - // SourceRepository: &armcontainerregistry.SourceProperties{ - // Branch: to.Ptr("master"), - // RepositoryURL: to.Ptr("https://github.com/Azure/azure-rest-api-specs"), - // SourceControlType: to.Ptr(armcontainerregistry.SourceControlTypeGithub), - // }, - // SourceTriggerEvents: []*armcontainerregistry.SourceTriggerEvent{ - // to.Ptr(armcontainerregistry.SourceTriggerEventCommit)}, - // Status: to.Ptr(armcontainerregistry.TriggerStatusEnabled), - // }}, - // TimerTriggers: []*armcontainerregistry.TimerTrigger{ - // { - // Name: to.Ptr("myTimerTrigger"), - // Schedule: to.Ptr("30 9 * * 1-5"), - // 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/2019-06-01-preview/examples/ManagedIdentity/TasksUpdate_WithMSICustomCredentials.json -func ExampleTasksClient_BeginUpdate_tasksUpdateWithMsiCustomCredentials() { - 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.NewTasksClient().BeginUpdate(ctx, "myResourceGroup", "myRegistry", "myTask", armcontainerregistry.TaskUpdateParameters{ - Properties: &armcontainerregistry.TaskPropertiesUpdateParameters{ - AgentConfiguration: &armcontainerregistry.AgentProperties{ - CPU: to.Ptr[int32](3), - }, - Credentials: &armcontainerregistry.Credentials{ - CustomRegistries: map[string]*armcontainerregistry.CustomRegistryCredentials{ - "myregistry.azurecr.io": { - Identity: to.Ptr("[system]"), - }, - }, - }, - Status: to.Ptr(armcontainerregistry.TaskStatusEnabled), - Step: &armcontainerregistry.DockerBuildStepUpdateParameters{ - Type: to.Ptr(armcontainerregistry.StepTypeDocker), - DockerFilePath: to.Ptr("src/DockerFile"), - ImageNames: []*string{ - to.Ptr("azurerest:testtag1")}, - }, - Trigger: &armcontainerregistry.TriggerUpdateParameters{ - SourceTriggers: []*armcontainerregistry.SourceTriggerUpdateParameters{ - { - Name: to.Ptr("mySourceTrigger"), - SourceRepository: &armcontainerregistry.SourceUpdateParameters{ - SourceControlAuthProperties: &armcontainerregistry.AuthInfoUpdateParameters{ - Token: to.Ptr("xxxxx"), - TokenType: to.Ptr(armcontainerregistry.TokenTypePAT), - }, - }, - SourceTriggerEvents: []*armcontainerregistry.SourceTriggerEvent{ - to.Ptr(armcontainerregistry.SourceTriggerEventCommit)}, - }}, - }, - }, - Tags: map[string]*string{ - "testkey": to.Ptr("value"), - }, - }, 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.Task = armcontainerregistry.Task{ - // Name: to.Ptr("myTask"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/tasks"), - // ID: to.Ptr("/subscriptions/4385cf00-2d3a-425a-832f-f4285b1c9dce/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tasks/myTask"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "testkey": to.Ptr("value"), - // }, - // Identity: &armcontainerregistry.IdentityProperties{ - // Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("fa153151-b9fd-46f4-9088-5e6600f2689v"), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-abu4gm510ccd"), - // }, - // Properties: &armcontainerregistry.TaskProperties{ - // AgentConfiguration: &armcontainerregistry.AgentProperties{ - // CPU: to.Ptr[int32](3), - // }, - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T06:54:23.536Z"); return t}()), - // Credentials: &armcontainerregistry.Credentials{ - // CustomRegistries: map[string]*armcontainerregistry.CustomRegistryCredentials{ - // "myregistry.azure.io": nil, - // }, - // }, - // Platform: &armcontainerregistry.PlatformProperties{ - // Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - // OS: to.Ptr(armcontainerregistry.OSLinux), - // }, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Status: to.Ptr(armcontainerregistry.TaskStatusEnabled), - // Step: &armcontainerregistry.DockerBuildStep{ - // Type: to.Ptr(armcontainerregistry.StepTypeDocker), - // ContextPath: to.Ptr("src"), - // Arguments: []*armcontainerregistry.Argument{ - // { - // Name: to.Ptr("mytestargument"), - // IsSecret: to.Ptr(false), - // Value: to.Ptr("mytestvalue"), - // }}, - // DockerFilePath: to.Ptr("src/DockerFile"), - // ImageNames: []*string{ - // to.Ptr("azurerest:testtag1")}, - // IsPushEnabled: to.Ptr(true), - // NoCache: to.Ptr(false), - // }, - // Trigger: &armcontainerregistry.TriggerProperties{ - // BaseImageTrigger: &armcontainerregistry.BaseImageTrigger{ - // Name: to.Ptr("myBaseImageTrigger"), - // BaseImageTriggerType: to.Ptr(armcontainerregistry.BaseImageTriggerTypeRuntime), - // Status: to.Ptr(armcontainerregistry.TriggerStatusEnabled), - // }, - // SourceTriggers: []*armcontainerregistry.SourceTrigger{ - // { - // Name: to.Ptr("mySourceTrigger"), - // SourceRepository: &armcontainerregistry.SourceProperties{ - // Branch: to.Ptr("master"), - // RepositoryURL: to.Ptr("https://github.com/Azure/azure-rest-api-specs"), - // SourceControlType: to.Ptr(armcontainerregistry.SourceControlTypeGithub), - // }, - // SourceTriggerEvents: []*armcontainerregistry.SourceTriggerEvent{ - // to.Ptr(armcontainerregistry.SourceTriggerEventCommit)}, - // Status: to.Ptr(armcontainerregistry.TriggerStatusEnabled), - // }}, - // TimerTriggers: []*armcontainerregistry.TimerTrigger{ - // { - // Name: to.Ptr("myTimerTrigger"), - // Schedule: to.Ptr("30 9 * * 1-5"), - // 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/2019-06-01-preview/examples/TasksUpdate_WithOpaqueCustomCredentials.json -func ExampleTasksClient_BeginUpdate_tasksUpdateWithOpaqueCustomCredentials() { - 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.NewTasksClient().BeginUpdate(ctx, "myResourceGroup", "myRegistry", "myTask", armcontainerregistry.TaskUpdateParameters{ - Properties: &armcontainerregistry.TaskPropertiesUpdateParameters{ - AgentConfiguration: &armcontainerregistry.AgentProperties{ - CPU: to.Ptr[int32](3), - }, - Credentials: &armcontainerregistry.Credentials{ - CustomRegistries: map[string]*armcontainerregistry.CustomRegistryCredentials{ - "myregistry.azurecr.io": { - Password: &armcontainerregistry.SecretObject{ - Type: to.Ptr(armcontainerregistry.SecretObjectTypeOpaque), - Value: to.Ptr("***"), - }, - UserName: &armcontainerregistry.SecretObject{ - Type: to.Ptr(armcontainerregistry.SecretObjectTypeOpaque), - Value: to.Ptr("username"), - }, - }, - }, - }, - Status: to.Ptr(armcontainerregistry.TaskStatusEnabled), - Step: &armcontainerregistry.DockerBuildStepUpdateParameters{ - Type: to.Ptr(armcontainerregistry.StepTypeDocker), - DockerFilePath: to.Ptr("src/DockerFile"), - ImageNames: []*string{ - to.Ptr("azurerest:testtag1")}, - }, - Trigger: &armcontainerregistry.TriggerUpdateParameters{ - SourceTriggers: []*armcontainerregistry.SourceTriggerUpdateParameters{ - { - Name: to.Ptr("mySourceTrigger"), - SourceRepository: &armcontainerregistry.SourceUpdateParameters{ - SourceControlAuthProperties: &armcontainerregistry.AuthInfoUpdateParameters{ - Token: to.Ptr("xxxxx"), - TokenType: to.Ptr(armcontainerregistry.TokenTypePAT), - }, - }, - SourceTriggerEvents: []*armcontainerregistry.SourceTriggerEvent{ - to.Ptr(armcontainerregistry.SourceTriggerEventCommit)}, - }}, - }, - }, - Tags: map[string]*string{ - "testkey": to.Ptr("value"), - }, - }, 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.Task = armcontainerregistry.Task{ - // Name: to.Ptr("myTask"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/tasks"), - // ID: to.Ptr("/subscriptions/4385cf00-2d3a-425a-832f-f4285b1c9dce/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tasks/myTask"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "testkey": to.Ptr("value"), - // }, - // Identity: &armcontainerregistry.IdentityProperties{ - // Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("fa153151-b9fd-46f4-9088-5e6600f2689v"), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-abu4gm510ccd"), - // }, - // Properties: &armcontainerregistry.TaskProperties{ - // AgentConfiguration: &armcontainerregistry.AgentProperties{ - // CPU: to.Ptr[int32](3), - // }, - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-25T06:54:23.536Z"); return t}()), - // Credentials: &armcontainerregistry.Credentials{ - // CustomRegistries: map[string]*armcontainerregistry.CustomRegistryCredentials{ - // "myregistry.azure.io": nil, - // }, - // }, - // Platform: &armcontainerregistry.PlatformProperties{ - // Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - // OS: to.Ptr(armcontainerregistry.OSLinux), - // }, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Status: to.Ptr(armcontainerregistry.TaskStatusEnabled), - // Step: &armcontainerregistry.DockerBuildStep{ - // Type: to.Ptr(armcontainerregistry.StepTypeDocker), - // ContextPath: to.Ptr("src"), - // Arguments: []*armcontainerregistry.Argument{ - // { - // Name: to.Ptr("mytestargument"), - // IsSecret: to.Ptr(false), - // Value: to.Ptr("mytestvalue"), - // }}, - // DockerFilePath: to.Ptr("src/DockerFile"), - // ImageNames: []*string{ - // to.Ptr("azurerest:testtag1")}, - // IsPushEnabled: to.Ptr(true), - // NoCache: to.Ptr(false), - // }, - // Trigger: &armcontainerregistry.TriggerProperties{ - // BaseImageTrigger: &armcontainerregistry.BaseImageTrigger{ - // Name: to.Ptr("myBaseImageTrigger"), - // BaseImageTriggerType: to.Ptr(armcontainerregistry.BaseImageTriggerTypeRuntime), - // Status: to.Ptr(armcontainerregistry.TriggerStatusEnabled), - // }, - // SourceTriggers: []*armcontainerregistry.SourceTrigger{ - // { - // Name: to.Ptr("mySourceTrigger"), - // SourceRepository: &armcontainerregistry.SourceProperties{ - // Branch: to.Ptr("master"), - // RepositoryURL: to.Ptr("https://github.com/Azure/azure-rest-api-specs"), - // SourceControlType: to.Ptr(armcontainerregistry.SourceControlTypeGithub), - // }, - // SourceTriggerEvents: []*armcontainerregistry.SourceTriggerEvent{ - // to.Ptr(armcontainerregistry.SourceTriggerEventCommit)}, - // Status: to.Ptr(armcontainerregistry.TriggerStatusEnabled), - // }}, - // TimerTriggers: []*armcontainerregistry.TimerTrigger{ - // { - // Name: to.Ptr("myTimerTrigger"), - // Schedule: to.Ptr("30 9 * * 1-5"), - // 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/2019-06-01-preview/examples/TasksGetDetails.json -func ExampleTasksClient_GetDetails() { - 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.NewTasksClient().GetDetails(ctx, "myResourceGroup", "myRegistry", "myTask", 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.Task = armcontainerregistry.Task{ - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "testkey": to.Ptr("value"), - // }, - // Identity: &armcontainerregistry.IdentityProperties{ - // Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("fa153151-b9fd-46f4-9088-5e6600f2689v"), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-abu4gm510ccd"), - // }, - // Properties: &armcontainerregistry.TaskProperties{ - // AgentConfiguration: &armcontainerregistry.AgentProperties{ - // CPU: to.Ptr[int32](2), - // }, - // Credentials: &armcontainerregistry.Credentials{ - // CustomRegistries: map[string]*armcontainerregistry.CustomRegistryCredentials{ - // "myregistry.azure-test.io": &armcontainerregistry.CustomRegistryCredentials{ - // Identity: to.Ptr("[system]"), - // Password: &armcontainerregistry.SecretObject{ - // Type: to.Ptr(armcontainerregistry.SecretObjectTypeVaultsecret), - // Value: to.Ptr("https://myacbvault.vault.azure.net/secrets/username"), - // }, - // UserName: &armcontainerregistry.SecretObject{ - // Type: to.Ptr(armcontainerregistry.SecretObjectTypeOpaque), - // Value: to.Ptr("username"), - // }, - // }, - // }, - // }, - // IsSystemTask: to.Ptr(false), - // Platform: &armcontainerregistry.PlatformProperties{ - // Architecture: to.Ptr(armcontainerregistry.ArchitectureAmd64), - // OS: to.Ptr(armcontainerregistry.OSLinux), - // }, - // Status: to.Ptr(armcontainerregistry.TaskStatusEnabled), - // Step: &armcontainerregistry.DockerBuildStep{ - // Type: to.Ptr(armcontainerregistry.StepTypeDocker), - // ContextPath: to.Ptr("src"), - // Arguments: []*armcontainerregistry.Argument{ - // { - // Name: to.Ptr("mytestargument"), - // IsSecret: to.Ptr(false), - // Value: to.Ptr("mytestvalue"), - // }, - // { - // Name: to.Ptr("mysecrettestargument"), - // IsSecret: to.Ptr(true), - // Value: to.Ptr("mysecrettestvalue"), - // }}, - // DockerFilePath: to.Ptr("src/DockerFile"), - // ImageNames: []*string{ - // to.Ptr("azurerest:testtag")}, - // IsPushEnabled: to.Ptr(true), - // NoCache: to.Ptr(false), - // }, - // Trigger: &armcontainerregistry.TriggerProperties{ - // BaseImageTrigger: &armcontainerregistry.BaseImageTrigger{ - // Name: to.Ptr("myBaseImageTrigger"), - // BaseImageTriggerType: to.Ptr(armcontainerregistry.BaseImageTriggerTypeRuntime), - // Status: to.Ptr(armcontainerregistry.TriggerStatusEnabled), - // UpdateTriggerEndpoint: to.Ptr("https://user:pass@mycicd.webhook.com?token=foo"), - // UpdateTriggerPayloadType: to.Ptr(armcontainerregistry.UpdateTriggerPayloadTypeToken), - // }, - // SourceTriggers: []*armcontainerregistry.SourceTrigger{ - // { - // Name: to.Ptr("mySourceTrigger"), - // SourceRepository: &armcontainerregistry.SourceProperties{ - // Branch: to.Ptr("master"), - // RepositoryURL: to.Ptr("https://github.com/Azure/azure-rest-api-specs"), - // SourceControlAuthProperties: &armcontainerregistry.AuthInfo{ - // Token: to.Ptr("xxxxx"), - // TokenType: to.Ptr(armcontainerregistry.TokenTypePAT), - // }, - // SourceControlType: to.Ptr(armcontainerregistry.SourceControlTypeGithub), - // }, - // SourceTriggerEvents: []*armcontainerregistry.SourceTriggerEvent{ - // to.Ptr(armcontainerregistry.SourceTriggerEventCommit)}, - // Status: to.Ptr(armcontainerregistry.TriggerStatusEnabled), - // }}, - // TimerTriggers: []*armcontainerregistry.TimerTrigger{ - // { - // Name: to.Ptr("myTimerTrigger"), - // Schedule: to.Ptr("30 9 * * 1-5"), - // Status: to.Ptr(armcontainerregistry.TriggerStatusEnabled), - // }}, - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_client.go index 3ad86fab3896..ebfc677ac1cc 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-preview // - 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-preview 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-preview") 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-preview // - 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-preview 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-preview") 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-preview // - 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-preview") 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-preview // - 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-preview") 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-preview // - 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-preview 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-preview") 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 deleted file mode 100644 index 5dcabaafeffc..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_client_example_test.go +++ /dev/null @@ -1,218 +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/TokenList.json -func ExampleTokensClient_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.NewTokensClient().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.TokenListResult = armcontainerregistry.TokenListResult{ - // Value: []*armcontainerregistry.Token{ - // { - // Name: to.Ptr("myToken"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/tokens"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/myToken"), - // Properties: &armcontainerregistry.TokenProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T23:14:37.0707808Z"); return t}()), - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // ScopeMapID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/scopeMaps/myScopeMap"), - // Status: to.Ptr(armcontainerregistry.TokenStatusEnabled), - // }, - // }}, - // } - } -} - -// 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 -func ExampleTokensClient_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.NewTokensClient().Get(ctx, "myResourceGroup", "myRegistry", "myToken", 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.Token = armcontainerregistry.Token{ - // Name: to.Ptr("myToken"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/tokens"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/myToken"), - // Properties: &armcontainerregistry.TokenProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T23:14:37.0707808Z"); return t}()), - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // ScopeMapID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/scopeMaps/myScopeMap"), - // Status: to.Ptr(armcontainerregistry.TokenStatusEnabled), - // }, - // } -} - -// 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 -func ExampleTokensClient_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.NewTokensClient().BeginCreate(ctx, "myResourceGroup", "myRegistry", "myToken", armcontainerregistry.Token{ - Properties: &armcontainerregistry.TokenProperties{ - Credentials: &armcontainerregistry.TokenCredentialsProperties{ - Certificates: []*armcontainerregistry.TokenCertificate{ - { - Name: to.Ptr(armcontainerregistry.TokenCertificateNameCertificate1), - EncodedPemCertificate: to.Ptr("LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUc3akNDQk5hZ0F3SUJBZ0lURmdBQlR3UVpyZGdmdmhxdzBnQUFBQUZQQkRBTkJna3Foa2lHOXcwQkFRc0YKQURDQml6RUxNQWtHQTFVRUJoTUNWVk14RXpBUkJnTlZCQWdUQ2xkaGMyaHBibWQwYjI0eEVEQU9CZ05WQkFjVApCMUpsWkcxdmJtUXhIakFjQmdOVkJBb1RGVTFwWTNKdmMyOW1kQ0JEYjNKd2IzSmhkR2x2YmpFVk1CTUdBMVVFCkN4TU1UV2xqY205emIyWjBJRWxVTVI0d0hBWURWUVFERXhWTmFXTnliM052Wm5RZ1NWUWdWRXhUSUVOQklEUXcKSGhjTk1UZ3dOREV5TWpJek1qUTRXaGNOTWpBd05ERXlNakl6TWpRNFdqQTVNVGN3TlFZRFZRUURFeTV6WlhKMgphV05sWTJ4cFpXNTBZMlZ5ZEMxd1lYSjBibVZ5TG0xaGJtRm5aVzFsYm5RdVlYcDFjbVV1WTI5dE1JSUJJakFOCkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQTBSYjdJcHpxMmR4emhhbVpyS1ZDakMzeTQyYlYKUnNIY2pCUTFuSDBHZ1puUDhXeDZDSE1mWThybkVJQzRLeVRRYkJXVzhnNXlmc3NSQ0ZXbFpxYjR6SkRXS0pmTgpGSmNMUm9LNnhwTktZYVZVTkVlT25IdUxHYTM0ZlA0VjBFRjZybzdvbkRLME5zanhjY1dZVzRNVXVzc0xrQS94CkUrM2RwU1REdk1KcjJoWUpsVnFDcVR6blQvbmZaVUZzQUVEQnp5MUpOOHZiZDlIR2czc2Myd0x4dk95cFJOc0gKT1V3V2pmN2xzWWZleEVlcWkzY29EeHc2alpLVWEyVkdsUnBpTkowMjhBQitYSi9TU1FVNVBsd0JBbU9TT3ovRApGY0NKdGpPZlBqU1NKckFIQVV3SHU3RzlSV05JTFBwYU9zQ1J5eitETE5zNGpvNlEvUUg4d1lManJRSURBUUFCCm80SUNtakNDQXBZd0N3WURWUjBQQkFRREFnU3dNQjBHQTFVZEpRUVdNQlFHQ0NzR0FRVUZCd01DQmdnckJnRUYKQlFjREFUQWRCZ05WSFE0RUZnUVVlbEdkVVJrZzJoSFFOWEQ4WUc4L3drdjJVT0F3SHdZRFZSMGpCQmd3Rm9BVQplbnVNd2Mvbm9Nb2MxR3Y2KytFend3OGFvcDB3Z2F3R0ExVWRId1NCcERDQm9UQ0JucUNCbTZDQm1JWkxhSFIwCmNEb3ZMMjF6WTNKc0xtMXBZM0p2YzI5bWRDNWpiMjB2Y0d0cEwyMXpZMjl5Y0M5amNtd3ZUV2xqY205emIyWjAKSlRJd1NWUWxNakJVVEZNbE1qQkRRU1V5TURRdVkzSnNoa2xvZEhSd09pOHZZM0pzTG0xcFkzSnZjMjltZEM1agpiMjB2Y0d0cEwyMXpZMjl5Y0M5amNtd3ZUV2xqY205emIyWjBKVEl3U1ZRbE1qQlVURk1sTWpCRFFTVXlNRFF1ClkzSnNNSUdGQmdnckJnRUZCUWNCQVFSNU1IY3dVUVlJS3dZQkJRVUhNQUtHUldoMGRIQTZMeTkzZDNjdWJXbGoKY205emIyWjBMbU52YlM5d2Eya3ZiWE5qYjNKd0wwMXBZM0p2YzI5bWRDVXlNRWxVSlRJd1ZFeFRKVEl3UTBFbApNakEwTG1OeWREQWlCZ2dyQmdFRkJRY3dBWVlXYUhSMGNEb3ZMMjlqYzNBdWJYTnZZM053TG1OdmJUQStCZ2tyCkJnRUVBWUkzRlFjRU1UQXZCaWNyQmdFRUFZSTNGUWlIMm9aMWcrN1pBWUxKaFJ1QnRaNWhoZlRyWUlGZGhOTGYKUW9Mbmszb0NBV1FDQVIwd1RRWURWUjBnQkVZd1JEQkNCZ2tyQmdFRUFZSTNLZ0V3TlRBekJnZ3JCZ0VGQlFjQwpBUlluYUhSMGNEb3ZMM2QzZHk1dGFXTnliM052Wm5RdVkyOXRMM0JyYVM5dGMyTnZjbkF2WTNCek1DY0dDU3NHCkFRUUJnamNWQ2dRYU1CZ3dDZ1lJS3dZQkJRVUhBd0l3Q2dZSUt3WUJCUVVIQXdFd09RWURWUjBSQkRJd01JSXUKYzJWeWRtbGpaV05zYVdWdWRHTmxjblF0Y0dGeWRHNWxjaTV0WVc1aFoyVnRaVzUwTG1GNmRYSmxMbU52YlRBTgpCZ2txaGtpRzl3MEJBUXNGQUFPQ0FnRUFIVXIzbk1vdUI5WWdDUlRWYndUTllIS2RkWGJkSW1GUXNDYys4T1g1CjE5c0N6dFFSR05iSXEwVW1Ba01MbFVvWTIxckh4ZXdxU2hWczFhL2RwaFh5Tk1pcUdaU2QzU1BtYzZscitqUFQKNXVEREs0MUlWeXN0K2VUNlpyazFvcCtMVmdkeS9EU2lyNzVqcWZFY016bS82bU8rNnFNeWRLTWtVYmM5K3JHVwphUkpUcjRWUUdIRmEwNEIwZVZpNUd4MG9pL2RpZDNSaXg2aXJMMjFJSGEwYjN6c1hzZHpHU0R2K3hqL2Q2S0l4Ckdrd2FhYmZvU1NoQnFqaFNlQ0VyZXFlb1RpYjljdGw0MGRVdUp3THl4bjhHS2N6K3AvMEJUOEIxU3lYK01OQ2wKY0pkMjVtMjhLajY2TGUxOEVyeFlJYXZJVGVGa3Y2eGZjdkEvcHladDdPaU41QTlGQk1IUmpQK1kyZ2tvdjMrcQpISFRUZG4xNnlRajduNit3YlFHNGVleXc0YisyQkRLcUxNVFU2ZmlSQ3ZPM2FPZVBLSFVNN3R4b1FidWl6Z3NzCkNiMzl3QnJOTEZsMkJLQ1RkSCtkSU9oZVJiSkZvbmlwOGRPOUVFZWdSSG9lQW54ZUlYTFBrdXMzTzEvZjRhNkIKWHQ3RG5BUm8xSzJmeEp3VXRaU2MvR3dFSjU5NzlnRXlEa3pDZEVsLzdpWE9QZXVjTXhlM2xVM2pweUtsNERUaApjSkJqQytqNGpLWTFrK1U4b040aGdqYnJISUx6Vnd2eU15OU5KS290U3BMSjQxeHdPOHlGangxalFTT3Bxc0N1ClFhUFUvTjhSZ0hxWjBGTkFzS3dNUmZ6WmdXanRCNzRzYUVEdk5jVmNuNFhCQnFNSG0ydHo2Uzk3d3kxZGt0cTgKSE5BPQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg=="), - }}, - }, - ScopeMapID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/scopeMaps/myScopeMap"), - Status: to.Ptr(armcontainerregistry.TokenStatusDisabled), - }, - }, 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.Token = armcontainerregistry.Token{ - // Name: to.Ptr("myToken"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/tokens"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/myToken"), - // Properties: &armcontainerregistry.TokenProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T23:14:37.0707808Z"); return t}()), - // Credentials: &armcontainerregistry.TokenCredentialsProperties{ - // Certificates: []*armcontainerregistry.TokenCertificate{ - // { - // Name: to.Ptr(armcontainerregistry.TokenCertificateNameCertificate1), - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-04T15:32:48.0707808Z"); return t}()), - // Thumbprint: to.Ptr("feeb79a888bf1415f8e17c4965a2a5bb5c8a2ff7"), - // }}, - // }, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // ScopeMapID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/scopeMaps/myScopeMap"), - // Status: to.Ptr(armcontainerregistry.TokenStatusDisabled), - // }, - // } -} - -// 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 -func ExampleTokensClient_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.NewTokensClient().BeginDelete(ctx, "myResourceGroup", "myRegistry", "myToken", 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/TokenUpdate.json -func ExampleTokensClient_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.NewTokensClient().BeginUpdate(ctx, "myResourceGroup", "myRegistry", "myToken", armcontainerregistry.TokenUpdateParameters{ - Properties: &armcontainerregistry.TokenUpdateProperties{ - Credentials: &armcontainerregistry.TokenCredentialsProperties{ - Certificates: []*armcontainerregistry.TokenCertificate{ - { - Name: to.Ptr(armcontainerregistry.TokenCertificateNameCertificate1), - EncodedPemCertificate: to.Ptr("LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUc3akNDQk5hZ0F3SUJBZ0lURmdBQlR3UVpyZGdmdmhxdzBnQUFBQUZQQkRBTkJna3Foa2lHOXcwQkFRc0YKQURDQml6RUxNQWtHQTFVRUJoTUNWVk14RXpBUkJnTlZCQWdUQ2xkaGMyaHBibWQwYjI0eEVEQU9CZ05WQkFjVApCMUpsWkcxdmJtUXhIakFjQmdOVkJBb1RGVTFwWTNKdmMyOW1kQ0JEYjNKd2IzSmhkR2x2YmpFVk1CTUdBMVVFCkN4TU1UV2xqY205emIyWjBJRWxVTVI0d0hBWURWUVFERXhWTmFXTnliM052Wm5RZ1NWUWdWRXhUSUVOQklEUXcKSGhjTk1UZ3dOREV5TWpJek1qUTRXaGNOTWpBd05ERXlNakl6TWpRNFdqQTVNVGN3TlFZRFZRUURFeTV6WlhKMgphV05sWTJ4cFpXNTBZMlZ5ZEMxd1lYSjBibVZ5TG0xaGJtRm5aVzFsYm5RdVlYcDFjbVV1WTI5dE1JSUJJakFOCkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQTBSYjdJcHpxMmR4emhhbVpyS1ZDakMzeTQyYlYKUnNIY2pCUTFuSDBHZ1puUDhXeDZDSE1mWThybkVJQzRLeVRRYkJXVzhnNXlmc3NSQ0ZXbFpxYjR6SkRXS0pmTgpGSmNMUm9LNnhwTktZYVZVTkVlT25IdUxHYTM0ZlA0VjBFRjZybzdvbkRLME5zanhjY1dZVzRNVXVzc0xrQS94CkUrM2RwU1REdk1KcjJoWUpsVnFDcVR6blQvbmZaVUZzQUVEQnp5MUpOOHZiZDlIR2czc2Myd0x4dk95cFJOc0gKT1V3V2pmN2xzWWZleEVlcWkzY29EeHc2alpLVWEyVkdsUnBpTkowMjhBQitYSi9TU1FVNVBsd0JBbU9TT3ovRApGY0NKdGpPZlBqU1NKckFIQVV3SHU3RzlSV05JTFBwYU9zQ1J5eitETE5zNGpvNlEvUUg4d1lManJRSURBUUFCCm80SUNtakNDQXBZd0N3WURWUjBQQkFRREFnU3dNQjBHQTFVZEpRUVdNQlFHQ0NzR0FRVUZCd01DQmdnckJnRUYKQlFjREFUQWRCZ05WSFE0RUZnUVVlbEdkVVJrZzJoSFFOWEQ4WUc4L3drdjJVT0F3SHdZRFZSMGpCQmd3Rm9BVQplbnVNd2Mvbm9Nb2MxR3Y2KytFend3OGFvcDB3Z2F3R0ExVWRId1NCcERDQm9UQ0JucUNCbTZDQm1JWkxhSFIwCmNEb3ZMMjF6WTNKc0xtMXBZM0p2YzI5bWRDNWpiMjB2Y0d0cEwyMXpZMjl5Y0M5amNtd3ZUV2xqY205emIyWjAKSlRJd1NWUWxNakJVVEZNbE1qQkRRU1V5TURRdVkzSnNoa2xvZEhSd09pOHZZM0pzTG0xcFkzSnZjMjltZEM1agpiMjB2Y0d0cEwyMXpZMjl5Y0M5amNtd3ZUV2xqY205emIyWjBKVEl3U1ZRbE1qQlVURk1sTWpCRFFTVXlNRFF1ClkzSnNNSUdGQmdnckJnRUZCUWNCQVFSNU1IY3dVUVlJS3dZQkJRVUhNQUtHUldoMGRIQTZMeTkzZDNjdWJXbGoKY205emIyWjBMbU52YlM5d2Eya3ZiWE5qYjNKd0wwMXBZM0p2YzI5bWRDVXlNRWxVSlRJd1ZFeFRKVEl3UTBFbApNakEwTG1OeWREQWlCZ2dyQmdFRkJRY3dBWVlXYUhSMGNEb3ZMMjlqYzNBdWJYTnZZM053TG1OdmJUQStCZ2tyCkJnRUVBWUkzRlFjRU1UQXZCaWNyQmdFRUFZSTNGUWlIMm9aMWcrN1pBWUxKaFJ1QnRaNWhoZlRyWUlGZGhOTGYKUW9Mbmszb0NBV1FDQVIwd1RRWURWUjBnQkVZd1JEQkNCZ2tyQmdFRUFZSTNLZ0V3TlRBekJnZ3JCZ0VGQlFjQwpBUlluYUhSMGNEb3ZMM2QzZHk1dGFXTnliM052Wm5RdVkyOXRMM0JyYVM5dGMyTnZjbkF2WTNCek1DY0dDU3NHCkFRUUJnamNWQ2dRYU1CZ3dDZ1lJS3dZQkJRVUhBd0l3Q2dZSUt3WUJCUVVIQXdFd09RWURWUjBSQkRJd01JSXUKYzJWeWRtbGpaV05zYVdWdWRHTmxjblF0Y0dGeWRHNWxjaTV0WVc1aFoyVnRaVzUwTG1GNmRYSmxMbU52YlRBTgpCZ2txaGtpRzl3MEJBUXNGQUFPQ0FnRUFIVXIzbk1vdUI5WWdDUlRWYndUTllIS2RkWGJkSW1GUXNDYys4T1g1CjE5c0N6dFFSR05iSXEwVW1Ba01MbFVvWTIxckh4ZXdxU2hWczFhL2RwaFh5Tk1pcUdaU2QzU1BtYzZscitqUFQKNXVEREs0MUlWeXN0K2VUNlpyazFvcCtMVmdkeS9EU2lyNzVqcWZFY016bS82bU8rNnFNeWRLTWtVYmM5K3JHVwphUkpUcjRWUUdIRmEwNEIwZVZpNUd4MG9pL2RpZDNSaXg2aXJMMjFJSGEwYjN6c1hzZHpHU0R2K3hqL2Q2S0l4Ckdrd2FhYmZvU1NoQnFqaFNlQ0VyZXFlb1RpYjljdGw0MGRVdUp3THl4bjhHS2N6K3AvMEJUOEIxU3lYK01OQ2wKY0pkMjVtMjhLajY2TGUxOEVyeFlJYXZJVGVGa3Y2eGZjdkEvcHladDdPaU41QTlGQk1IUmpQK1kyZ2tvdjMrcQpISFRUZG4xNnlRajduNit3YlFHNGVleXc0YisyQkRLcUxNVFU2ZmlSQ3ZPM2FPZVBLSFVNN3R4b1FidWl6Z3NzCkNiMzl3QnJOTEZsMkJLQ1RkSCtkSU9oZVJiSkZvbmlwOGRPOUVFZWdSSG9lQW54ZUlYTFBrdXMzTzEvZjRhNkIKWHQ3RG5BUm8xSzJmeEp3VXRaU2MvR3dFSjU5NzlnRXlEa3pDZEVsLzdpWE9QZXVjTXhlM2xVM2pweUtsNERUaApjSkJqQytqNGpLWTFrK1U4b040aGdqYnJISUx6Vnd2eU15OU5KS290U3BMSjQxeHdPOHlGangxalFTT3Bxc0N1ClFhUFUvTjhSZ0hxWjBGTkFzS3dNUmZ6WmdXanRCNzRzYUVEdk5jVmNuNFhCQnFNSG0ydHo2Uzk3d3kxZGt0cTgKSE5BPQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg=="), - }}, - }, - ScopeMapID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/scopeMaps/myNewScopeMap"), - }, - }, 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.Token = armcontainerregistry.Token{ - // Name: to.Ptr("myToken"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/tokens"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/myToken"), - // Properties: &armcontainerregistry.TokenProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T23:14:37.0707808Z"); return t}()), - // Credentials: &armcontainerregistry.TokenCredentialsProperties{ - // Certificates: []*armcontainerregistry.TokenCertificate{ - // { - // Name: to.Ptr(armcontainerregistry.TokenCertificateNameCertificate1), - // EncodedPemCertificate: to.Ptr("LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUc3akNDQk5hZ0F3SUJBZ0lURmdBQlR3UVpyZGdmdmhxdzBnQUFBQUZQQkRBTkJna3Foa2lHOXcwQkFRc0YKQURDQml6RUxNQWtHQTFVRUJoTUNWVk14RXpBUkJnTlZCQWdUQ2xkaGMyaHBibWQwYjI0eEVEQU9CZ05WQkFjVApCMUpsWkcxdmJtUXhIakFjQmdOVkJBb1RGVTFwWTNKdmMyOW1kQ0JEYjNKd2IzSmhkR2x2YmpFVk1CTUdBMVVFCkN4TU1UV2xqY205emIyWjBJRWxVTVI0d0hBWURWUVFERXhWTmFXTnliM052Wm5RZ1NWUWdWRXhUSUVOQklEUXcKSGhjTk1UZ3dOREV5TWpJek1qUTRXaGNOTWpBd05ERXlNakl6TWpRNFdqQTVNVGN3TlFZRFZRUURFeTV6WlhKMgphV05sWTJ4cFpXNTBZMlZ5ZEMxd1lYSjBibVZ5TG0xaGJtRm5aVzFsYm5RdVlYcDFjbVV1WTI5dE1JSUJJakFOCkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQTBSYjdJcHpxMmR4emhhbVpyS1ZDakMzeTQyYlYKUnNIY2pCUTFuSDBHZ1puUDhXeDZDSE1mWThybkVJQzRLeVRRYkJXVzhnNXlmc3NSQ0ZXbFpxYjR6SkRXS0pmTgpGSmNMUm9LNnhwTktZYVZVTkVlT25IdUxHYTM0ZlA0VjBFRjZybzdvbkRLME5zanhjY1dZVzRNVXVzc0xrQS94CkUrM2RwU1REdk1KcjJoWUpsVnFDcVR6blQvbmZaVUZzQUVEQnp5MUpOOHZiZDlIR2czc2Myd0x4dk95cFJOc0gKT1V3V2pmN2xzWWZleEVlcWkzY29EeHc2alpLVWEyVkdsUnBpTkowMjhBQitYSi9TU1FVNVBsd0JBbU9TT3ovRApGY0NKdGpPZlBqU1NKckFIQVV3SHU3RzlSV05JTFBwYU9zQ1J5eitETE5zNGpvNlEvUUg4d1lManJRSURBUUFCCm80SUNtakNDQXBZd0N3WURWUjBQQkFRREFnU3dNQjBHQTFVZEpRUVdNQlFHQ0NzR0FRVUZCd01DQmdnckJnRUYKQlFjREFUQWRCZ05WSFE0RUZnUVVlbEdkVVJrZzJoSFFOWEQ4WUc4L3drdjJVT0F3SHdZRFZSMGpCQmd3Rm9BVQplbnVNd2Mvbm9Nb2MxR3Y2KytFend3OGFvcDB3Z2F3R0ExVWRId1NCcERDQm9UQ0JucUNCbTZDQm1JWkxhSFIwCmNEb3ZMMjF6WTNKc0xtMXBZM0p2YzI5bWRDNWpiMjB2Y0d0cEwyMXpZMjl5Y0M5amNtd3ZUV2xqY205emIyWjAKSlRJd1NWUWxNakJVVEZNbE1qQkRRU1V5TURRdVkzSnNoa2xvZEhSd09pOHZZM0pzTG0xcFkzSnZjMjltZEM1agpiMjB2Y0d0cEwyMXpZMjl5Y0M5amNtd3ZUV2xqY205emIyWjBKVEl3U1ZRbE1qQlVURk1sTWpCRFFTVXlNRFF1ClkzSnNNSUdGQmdnckJnRUZCUWNCQVFSNU1IY3dVUVlJS3dZQkJRVUhNQUtHUldoMGRIQTZMeTkzZDNjdWJXbGoKY205emIyWjBMbU52YlM5d2Eya3ZiWE5qYjNKd0wwMXBZM0p2YzI5bWRDVXlNRWxVSlRJd1ZFeFRKVEl3UTBFbApNakEwTG1OeWREQWlCZ2dyQmdFRkJRY3dBWVlXYUhSMGNEb3ZMMjlqYzNBdWJYTnZZM053TG1OdmJUQStCZ2tyCkJnRUVBWUkzRlFjRU1UQXZCaWNyQmdFRUFZSTNGUWlIMm9aMWcrN1pBWUxKaFJ1QnRaNWhoZlRyWUlGZGhOTGYKUW9Mbmszb0NBV1FDQVIwd1RRWURWUjBnQkVZd1JEQkNCZ2tyQmdFRUFZSTNLZ0V3TlRBekJnZ3JCZ0VGQlFjQwpBUlluYUhSMGNEb3ZMM2QzZHk1dGFXTnliM052Wm5RdVkyOXRMM0JyYVM5dGMyTnZjbkF2WTNCek1DY0dDU3NHCkFRUUJnamNWQ2dRYU1CZ3dDZ1lJS3dZQkJRVUhBd0l3Q2dZSUt3WUJCUVVIQXdFd09RWURWUjBSQkRJd01JSXUKYzJWeWRtbGpaV05zYVdWdWRHTmxjblF0Y0dGeWRHNWxjaTV0WVc1aFoyVnRaVzUwTG1GNmRYSmxMbU52YlRBTgpCZ2txaGtpRzl3MEJBUXNGQUFPQ0FnRUFIVXIzbk1vdUI5WWdDUlRWYndUTllIS2RkWGJkSW1GUXNDYys4T1g1CjE5c0N6dFFSR05iSXEwVW1Ba01MbFVvWTIxckh4ZXdxU2hWczFhL2RwaFh5Tk1pcUdaU2QzU1BtYzZscitqUFQKNXVEREs0MUlWeXN0K2VUNlpyazFvcCtMVmdkeS9EU2lyNzVqcWZFY016bS82bU8rNnFNeWRLTWtVYmM5K3JHVwphUkpUcjRWUUdIRmEwNEIwZVZpNUd4MG9pL2RpZDNSaXg2aXJMMjFJSGEwYjN6c1hzZHpHU0R2K3hqL2Q2S0l4Ckdrd2FhYmZvU1NoQnFqaFNlQ0VyZXFlb1RpYjljdGw0MGRVdUp3THl4bjhHS2N6K3AvMEJUOEIxU3lYK01OQ2wKY0pkMjVtMjhLajY2TGUxOEVyeFlJYXZJVGVGa3Y2eGZjdkEvcHladDdPaU41QTlGQk1IUmpQK1kyZ2tvdjMrcQpISFRUZG4xNnlRajduNit3YlFHNGVleXc0YisyQkRLcUxNVFU2ZmlSQ3ZPM2FPZVBLSFVNN3R4b1FidWl6Z3NzCkNiMzl3QnJOTEZsMkJLQ1RkSCtkSU9oZVJiSkZvbmlwOGRPOUVFZWdSSG9lQW54ZUlYTFBrdXMzTzEvZjRhNkIKWHQ3RG5BUm8xSzJmeEp3VXRaU2MvR3dFSjU5NzlnRXlEa3pDZEVsLzdpWE9QZXVjTXhlM2xVM2pweUtsNERUaApjSkJqQytqNGpLWTFrK1U4b040aGdqYnJISUx6Vnd2eU15OU5KS290U3BMSjQxeHdPOHlGangxalFTT3Bxc0N1ClFhUFUvTjhSZ0hxWjBGTkFzS3dNUmZ6WmdXanRCNzRzYUVEdk5jVmNuNFhCQnFNSG0ydHo2Uzk3d3kxZGt0cTgKSE5BPQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg=="), - // }}, - // }, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // ScopeMapID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/scopeMaps/myNewScopeMap"), - // Status: to.Ptr(armcontainerregistry.TokenStatusEnabled), - // }, - // } -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client.go index 1b42729b4388..4982504e9f76 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-preview // - 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-preview 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-preview") 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-preview // - 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-preview 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-preview") 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-preview // - 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-preview") 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-preview // - 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-preview") 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-preview // - 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-preview") 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-preview // - 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-preview") 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-preview // - 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-preview") 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-preview // - 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-preview 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-preview") 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 deleted file mode 100644 index bb2a36ce200d..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client_example_test.go +++ /dev/null @@ -1,353 +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/WebhookList.json -func ExampleWebhooksClient_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.NewWebhooksClient().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.WebhookListResult = armcontainerregistry.WebhookListResult{ - // Value: []*armcontainerregistry.Webhook{ - // { - // Name: to.Ptr("myWebhook"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/webhooks"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/webhooks/myWebhook"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armcontainerregistry.WebhookProperties{ - // Actions: []*armcontainerregistry.WebhookAction{ - // to.Ptr(armcontainerregistry.WebhookActionPush)}, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Scope: to.Ptr("myRepository"), - // Status: to.Ptr(armcontainerregistry.WebhookStatusEnabled), - // }, - // }}, - // } - } -} - -// 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 -func ExampleWebhooksClient_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.NewWebhooksClient().Get(ctx, "myResourceGroup", "myRegistry", "myWebhook", 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.Webhook = armcontainerregistry.Webhook{ - // Name: to.Ptr("myWebhook"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/webhooks"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/webhooks/myWebhook"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armcontainerregistry.WebhookProperties{ - // Actions: []*armcontainerregistry.WebhookAction{ - // to.Ptr(armcontainerregistry.WebhookActionPush)}, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Scope: to.Ptr("myRepository"), - // Status: to.Ptr(armcontainerregistry.WebhookStatusEnabled), - // }, - // } -} - -// 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 -func ExampleWebhooksClient_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.NewWebhooksClient().BeginCreate(ctx, "myResourceGroup", "myRegistry", "myWebhook", armcontainerregistry.WebhookCreateParameters{ - Location: to.Ptr("westus"), - Properties: &armcontainerregistry.WebhookPropertiesCreateParameters{ - Actions: []*armcontainerregistry.WebhookAction{ - to.Ptr(armcontainerregistry.WebhookActionPush)}, - CustomHeaders: map[string]*string{ - "Authorization": to.Ptr("Basic 000000000000000000000000000000000000000000000000000"), - }, - Scope: to.Ptr("myRepository"), - ServiceURI: to.Ptr("http://myservice.com"), - Status: to.Ptr(armcontainerregistry.WebhookStatusEnabled), - }, - Tags: map[string]*string{ - "key": to.Ptr("value"), - }, - }, 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.Webhook = armcontainerregistry.Webhook{ - // Name: to.Ptr("myWebhook"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/webhooks"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/webhooks/myWebhook"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armcontainerregistry.WebhookProperties{ - // Actions: []*armcontainerregistry.WebhookAction{ - // to.Ptr(armcontainerregistry.WebhookActionPush)}, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Scope: to.Ptr("myRepository"), - // Status: to.Ptr(armcontainerregistry.WebhookStatusEnabled), - // }, - // } -} - -// 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 -func ExampleWebhooksClient_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.NewWebhooksClient().BeginDelete(ctx, "myResourceGroup", "myRegistry", "myWebhook", 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/WebhookUpdate.json -func ExampleWebhooksClient_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.NewWebhooksClient().BeginUpdate(ctx, "myResourceGroup", "myRegistry", "myWebhook", armcontainerregistry.WebhookUpdateParameters{ - Properties: &armcontainerregistry.WebhookPropertiesUpdateParameters{ - Actions: []*armcontainerregistry.WebhookAction{ - to.Ptr(armcontainerregistry.WebhookActionPush)}, - CustomHeaders: map[string]*string{ - "Authorization": to.Ptr("Basic 000000000000000000000000000000000000000000000000000"), - }, - Scope: to.Ptr("myRepository"), - ServiceURI: to.Ptr("http://myservice.com"), - Status: to.Ptr(armcontainerregistry.WebhookStatusEnabled), - }, - Tags: map[string]*string{ - "key": to.Ptr("value"), - }, - }, 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.Webhook = armcontainerregistry.Webhook{ - // Name: to.Ptr("myWebhook"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/webhooks"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/webhooks/myWebhook"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "key": to.Ptr("value"), - // }, - // Properties: &armcontainerregistry.WebhookProperties{ - // Actions: []*armcontainerregistry.WebhookAction{ - // to.Ptr(armcontainerregistry.WebhookActionPush)}, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Scope: to.Ptr("myRepository"), - // Status: to.Ptr(armcontainerregistry.WebhookStatusEnabled), - // }, - // } -} - -// 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 -func ExampleWebhooksClient_Ping() { - 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.NewWebhooksClient().Ping(ctx, "myResourceGroup", "myRegistry", "myWebhook", 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.EventInfo = armcontainerregistry.EventInfo{ - // ID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // } -} - -// 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 -func ExampleWebhooksClient_NewListEventsPager() { - 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.NewWebhooksClient().NewListEventsPager("myResourceGroup", "myRegistry", "myWebhook", 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.EventListResult = armcontainerregistry.EventListResult{ - // Value: []*armcontainerregistry.Event{ - // { - // ID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // EventRequestMessage: &armcontainerregistry.EventRequestMessage{ - // Method: to.Ptr("POST"), - // Content: &armcontainerregistry.EventContent{ - // Action: to.Ptr("push"), - // Actor: &armcontainerregistry.Actor{ - // }, - // ID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Source: &armcontainerregistry.Source{ - // Addr: to.Ptr("xtal.local:5000"), - // InstanceID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // Target: &armcontainerregistry.Target{ - // Digest: to.Ptr("sha256:fea8895f450959fa676bcc1df0611ea93823a735a01205fd8622846041d0c7cf"), - // Length: to.Ptr[int64](708), - // MediaType: to.Ptr("application/vnd.docker.distribution.manifest.v2+json"), - // Repository: to.Ptr("hello-world"), - // Size: to.Ptr[int64](708), - // Tag: to.Ptr("latest"), - // URL: to.Ptr("http://192.168.100.227:5000/v2/hello-world/manifests/sha256:fea8895f450959fa676bcc1df0611ea93823a735a01205fd8622846041d0c7cf"), - // }, - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-03-01T23:14:37.0707808Z"); return t}()), - // Request: &armcontainerregistry.Request{ - // Method: to.Ptr("GET"), - // Addr: to.Ptr("192.168.64.11:42961"), - // Host: to.Ptr("192.168.100.227:5000"), - // ID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Useragent: to.Ptr("curl/7.38.0"), - // }, - // }, - // Headers: map[string]*string{ - // "Authorization": to.Ptr("******"), - // "Content-Length": to.Ptr("719"), - // "Content-Type": to.Ptr("application/json"), - // }, - // RequestURI: to.Ptr("http://myservice.com"), - // Version: to.Ptr("1.1"), - // }, - // EventResponseMessage: &armcontainerregistry.EventResponseMessage{ - // Headers: map[string]*string{ - // "Content-Length": to.Ptr("0"), - // }, - // StatusCode: to.Ptr("200"), - // Version: to.Ptr("1.1"), - // }, - // }}, - // } - } -} - -// 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 -func ExampleWebhooksClient_GetCallbackConfig() { - 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.NewWebhooksClient().GetCallbackConfig(ctx, "myResourceGroup", "myRegistry", "myWebhook", 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.CallbackConfig = armcontainerregistry.CallbackConfig{ - // CustomHeaders: map[string]*string{ - // "Authorization": to.Ptr("Basic 000000000000000000000000000000000000000000000000000"), - // }, - // ServiceURI: to.Ptr("http://myservice.com"), - // } -}