From 69670ec6c27628044dd732805ddaeec70a548355 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 11 Jul 2023 22:15:07 +0000 Subject: [PATCH] CodeGen from PR 24771 in Azure/azure-rest-api-specs Merge 349a5d77fc1630b48b8f0d3f820b608a8a2ec609 into eabc87b2e8e5ab5d5365cb2db064d7fd25a65f1a --- .../armcontainerregistry/CHANGELOG.md | 207 +- .../armcontainerregistry/agentpools_client.go | 472 -- .../agentpools_client_example_test.go | 221 - .../armcontainerregistry/autorest.md | 6 +- .../armcontainerregistry/cacherules_client.go | 26 +- .../cacherules_client_example_test.go | 194 - .../armcontainerregistry/client_factory.go | 40 - .../connectedregistries_client.go | 494 -- ...connectedregistries_client_example_test.go | 302 - .../armcontainerregistry/constants.go | 488 +- .../credentialsets_client.go | 26 +- .../credentialsets_client_example_test.go | 254 - .../exportpipelines_client.go | 335 - .../exportpipelines_client_example_test.go | 189 - .../fake/agentpools_server.go | 357 - .../fake/connectedregistries_server.go | 378 - .../fake/exportpipelines_server.go | 258 - .../fake/importpipelines_server.go | 258 - .../fake/pipelineruns_server.go | 258 - .../fake/polymorphic_helpers.go | 91 - .../fake/registries_server.go | 95 - .../armcontainerregistry/fake/runs_server.go | 329 - .../fake/taskruns_server.go | 357 - .../armcontainerregistry/fake/tasks_server.go | 357 - .../armcontainerregistry/go.mod | 4 +- .../importpipelines_client.go | 335 - .../importpipelines_client_example_test.go | 227 - .../armcontainerregistry/models.go | 2550 +------ .../armcontainerregistry/models_serde.go | 6739 ++++------------- .../armcontainerregistry/operations_client.go | 4 +- .../operations_client_example_test.go | 55 - .../pipelineruns_client.go | 334 - .../pipelineruns_client_example_test.go | 296 - .../polymorphic_helpers.go | 88 - .../privateendpointconnections_client.go | 20 +- ...endpointconnections_client_example_test.go | 167 - .../armcontainerregistry/registries_client.go | 201 +- .../registries_client_example_test.go | 1389 ---- .../replications_client.go | 26 +- .../replications_client_example_test.go | 273 - .../armcontainerregistry/response_types.go | 215 - .../armcontainerregistry/runs_client.go | 401 - .../runs_client_example_test.go | 283 - .../armcontainerregistry/scopemaps_client.go | 26 +- .../scopemaps_client_example_test.go | 202 - .../armcontainerregistry/taskruns_client.go | 471 -- .../taskruns_client_example_test.go | 408 - .../armcontainerregistry/tasks_client.go | 471 -- .../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 - 53 files changed, 1897 insertions(+), 21566 deletions(-) delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/agentpools_client.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/agentpools_client_example_test.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client_example_test.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/connectedregistries_client.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/connectedregistries_client_example_test.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client_example_test.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/exportpipelines_client.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/exportpipelines_client_example_test.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/fake/agentpools_server.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/fake/connectedregistries_server.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/fake/exportpipelines_server.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/fake/importpipelines_server.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/fake/pipelineruns_server.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/fake/polymorphic_helpers.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/fake/runs_server.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/fake/taskruns_server.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/fake/tasks_server.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/importpipelines_client.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.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/pipelineruns_client_example_test.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/polymorphic_helpers.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.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.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/taskruns_client_example_test.go delete mode 100644 sdk/resourcemanager/containerregistry/armcontainerregistry/tasks_client.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 d2665e67f126..90c45f8745d4 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/CHANGELOG.md +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/CHANGELOG.md @@ -1,28 +1,135 @@ # Release History -## 1.1.0-beta.2 (2023-06-12) - -### Features Added +## 2.0.0 (2023-07-11) +### Breaking Changes -- Support for test fakes and OpenTelemetry trace spans. +- Enum `Architecture` has been removed +- Enum `BaseImageDependencyType` has been removed +- Enum `BaseImageTriggerType` has been removed +- Enum `OS` has been removed +- Enum `RunStatus` has been removed +- Enum `RunType` has been removed +- Enum `SecretObjectType` has been removed +- Enum `SourceControlType` has been removed +- Enum `SourceRegistryLoginMode` has been removed +- Enum `SourceTriggerEvent` has been removed +- Enum `StepType` has been removed +- Enum `TaskStatus` has been removed +- Enum `TokenType` has been removed +- Enum `TriggerStatus` has been removed +- Enum `UpdateTriggerPayloadType` has been removed +- Enum `Variant` has been removed +- Function `NewAgentPoolsClient` has been removed +- Function `*AgentPoolsClient.BeginCreate` has been removed +- Function `*AgentPoolsClient.BeginDelete` has been removed +- Function `*AgentPoolsClient.Get` has been removed +- Function `*AgentPoolsClient.GetQueueStatus` has been removed +- Function `*AgentPoolsClient.NewListPager` has been removed +- Function `*AgentPoolsClient.BeginUpdate` has been removed +- Function `*ClientFactory.NewAgentPoolsClient` has been removed +- Function `*ClientFactory.NewRunsClient` has been removed +- Function `*ClientFactory.NewTaskRunsClient` has been removed +- Function `*ClientFactory.NewTasksClient` has been removed +- Function `*DockerBuildRequest.GetRunRequest` has been removed +- Function `*DockerBuildStep.GetTaskStepProperties` has been removed +- Function `*DockerBuildStepUpdateParameters.GetTaskStepUpdateParameters` has been removed +- Function `*EncodedTaskRunRequest.GetRunRequest` has been removed +- Function `*EncodedTaskStep.GetTaskStepProperties` has been removed +- Function `*EncodedTaskStepUpdateParameters.GetTaskStepUpdateParameters` has been removed +- Function `*FileTaskRunRequest.GetRunRequest` has been removed +- Function `*FileTaskStep.GetTaskStepProperties` has been removed +- Function `*FileTaskStepUpdateParameters.GetTaskStepUpdateParameters` has been removed +- Function `*RegistriesClient.GetBuildSourceUploadURL` has been removed +- Function `*RegistriesClient.BeginScheduleRun` has been removed +- Function `*RunRequest.GetRunRequest` has been removed +- Function `NewRunsClient` has been removed +- Function `*RunsClient.BeginCancel` has been removed +- Function `*RunsClient.Get` has been removed +- Function `*RunsClient.GetLogSasURL` has been removed +- Function `*RunsClient.NewListPager` has been removed +- Function `*RunsClient.BeginUpdate` has been removed +- Function `*TaskRunRequest.GetRunRequest` has been removed +- Function `NewTaskRunsClient` has been removed +- Function `*TaskRunsClient.BeginCreate` has been removed +- Function `*TaskRunsClient.BeginDelete` has been removed +- Function `*TaskRunsClient.Get` has been removed +- Function `*TaskRunsClient.GetDetails` has been removed +- Function `*TaskRunsClient.NewListPager` has been removed +- Function `*TaskRunsClient.BeginUpdate` has been removed +- Function `*TaskStepProperties.GetTaskStepProperties` has been removed +- Function `*TaskStepUpdateParameters.GetTaskStepUpdateParameters` has been removed +- Function `NewTasksClient` has been removed +- Function `*TasksClient.BeginCreate` has been removed +- Function `*TasksClient.BeginDelete` has been removed +- Function `*TasksClient.Get` has been removed +- Function `*TasksClient.GetDetails` has been removed +- Function `*TasksClient.NewListPager` has been removed +- Function `*TasksClient.BeginUpdate` has been removed +- Struct `AgentPool` has been removed +- Struct `AgentPoolListResult` has been removed +- Struct `AgentPoolProperties` has been removed +- Struct `AgentPoolPropertiesUpdateParameters` has been removed +- Struct `AgentPoolQueueStatus` has been removed +- Struct `AgentPoolUpdateParameters` has been removed +- Struct `AgentProperties` has been removed +- Struct `Argument` has been removed +- Struct `AuthInfo` has been removed +- Struct `AuthInfoUpdateParameters` has been removed +- Struct `BaseImageDependency` has been removed +- Struct `BaseImageTrigger` has been removed +- Struct `BaseImageTriggerUpdateParameters` has been removed +- Struct `Credentials` has been removed +- Struct `CustomRegistryCredentials` has been removed +- Struct `DockerBuildRequest` has been removed +- Struct `DockerBuildStep` has been removed +- Struct `DockerBuildStepUpdateParameters` has been removed +- Struct `EncodedTaskRunRequest` has been removed +- Struct `EncodedTaskStep` has been removed +- Struct `EncodedTaskStepUpdateParameters` has been removed +- Struct `FileTaskRunRequest` has been removed +- Struct `FileTaskStep` has been removed +- Struct `FileTaskStepUpdateParameters` has been removed +- Struct `ImageDescriptor` has been removed +- Struct `ImageUpdateTrigger` has been removed +- Struct `OverrideTaskStepProperties` has been removed +- Struct `PlatformProperties` has been removed +- Struct `PlatformUpdateParameters` has been removed +- Struct `Run` has been removed +- Struct `RunFilter` has been removed +- Struct `RunGetLogResult` has been removed +- Struct `RunListResult` has been removed +- Struct `RunProperties` has been removed +- Struct `RunUpdateParameters` has been removed +- Struct `SecretObject` has been removed +- Struct `SetValue` has been removed +- Struct `SourceProperties` has been removed +- Struct `SourceRegistryCredentials` has been removed +- Struct `SourceTrigger` has been removed +- Struct `SourceTriggerDescriptor` has been removed +- Struct `SourceTriggerUpdateParameters` has been removed +- Struct `SourceUpdateParameters` has been removed +- Struct `SourceUploadDefinition` has been removed +- Struct `Task` has been removed +- Struct `TaskListResult` has been removed +- Struct `TaskProperties` has been removed +- Struct `TaskPropertiesUpdateParameters` has been removed +- Struct `TaskRun` has been removed +- Struct `TaskRunListResult` has been removed +- Struct `TaskRunProperties` has been removed +- Struct `TaskRunPropertiesUpdateParameters` has been removed +- Struct `TaskRunRequest` has been removed +- Struct `TaskRunUpdateParameters` has been removed +- Struct `TaskUpdateParameters` has been removed +- Struct `TimerTrigger` has been removed +- Struct `TimerTriggerDescriptor` has been removed +- Struct `TimerTriggerUpdateParameters` has been removed +- Struct `TriggerProperties` has been removed +- Struct `TriggerUpdateParameters` has been removed -## 1.1.0-beta.1 (2023-03-27) ### Features Added -- New enum type `ActivationStatus` with values `ActivationStatusActive`, `ActivationStatusInactive` -- New enum type `AuditLogStatus` with values `AuditLogStatusDisabled`, `AuditLogStatusEnabled` -- New enum type `AzureADAuthenticationAsArmPolicyStatus` with values `AzureADAuthenticationAsArmPolicyStatusDisabled`, `AzureADAuthenticationAsArmPolicyStatusEnabled` -- New enum type `CertificateType` with values `CertificateTypeLocalDirectory` -- New enum type `ConnectedRegistryMode` with values `ConnectedRegistryModeMirror`, `ConnectedRegistryModeReadOnly`, `ConnectedRegistryModeReadWrite`, `ConnectedRegistryModeRegistry` -- New enum type `ConnectionState` with values `ConnectionStateOffline`, `ConnectionStateOnline`, `ConnectionStateSyncing`, `ConnectionStateUnhealthy` - New enum type `CredentialHealthStatus` with values `CredentialHealthStatusHealthy`, `CredentialHealthStatusUnhealthy` - New enum type `CredentialName` with values `CredentialNameCredential1` -- New enum type `LogLevel` with values `LogLevelDebug`, `LogLevelError`, `LogLevelInformation`, `LogLevelNone`, `LogLevelWarning` -- New enum type `PipelineOptions` with values `PipelineOptionsContinueOnErrors`, `PipelineOptionsDeleteSourceBlobOnSuccess`, `PipelineOptionsOverwriteBlobs`, `PipelineOptionsOverwriteTags` -- New enum type `PipelineRunSourceType` with values `PipelineRunSourceTypeAzureStorageBlob` -- New enum type `PipelineRunTargetType` with values `PipelineRunTargetTypeAzureStorageBlob` -- New enum type `PipelineSourceType` with values `PipelineSourceTypeAzureStorageBlobContainer` -- New enum type `TLSStatus` with values `TLSStatusDisabled`, `TLSStatusEnabled` - New function `NewCacheRulesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CacheRulesClient, error)` - New function `*CacheRulesClient.BeginCreate(context.Context, string, string, string, CacheRule, *CacheRulesClientBeginCreateOptions) (*runtime.Poller[CacheRulesClientCreateResponse], error)` - New function `*CacheRulesClient.BeginDelete(context.Context, string, string, string, *CacheRulesClientBeginDeleteOptions) (*runtime.Poller[CacheRulesClientDeleteResponse], error)` @@ -30,91 +137,25 @@ - New function `*CacheRulesClient.NewListPager(string, string, *CacheRulesClientListOptions) *runtime.Pager[CacheRulesClientListResponse]` - New function `*CacheRulesClient.BeginUpdate(context.Context, string, string, string, CacheRuleUpdateParameters, *CacheRulesClientBeginUpdateOptions) (*runtime.Poller[CacheRulesClientUpdateResponse], error)` - New function `*ClientFactory.NewCacheRulesClient() *CacheRulesClient` -- New function `*ClientFactory.NewConnectedRegistriesClient() *ConnectedRegistriesClient` - New function `*ClientFactory.NewCredentialSetsClient() *CredentialSetsClient` -- New function `*ClientFactory.NewExportPipelinesClient() *ExportPipelinesClient` -- New function `*ClientFactory.NewImportPipelinesClient() *ImportPipelinesClient` -- New function `*ClientFactory.NewPipelineRunsClient() *PipelineRunsClient` -- New function `NewConnectedRegistriesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ConnectedRegistriesClient, error)` -- New function `*ConnectedRegistriesClient.BeginCreate(context.Context, string, string, string, ConnectedRegistry, *ConnectedRegistriesClientBeginCreateOptions) (*runtime.Poller[ConnectedRegistriesClientCreateResponse], error)` -- New function `*ConnectedRegistriesClient.BeginDeactivate(context.Context, string, string, string, *ConnectedRegistriesClientBeginDeactivateOptions) (*runtime.Poller[ConnectedRegistriesClientDeactivateResponse], error)` -- New function `*ConnectedRegistriesClient.BeginDelete(context.Context, string, string, string, *ConnectedRegistriesClientBeginDeleteOptions) (*runtime.Poller[ConnectedRegistriesClientDeleteResponse], error)` -- New function `*ConnectedRegistriesClient.Get(context.Context, string, string, string, *ConnectedRegistriesClientGetOptions) (ConnectedRegistriesClientGetResponse, error)` -- New function `*ConnectedRegistriesClient.NewListPager(string, string, *ConnectedRegistriesClientListOptions) *runtime.Pager[ConnectedRegistriesClientListResponse]` -- New function `*ConnectedRegistriesClient.BeginUpdate(context.Context, string, string, string, ConnectedRegistryUpdateParameters, *ConnectedRegistriesClientBeginUpdateOptions) (*runtime.Poller[ConnectedRegistriesClientUpdateResponse], error)` - New function `NewCredentialSetsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CredentialSetsClient, error)` - New function `*CredentialSetsClient.BeginCreate(context.Context, string, string, string, CredentialSet, *CredentialSetsClientBeginCreateOptions) (*runtime.Poller[CredentialSetsClientCreateResponse], error)` - New function `*CredentialSetsClient.BeginDelete(context.Context, string, string, string, *CredentialSetsClientBeginDeleteOptions) (*runtime.Poller[CredentialSetsClientDeleteResponse], error)` - New function `*CredentialSetsClient.Get(context.Context, string, string, string, *CredentialSetsClientGetOptions) (CredentialSetsClientGetResponse, error)` - New function `*CredentialSetsClient.NewListPager(string, string, *CredentialSetsClientListOptions) *runtime.Pager[CredentialSetsClientListResponse]` - New function `*CredentialSetsClient.BeginUpdate(context.Context, string, string, string, CredentialSetUpdateParameters, *CredentialSetsClientBeginUpdateOptions) (*runtime.Poller[CredentialSetsClientUpdateResponse], error)` -- New function `NewExportPipelinesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ExportPipelinesClient, error)` -- New function `*ExportPipelinesClient.BeginCreate(context.Context, string, string, string, ExportPipeline, *ExportPipelinesClientBeginCreateOptions) (*runtime.Poller[ExportPipelinesClientCreateResponse], error)` -- New function `*ExportPipelinesClient.BeginDelete(context.Context, string, string, string, *ExportPipelinesClientBeginDeleteOptions) (*runtime.Poller[ExportPipelinesClientDeleteResponse], error)` -- New function `*ExportPipelinesClient.Get(context.Context, string, string, string, *ExportPipelinesClientGetOptions) (ExportPipelinesClientGetResponse, error)` -- New function `*ExportPipelinesClient.NewListPager(string, string, *ExportPipelinesClientListOptions) *runtime.Pager[ExportPipelinesClientListResponse]` -- New function `NewImportPipelinesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ImportPipelinesClient, error)` -- New function `*ImportPipelinesClient.BeginCreate(context.Context, string, string, string, ImportPipeline, *ImportPipelinesClientBeginCreateOptions) (*runtime.Poller[ImportPipelinesClientCreateResponse], error)` -- New function `*ImportPipelinesClient.BeginDelete(context.Context, string, string, string, *ImportPipelinesClientBeginDeleteOptions) (*runtime.Poller[ImportPipelinesClientDeleteResponse], error)` -- New function `*ImportPipelinesClient.Get(context.Context, string, string, string, *ImportPipelinesClientGetOptions) (ImportPipelinesClientGetResponse, error)` -- New function `*ImportPipelinesClient.NewListPager(string, string, *ImportPipelinesClientListOptions) *runtime.Pager[ImportPipelinesClientListResponse]` -- New function `NewPipelineRunsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*PipelineRunsClient, error)` -- New function `*PipelineRunsClient.BeginCreate(context.Context, string, string, string, PipelineRun, *PipelineRunsClientBeginCreateOptions) (*runtime.Poller[PipelineRunsClientCreateResponse], error)` -- New function `*PipelineRunsClient.BeginDelete(context.Context, string, string, string, *PipelineRunsClientBeginDeleteOptions) (*runtime.Poller[PipelineRunsClientDeleteResponse], error)` -- New function `*PipelineRunsClient.Get(context.Context, string, string, string, *PipelineRunsClientGetOptions) (PipelineRunsClientGetResponse, error)` -- New function `*PipelineRunsClient.NewListPager(string, string, *PipelineRunsClientListOptions) *runtime.Pager[PipelineRunsClientListResponse]` -- New struct `ActivationProperties` - New struct `AuthCredential` -- New struct `AzureADAuthenticationAsArmPolicy` - New struct `CacheRule` - New struct `CacheRuleProperties` - New struct `CacheRuleUpdateParameters` - New struct `CacheRuleUpdateProperties` - New struct `CacheRulesListResult` -- New struct `ConnectedRegistry` -- New struct `ConnectedRegistryListResult` -- New struct `ConnectedRegistryProperties` -- New struct `ConnectedRegistryUpdateParameters` -- New struct `ConnectedRegistryUpdateProperties` - New struct `CredentialHealth` - New struct `CredentialSet` - New struct `CredentialSetListResult` - New struct `CredentialSetProperties` - New struct `CredentialSetUpdateParameters` - New struct `CredentialSetUpdateProperties` -- New struct `ExportPipeline` -- New struct `ExportPipelineListResult` -- New struct `ExportPipelineProperties` -- New struct `ExportPipelineTargetProperties` -- New struct `ImportPipeline` -- New struct `ImportPipelineListResult` -- New struct `ImportPipelineProperties` -- New struct `ImportPipelineSourceProperties` -- New struct `LoggingProperties` -- New struct `LoginServerProperties` -- New struct `ParentProperties` -- New struct `PipelineRun` -- New struct `PipelineRunListResult` -- New struct `PipelineRunProperties` -- New struct `PipelineRunRequest` -- New struct `PipelineRunResponse` -- New struct `PipelineRunSourceProperties` -- New struct `PipelineRunTargetProperties` -- New struct `PipelineSourceTriggerDescriptor` -- New struct `PipelineSourceTriggerProperties` -- New struct `PipelineTriggerDescriptor` -- New struct `PipelineTriggerProperties` -- New struct `ProgressProperties` -- New struct `SoftDeletePolicy` -- New struct `StatusDetailProperties` -- New struct `SyncProperties` -- New struct `SyncUpdateProperties` -- New struct `TLSCertificateProperties` -- New struct `TLSProperties` -- New field `AzureADAuthenticationAsArmPolicy` in struct `Policies` -- New field `SoftDeletePolicy` in struct `Policies` -- New field `AnonymousPullEnabled` in struct `RegistryProperties` -- New field `AnonymousPullEnabled` in struct `RegistryPropertiesUpdateParameters` ## 1.0.0 (2023-03-24) diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/agentpools_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/agentpools_client.go deleted file mode 100644 index ecef97ced047..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/agentpools_client.go +++ /dev/null @@ -1,472 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcontainerregistry - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// AgentPoolsClient contains the methods for the AgentPools group. -// Don't use this type directly, use NewAgentPoolsClient() instead. -type AgentPoolsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewAgentPoolsClient creates a new instance of AgentPoolsClient 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 NewAgentPoolsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AgentPoolsClient, error) { - cl, err := arm.NewClient(moduleName+".AgentPoolsClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &AgentPoolsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginCreate - Creates an agent pool for a container registry with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -// - resourceGroupName - The name of the resource group to which the container registry belongs. -// - registryName - The name of the container registry. -// - agentPoolName - The name of the agent pool. -// - agentPool - The parameters of an agent pool that needs to scheduled. -// - options - AgentPoolsClientBeginCreateOptions contains the optional parameters for the AgentPoolsClient.BeginCreate method. -func (client *AgentPoolsClient) BeginCreate(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, agentPool AgentPool, options *AgentPoolsClientBeginCreateOptions) (*runtime.Poller[AgentPoolsClientCreateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, registryName, agentPoolName, agentPool, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller[AgentPoolsClientCreateResponse](resp, client.internal.Pipeline(), nil) - return poller, err - } else { - return runtime.NewPollerFromResumeToken[AgentPoolsClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Create - Creates an agent pool for a container registry with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -func (client *AgentPoolsClient) create(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, agentPool AgentPool, options *AgentPoolsClientBeginCreateOptions) (*http.Response, error) { - var err error - const operationName = "AgentPoolsClient.BeginCreate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, agentPoolName, agentPool, options) - if err != nil { - return nil, err - } - 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 *AgentPoolsClient) createCreateRequest(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, agentPool AgentPool, options *AgentPoolsClientBeginCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}" - 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 agentPoolName == "" { - return nil, errors.New("parameter agentPoolName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{agentPoolName}", url.PathEscape(agentPoolName)) - 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", "2019-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, agentPool); err != nil { - return nil, err - } - return req, nil -} - -// BeginDelete - Deletes a specified agent pool resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -// - resourceGroupName - The name of the resource group to which the container registry belongs. -// - registryName - The name of the container registry. -// - agentPoolName - The name of the agent pool. -// - options - AgentPoolsClientBeginDeleteOptions contains the optional parameters for the AgentPoolsClient.BeginDelete method. -func (client *AgentPoolsClient) BeginDelete(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, options *AgentPoolsClientBeginDeleteOptions) (*runtime.Poller[AgentPoolsClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, registryName, agentPoolName, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller[AgentPoolsClientDeleteResponse](resp, client.internal.Pipeline(), nil) - return poller, err - } else { - return runtime.NewPollerFromResumeToken[AgentPoolsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Delete - Deletes a specified agent pool resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -func (client *AgentPoolsClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, options *AgentPoolsClientBeginDeleteOptions) (*http.Response, error) { - var err error - const operationName = "AgentPoolsClient.BeginDelete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, agentPoolName, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *AgentPoolsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, options *AgentPoolsClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}" - 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 agentPoolName == "" { - return nil, errors.New("parameter agentPoolName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{agentPoolName}", url.PathEscape(agentPoolName)) - 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", "2019-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Gets the detailed information for a given agent pool. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -// - resourceGroupName - The name of the resource group to which the container registry belongs. -// - registryName - The name of the container registry. -// - agentPoolName - The name of the agent pool. -// - options - AgentPoolsClientGetOptions contains the optional parameters for the AgentPoolsClient.Get method. -func (client *AgentPoolsClient) Get(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, options *AgentPoolsClientGetOptions) (AgentPoolsClientGetResponse, error) { - var err error - const operationName = "AgentPoolsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, agentPoolName, options) - if err != nil { - return AgentPoolsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AgentPoolsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AgentPoolsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *AgentPoolsClient) getCreateRequest(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, options *AgentPoolsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}" - 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 agentPoolName == "" { - return nil, errors.New("parameter agentPoolName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{agentPoolName}", url.PathEscape(agentPoolName)) - 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", "2019-06-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 *AgentPoolsClient) getHandleResponse(resp *http.Response) (AgentPoolsClientGetResponse, error) { - result := AgentPoolsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AgentPool); err != nil { - return AgentPoolsClientGetResponse{}, err - } - return result, nil -} - -// GetQueueStatus - Gets the count of queued runs for a given agent pool. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -// - resourceGroupName - The name of the resource group to which the container registry belongs. -// - registryName - The name of the container registry. -// - agentPoolName - The name of the agent pool. -// - options - AgentPoolsClientGetQueueStatusOptions contains the optional parameters for the AgentPoolsClient.GetQueueStatus -// method. -func (client *AgentPoolsClient) GetQueueStatus(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, options *AgentPoolsClientGetQueueStatusOptions) (AgentPoolsClientGetQueueStatusResponse, error) { - var err error - const operationName = "AgentPoolsClient.GetQueueStatus" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getQueueStatusCreateRequest(ctx, resourceGroupName, registryName, agentPoolName, options) - if err != nil { - return AgentPoolsClientGetQueueStatusResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AgentPoolsClientGetQueueStatusResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AgentPoolsClientGetQueueStatusResponse{}, err - } - resp, err := client.getQueueStatusHandleResponse(httpResp) - return resp, err -} - -// getQueueStatusCreateRequest creates the GetQueueStatus request. -func (client *AgentPoolsClient) getQueueStatusCreateRequest(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, options *AgentPoolsClientGetQueueStatusOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}/listQueueStatus" - 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 agentPoolName == "" { - return nil, errors.New("parameter agentPoolName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{agentPoolName}", url.PathEscape(agentPoolName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getQueueStatusHandleResponse handles the GetQueueStatus response. -func (client *AgentPoolsClient) getQueueStatusHandleResponse(resp *http.Response) (AgentPoolsClientGetQueueStatusResponse, error) { - result := AgentPoolsClientGetQueueStatusResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AgentPoolQueueStatus); err != nil { - return AgentPoolsClientGetQueueStatusResponse{}, err - } - return result, nil -} - -// NewListPager - Lists all the agent pools for a specified container registry. -// -// Generated from API version 2019-06-01-preview -// - resourceGroupName - The name of the resource group to which the container registry belongs. -// - registryName - The name of the container registry. -// - options - AgentPoolsClientListOptions contains the optional parameters for the AgentPoolsClient.NewListPager method. -func (client *AgentPoolsClient) NewListPager(resourceGroupName string, registryName string, options *AgentPoolsClientListOptions) *runtime.Pager[AgentPoolsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[AgentPoolsClientListResponse]{ - More: func(page AgentPoolsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *AgentPoolsClientListResponse) (AgentPoolsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AgentPoolsClient.NewListPager") - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, resourceGroupName, registryName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return AgentPoolsClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AgentPoolsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AgentPoolsClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *AgentPoolsClient) listCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *AgentPoolsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools" - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-06-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 *AgentPoolsClient) listHandleResponse(resp *http.Response) (AgentPoolsClientListResponse, error) { - result := AgentPoolsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AgentPoolListResult); err != nil { - return AgentPoolsClientListResponse{}, err - } - return result, nil -} - -// BeginUpdate - Updates an agent pool with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -// - resourceGroupName - The name of the resource group to which the container registry belongs. -// - registryName - The name of the container registry. -// - agentPoolName - The name of the agent pool. -// - updateParameters - The parameters for updating an agent pool. -// - options - AgentPoolsClientBeginUpdateOptions contains the optional parameters for the AgentPoolsClient.BeginUpdate method. -func (client *AgentPoolsClient) BeginUpdate(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, updateParameters AgentPoolUpdateParameters, options *AgentPoolsClientBeginUpdateOptions) (*runtime.Poller[AgentPoolsClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, registryName, agentPoolName, updateParameters, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller[AgentPoolsClientUpdateResponse](resp, client.internal.Pipeline(), nil) - return poller, err - } else { - return runtime.NewPollerFromResumeToken[AgentPoolsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Update - Updates an agent pool with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -func (client *AgentPoolsClient) update(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, updateParameters AgentPoolUpdateParameters, options *AgentPoolsClientBeginUpdateOptions) (*http.Response, error) { - var err error - const operationName = "AgentPoolsClient.BeginUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, agentPoolName, updateParameters, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// updateCreateRequest creates the Update request. -func (client *AgentPoolsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, updateParameters AgentPoolUpdateParameters, options *AgentPoolsClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}" - 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 agentPoolName == "" { - return nil, errors.New("parameter agentPoolName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{agentPoolName}", url.PathEscape(agentPoolName)) - 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", "2019-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, updateParameters); err != nil { - return nil, err - } - return req, nil -} 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/autorest.md b/sdk/resourcemanager/containerregistry/armcontainerregistry/autorest.md index 0b961080068c..a3eba8e833f5 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.2 +module-version: 2.0.0 azcore-version: 1.7.0-beta.2 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..ff4d784ebd61 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client.go @@ -46,7 +46,7 @@ func NewCacheRulesClient(subscriptionID string, credential azcore.TokenCredentia // BeginCreate - Creates a cache rule for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - cacheRuleName - The name of the cache rule. @@ -70,7 +70,7 @@ func (client *CacheRulesClient) BeginCreate(ctx context.Context, resourceGroupNa // Create - Creates a cache rule for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *CacheRulesClient) create(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, cacheRuleCreateParameters CacheRule, options *CacheRulesClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "CacheRulesClient.BeginCreate" @@ -113,7 +113,7 @@ func (client *CacheRulesClient) createCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, cacheRuleCreateParameters); err != nil { @@ -125,7 +125,7 @@ func (client *CacheRulesClient) createCreateRequest(ctx context.Context, resourc // BeginDelete - Deletes a cache rule resource from a container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - cacheRuleName - The name of the cache rule. @@ -148,7 +148,7 @@ func (client *CacheRulesClient) BeginDelete(ctx context.Context, resourceGroupNa // Delete - Deletes a cache rule resource from a container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *CacheRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, options *CacheRulesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "CacheRulesClient.BeginDelete" @@ -191,7 +191,7 @@ func (client *CacheRulesClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -200,7 +200,7 @@ func (client *CacheRulesClient) deleteCreateRequest(ctx context.Context, resourc // Get - Gets the properties of the specified cache rule resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - cacheRuleName - The name of the cache rule. @@ -248,7 +248,7 @@ func (client *CacheRulesClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -265,7 +265,7 @@ func (client *CacheRulesClient) getHandleResponse(resp *http.Response) (CacheRul // NewListPager - Lists all cache rule resources for the specified container registry. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - options - CacheRulesClientListOptions contains the optional parameters for the CacheRulesClient.NewListPager method. @@ -316,7 +316,7 @@ func (client *CacheRulesClient) listCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -334,7 +334,7 @@ func (client *CacheRulesClient) listHandleResponse(resp *http.Response) (CacheRu // BeginUpdate - Updates a cache rule for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - cacheRuleName - The name of the cache rule. @@ -358,7 +358,7 @@ func (client *CacheRulesClient) BeginUpdate(ctx context.Context, resourceGroupNa // Update - Updates a cache rule for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *CacheRulesClient) update(ctx context.Context, resourceGroupName string, registryName string, cacheRuleName string, cacheRuleUpdateParameters CacheRuleUpdateParameters, options *CacheRulesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "CacheRulesClient.BeginUpdate" @@ -401,7 +401,7 @@ func (client *CacheRulesClient) updateCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, cacheRuleUpdateParameters); err != nil { diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/cacherules_client_example_test.go 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 baaf11117027..2bdce9a35026 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/client_factory.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/client_factory.go @@ -42,41 +42,21 @@ func (c *ClientFactory) NewCacheRulesClient() *CacheRulesClient { return subClient } -func (c *ClientFactory) NewConnectedRegistriesClient() *ConnectedRegistriesClient { - subClient, _ := NewConnectedRegistriesClient(c.subscriptionID, c.credential, c.options) - return subClient -} - func (c *ClientFactory) NewCredentialSetsClient() *CredentialSetsClient { subClient, _ := NewCredentialSetsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewExportPipelinesClient() *ExportPipelinesClient { - subClient, _ := NewExportPipelinesClient(c.subscriptionID, c.credential, c.options) - return subClient -} - func (c *ClientFactory) NewRegistriesClient() *RegistriesClient { subClient, _ := NewRegistriesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewImportPipelinesClient() *ImportPipelinesClient { - subClient, _ := NewImportPipelinesClient(c.subscriptionID, c.credential, c.options) - return subClient -} - func (c *ClientFactory) NewOperationsClient() *OperationsClient { subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewPipelineRunsClient() *PipelineRunsClient { - subClient, _ := NewPipelineRunsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) return subClient @@ -101,23 +81,3 @@ func (c *ClientFactory) NewWebhooksClient() *WebhooksClient { subClient, _ := NewWebhooksClient(c.subscriptionID, c.credential, c.options) return subClient } - -func (c *ClientFactory) NewAgentPoolsClient() *AgentPoolsClient { - subClient, _ := NewAgentPoolsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -func (c *ClientFactory) NewRunsClient() *RunsClient { - subClient, _ := NewRunsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -func (c *ClientFactory) NewTaskRunsClient() *TaskRunsClient { - subClient, _ := NewTaskRunsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -func (c *ClientFactory) NewTasksClient() *TasksClient { - subClient, _ := NewTasksClient(c.subscriptionID, c.credential, c.options) - return subClient -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/connectedregistries_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/connectedregistries_client.go deleted file mode 100644 index dab2285fd747..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/connectedregistries_client.go +++ /dev/null @@ -1,494 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcontainerregistry - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// ConnectedRegistriesClient contains the methods for the ConnectedRegistries group. -// Don't use this type directly, use NewConnectedRegistriesClient() instead. -type ConnectedRegistriesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewConnectedRegistriesClient creates a new instance of ConnectedRegistriesClient with the specified values. -// - subscriptionID - The ID of the target subscription. The value must be an UUID. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewConnectedRegistriesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConnectedRegistriesClient, error) { - cl, err := arm.NewClient(moduleName+".ConnectedRegistriesClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ConnectedRegistriesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginCreate - Creates a connected registry for a container registry with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - registryName - The name of the container registry. -// - connectedRegistryName - The name of the connected registry. -// - connectedRegistryCreateParameters - The parameters for creating a connectedRegistry. -// - options - ConnectedRegistriesClientBeginCreateOptions contains the optional parameters for the ConnectedRegistriesClient.BeginCreate -// method. -func (client *ConnectedRegistriesClient) BeginCreate(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryCreateParameters ConnectedRegistry, options *ConnectedRegistriesClientBeginCreateOptions) (*runtime.Poller[ConnectedRegistriesClientCreateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, registryName, connectedRegistryName, connectedRegistryCreateParameters, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ConnectedRegistriesClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken[ConnectedRegistriesClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Create - Creates a connected registry for a container registry with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -func (client *ConnectedRegistriesClient) create(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryCreateParameters ConnectedRegistry, options *ConnectedRegistriesClientBeginCreateOptions) (*http.Response, error) { - var err error - const operationName = "ConnectedRegistriesClient.BeginCreate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, connectedRegistryName, connectedRegistryCreateParameters, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// createCreateRequest creates the Create request. -func (client *ConnectedRegistriesClient) createCreateRequest(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryCreateParameters ConnectedRegistry, options *ConnectedRegistriesClientBeginCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}" - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - if connectedRegistryName == "" { - return nil, errors.New("parameter connectedRegistryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{connectedRegistryName}", url.PathEscape(connectedRegistryName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, connectedRegistryCreateParameters); err != nil { - return nil, err - } - return req, nil -} - -// BeginDeactivate - Deactivates the connected registry instance. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - registryName - The name of the container registry. -// - connectedRegistryName - The name of the connected registry. -// - options - ConnectedRegistriesClientBeginDeactivateOptions contains the optional parameters for the ConnectedRegistriesClient.BeginDeactivate -// method. -func (client *ConnectedRegistriesClient) BeginDeactivate(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, options *ConnectedRegistriesClientBeginDeactivateOptions) (*runtime.Poller[ConnectedRegistriesClientDeactivateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deactivate(ctx, resourceGroupName, registryName, connectedRegistryName, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ConnectedRegistriesClientDeactivateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken[ConnectedRegistriesClientDeactivateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Deactivate - Deactivates the connected registry instance. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -func (client *ConnectedRegistriesClient) deactivate(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, options *ConnectedRegistriesClientBeginDeactivateOptions) (*http.Response, error) { - var err error - const operationName = "ConnectedRegistriesClient.BeginDeactivate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deactivateCreateRequest(ctx, resourceGroupName, registryName, connectedRegistryName, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// deactivateCreateRequest creates the Deactivate request. -func (client *ConnectedRegistriesClient) deactivateCreateRequest(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, options *ConnectedRegistriesClientBeginDeactivateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}/deactivate" - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - if connectedRegistryName == "" { - return nil, errors.New("parameter connectedRegistryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{connectedRegistryName}", url.PathEscape(connectedRegistryName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// BeginDelete - Deletes a connected registry from a container registry. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - registryName - The name of the container registry. -// - connectedRegistryName - The name of the connected registry. -// - options - ConnectedRegistriesClientBeginDeleteOptions contains the optional parameters for the ConnectedRegistriesClient.BeginDelete -// method. -func (client *ConnectedRegistriesClient) BeginDelete(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, options *ConnectedRegistriesClientBeginDeleteOptions) (*runtime.Poller[ConnectedRegistriesClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, registryName, connectedRegistryName, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ConnectedRegistriesClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken[ConnectedRegistriesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Delete - Deletes a connected registry from a container registry. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -func (client *ConnectedRegistriesClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, options *ConnectedRegistriesClientBeginDeleteOptions) (*http.Response, error) { - var err error - const operationName = "ConnectedRegistriesClient.BeginDelete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, connectedRegistryName, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *ConnectedRegistriesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, options *ConnectedRegistriesClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}" - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - if connectedRegistryName == "" { - return nil, errors.New("parameter connectedRegistryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{connectedRegistryName}", url.PathEscape(connectedRegistryName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Gets the properties of the connected registry. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - registryName - The name of the container registry. -// - connectedRegistryName - The name of the connected registry. -// - options - ConnectedRegistriesClientGetOptions contains the optional parameters for the ConnectedRegistriesClient.Get method. -func (client *ConnectedRegistriesClient) Get(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, options *ConnectedRegistriesClientGetOptions) (ConnectedRegistriesClientGetResponse, error) { - var err error - const operationName = "ConnectedRegistriesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, connectedRegistryName, options) - if err != nil { - return ConnectedRegistriesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ConnectedRegistriesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ConnectedRegistriesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ConnectedRegistriesClient) getCreateRequest(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, options *ConnectedRegistriesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}" - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - if connectedRegistryName == "" { - return nil, errors.New("parameter connectedRegistryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{connectedRegistryName}", url.PathEscape(connectedRegistryName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ConnectedRegistriesClient) getHandleResponse(resp *http.Response) (ConnectedRegistriesClientGetResponse, error) { - result := ConnectedRegistriesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ConnectedRegistry); err != nil { - return ConnectedRegistriesClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Lists all connected registries for the specified container registry. -// -// Generated from API version 2023-01-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - registryName - The name of the container registry. -// - options - ConnectedRegistriesClientListOptions contains the optional parameters for the ConnectedRegistriesClient.NewListPager -// method. -func (client *ConnectedRegistriesClient) NewListPager(resourceGroupName string, registryName string, options *ConnectedRegistriesClientListOptions) *runtime.Pager[ConnectedRegistriesClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[ConnectedRegistriesClientListResponse]{ - More: func(page ConnectedRegistriesClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ConnectedRegistriesClientListResponse) (ConnectedRegistriesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ConnectedRegistriesClient.NewListPager") - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, resourceGroupName, registryName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ConnectedRegistriesClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ConnectedRegistriesClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ConnectedRegistriesClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *ConnectedRegistriesClient) listCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *ConnectedRegistriesClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries" - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *ConnectedRegistriesClient) listHandleResponse(resp *http.Response) (ConnectedRegistriesClientListResponse, error) { - result := ConnectedRegistriesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ConnectedRegistryListResult); err != nil { - return ConnectedRegistriesClientListResponse{}, err - } - return result, nil -} - -// BeginUpdate - Updates a connected registry with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - registryName - The name of the container registry. -// - connectedRegistryName - The name of the connected registry. -// - connectedRegistryUpdateParameters - The parameters for updating a connectedRegistry. -// - options - ConnectedRegistriesClientBeginUpdateOptions contains the optional parameters for the ConnectedRegistriesClient.BeginUpdate -// method. -func (client *ConnectedRegistriesClient) BeginUpdate(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryUpdateParameters ConnectedRegistryUpdateParameters, options *ConnectedRegistriesClientBeginUpdateOptions) (*runtime.Poller[ConnectedRegistriesClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, registryName, connectedRegistryName, connectedRegistryUpdateParameters, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ConnectedRegistriesClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken[ConnectedRegistriesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Update - Updates a connected registry with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -func (client *ConnectedRegistriesClient) update(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryUpdateParameters ConnectedRegistryUpdateParameters, options *ConnectedRegistriesClientBeginUpdateOptions) (*http.Response, error) { - var err error - const operationName = "ConnectedRegistriesClient.BeginUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, connectedRegistryName, connectedRegistryUpdateParameters, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// updateCreateRequest creates the Update request. -func (client *ConnectedRegistriesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryUpdateParameters ConnectedRegistryUpdateParameters, options *ConnectedRegistriesClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}" - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - if connectedRegistryName == "" { - return nil, errors.New("parameter connectedRegistryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{connectedRegistryName}", url.PathEscape(connectedRegistryName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, connectedRegistryUpdateParameters); err != nil { - return nil, err - } - return req, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/connectedregistries_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/connectedregistries_client_example_test.go deleted file mode 100644 index 680d88753137..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/connectedregistries_client_example_test.go +++ /dev/null @@ -1,302 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcontainerregistry_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ConnectedRegistryList.json -func ExampleConnectedRegistriesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewConnectedRegistriesClient().NewListPager("myResourceGroup", "myRegistry", &armcontainerregistry.ConnectedRegistriesClientListOptions{Filter: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ConnectedRegistryListResult = armcontainerregistry.ConnectedRegistryListResult{ - // Value: []*armcontainerregistry.ConnectedRegistry{ - // { - // Name: to.Ptr("myConnectedRegistry"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/connectedRegistries"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/connectedRegistries/myConnectedRegistry"), - // Properties: &armcontainerregistry.ConnectedRegistryProperties{ - // Activation: &armcontainerregistry.ActivationProperties{ - // Status: to.Ptr(armcontainerregistry.ActivationStatusInactive), - // }, - // ClientTokenIDs: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/client1Token")}, - // Logging: &armcontainerregistry.LoggingProperties{ - // AuditLogStatus: to.Ptr(armcontainerregistry.AuditLogStatusDisabled), - // LogLevel: to.Ptr(armcontainerregistry.LogLevelInformation), - // }, - // Mode: to.Ptr(armcontainerregistry.ConnectedRegistryModeReadWrite), - // NotificationsList: []*string{ - // to.Ptr("hello-world:*:*"), - // to.Ptr("sample/repo/*:1.0:*")}, - // Parent: &armcontainerregistry.ParentProperties{ - // SyncProperties: &armcontainerregistry.SyncProperties{ - // MessageTTL: to.Ptr("P2D"), - // Schedule: to.Ptr("0 9 * * *"), - // SyncWindow: to.Ptr("PT3H"), - // TokenID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/syncToken"), - // }, - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ConnectedRegistryGet.json -func ExampleConnectedRegistriesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewConnectedRegistriesClient().Get(ctx, "myResourceGroup", "myRegistry", "myConnectedRegistry", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConnectedRegistry = armcontainerregistry.ConnectedRegistry{ - // Name: to.Ptr("myConnectedRegistry"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/connectedRegistries"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/connectedRegistries/myConnectedRegistry"), - // Properties: &armcontainerregistry.ConnectedRegistryProperties{ - // Activation: &armcontainerregistry.ActivationProperties{ - // Status: to.Ptr(armcontainerregistry.ActivationStatusInactive), - // }, - // ClientTokenIDs: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/client1Token")}, - // Logging: &armcontainerregistry.LoggingProperties{ - // AuditLogStatus: to.Ptr(armcontainerregistry.AuditLogStatusDisabled), - // LogLevel: to.Ptr(armcontainerregistry.LogLevelInformation), - // }, - // Mode: to.Ptr(armcontainerregistry.ConnectedRegistryModeReadWrite), - // NotificationsList: []*string{ - // to.Ptr("hello-world:*:*"), - // to.Ptr("sample/repo/*:1.0:*")}, - // Parent: &armcontainerregistry.ParentProperties{ - // SyncProperties: &armcontainerregistry.SyncProperties{ - // MessageTTL: to.Ptr("P2D"), - // Schedule: to.Ptr("0 9 * * *"), - // SyncWindow: to.Ptr("PT3H"), - // TokenID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/syncToken"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ConnectedRegistryCreate.json -func ExampleConnectedRegistriesClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConnectedRegistriesClient().BeginCreate(ctx, "myResourceGroup", "myRegistry", "myConnectedRegistry", armcontainerregistry.ConnectedRegistry{ - Properties: &armcontainerregistry.ConnectedRegistryProperties{ - ClientTokenIDs: []*string{ - to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/client1Token")}, - Mode: to.Ptr(armcontainerregistry.ConnectedRegistryModeReadWrite), - NotificationsList: []*string{ - to.Ptr("hello-world:*:*"), - to.Ptr("sample/repo/*:1.0:*")}, - Parent: &armcontainerregistry.ParentProperties{ - SyncProperties: &armcontainerregistry.SyncProperties{ - MessageTTL: to.Ptr("P2D"), - Schedule: to.Ptr("0 9 * * *"), - SyncWindow: to.Ptr("PT3H"), - TokenID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/syncToken"), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConnectedRegistry = armcontainerregistry.ConnectedRegistry{ - // Name: to.Ptr("myConnectedRegistry"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/connectedRegistries"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/connectedRegistries/myConnectedRegistry"), - // Properties: &armcontainerregistry.ConnectedRegistryProperties{ - // Activation: &armcontainerregistry.ActivationProperties{ - // Status: to.Ptr(armcontainerregistry.ActivationStatusInactive), - // }, - // ClientTokenIDs: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/client1Token")}, - // Logging: &armcontainerregistry.LoggingProperties{ - // AuditLogStatus: to.Ptr(armcontainerregistry.AuditLogStatusDisabled), - // LogLevel: to.Ptr(armcontainerregistry.LogLevelInformation), - // }, - // Mode: to.Ptr(armcontainerregistry.ConnectedRegistryModeReadWrite), - // NotificationsList: []*string{ - // to.Ptr("hello-world:*:*"), - // to.Ptr("sample/repo/*:1.0:*")}, - // Parent: &armcontainerregistry.ParentProperties{ - // SyncProperties: &armcontainerregistry.SyncProperties{ - // MessageTTL: to.Ptr("P2D"), - // Schedule: to.Ptr("0 9 * * *"), - // SyncWindow: to.Ptr("PT3H"), - // TokenID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/syncToken"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ConnectedRegistryDelete.json -func ExampleConnectedRegistriesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConnectedRegistriesClient().BeginDelete(ctx, "myResourceGroup", "myRegistry", "myConnectedRegistry", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ConnectedRegistryUpdate.json -func ExampleConnectedRegistriesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConnectedRegistriesClient().BeginUpdate(ctx, "myResourceGroup", "myRegistry", "myScopeMap", armcontainerregistry.ConnectedRegistryUpdateParameters{ - Properties: &armcontainerregistry.ConnectedRegistryUpdateProperties{ - ClientTokenIDs: []*string{ - to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/client1Token"), - to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/client2Token")}, - Logging: &armcontainerregistry.LoggingProperties{ - AuditLogStatus: to.Ptr(armcontainerregistry.AuditLogStatusEnabled), - LogLevel: to.Ptr(armcontainerregistry.LogLevelDebug), - }, - NotificationsList: []*string{ - to.Ptr("hello-world:*:*"), - to.Ptr("sample/repo/*:1.0:*")}, - SyncProperties: &armcontainerregistry.SyncUpdateProperties{ - MessageTTL: to.Ptr("P30D"), - Schedule: to.Ptr("0 0 */10 * *"), - SyncWindow: to.Ptr("P2D"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConnectedRegistry = armcontainerregistry.ConnectedRegistry{ - // Name: to.Ptr("myConnectedRegistry"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/connectedRegistries"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/connectedRegistries/myConnectedRegistry"), - // Properties: &armcontainerregistry.ConnectedRegistryProperties{ - // ClientTokenIDs: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/client1Token"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/client2Token")}, - // Logging: &armcontainerregistry.LoggingProperties{ - // AuditLogStatus: to.Ptr(armcontainerregistry.AuditLogStatusEnabled), - // LogLevel: to.Ptr(armcontainerregistry.LogLevelDebug), - // }, - // Mode: to.Ptr(armcontainerregistry.ConnectedRegistryModeReadWrite), - // NotificationsList: []*string{ - // to.Ptr("hello-world:*:*"), - // to.Ptr("sample/repo/*:1.0:*")}, - // Parent: &armcontainerregistry.ParentProperties{ - // SyncProperties: &armcontainerregistry.SyncProperties{ - // MessageTTL: to.Ptr("P30D"), - // Schedule: to.Ptr("0 0 */10 * *"), - // SyncWindow: to.Ptr("P2D"), - // TokenID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/syncToken"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ConnectedRegistryDeactivate.json -func ExampleConnectedRegistriesClient_BeginDeactivate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConnectedRegistriesClient().BeginDeactivate(ctx, "myResourceGroup", "myRegistry", "myConnectedRegistry", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/constants.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/constants.go index 9fca692a842b..b6d99e6004af 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.2" + moduleVersion = "v2.0.0" ) // Action - The action of IP ACL rule. @@ -43,162 +43,6 @@ func PossibleActionsRequiredValues() []ActionsRequired { } } -// ActivationStatus - The activation status of the connected registry. -type ActivationStatus string - -const ( - ActivationStatusActive ActivationStatus = "Active" - ActivationStatusInactive ActivationStatus = "Inactive" -) - -// PossibleActivationStatusValues returns the possible values for the ActivationStatus const type. -func PossibleActivationStatusValues() []ActivationStatus { - return []ActivationStatus{ - ActivationStatusActive, - ActivationStatusInactive, - } -} - -// Architecture - The OS architecture. -type Architecture string - -const ( - ArchitectureAmd64 Architecture = "amd64" - ArchitectureArm Architecture = "arm" - ArchitectureArm64 Architecture = "arm64" - ArchitectureThreeHundredEightySix Architecture = "386" - ArchitectureX86 Architecture = "x86" -) - -// PossibleArchitectureValues returns the possible values for the Architecture const type. -func PossibleArchitectureValues() []Architecture { - return []Architecture{ - ArchitectureAmd64, - ArchitectureArm, - ArchitectureArm64, - ArchitectureThreeHundredEightySix, - ArchitectureX86, - } -} - -// AuditLogStatus - Indicates whether audit logs are enabled on the connected registry. -type AuditLogStatus string - -const ( - AuditLogStatusDisabled AuditLogStatus = "Disabled" - AuditLogStatusEnabled AuditLogStatus = "Enabled" -) - -// PossibleAuditLogStatusValues returns the possible values for the AuditLogStatus const type. -func PossibleAuditLogStatusValues() []AuditLogStatus { - return []AuditLogStatus{ - AuditLogStatusDisabled, - AuditLogStatusEnabled, - } -} - -// AzureADAuthenticationAsArmPolicyStatus - The value that indicates whether the policy is enabled or not. -type AzureADAuthenticationAsArmPolicyStatus string - -const ( - AzureADAuthenticationAsArmPolicyStatusDisabled AzureADAuthenticationAsArmPolicyStatus = "disabled" - AzureADAuthenticationAsArmPolicyStatusEnabled AzureADAuthenticationAsArmPolicyStatus = "enabled" -) - -// PossibleAzureADAuthenticationAsArmPolicyStatusValues returns the possible values for the AzureADAuthenticationAsArmPolicyStatus const type. -func PossibleAzureADAuthenticationAsArmPolicyStatusValues() []AzureADAuthenticationAsArmPolicyStatus { - return []AzureADAuthenticationAsArmPolicyStatus{ - AzureADAuthenticationAsArmPolicyStatusDisabled, - AzureADAuthenticationAsArmPolicyStatusEnabled, - } -} - -// BaseImageDependencyType - The type of the base image dependency. -type BaseImageDependencyType string - -const ( - BaseImageDependencyTypeBuildTime BaseImageDependencyType = "BuildTime" - BaseImageDependencyTypeRunTime BaseImageDependencyType = "RunTime" -) - -// PossibleBaseImageDependencyTypeValues returns the possible values for the BaseImageDependencyType const type. -func PossibleBaseImageDependencyTypeValues() []BaseImageDependencyType { - return []BaseImageDependencyType{ - BaseImageDependencyTypeBuildTime, - BaseImageDependencyTypeRunTime, - } -} - -// BaseImageTriggerType - The type of the auto trigger for base image dependency updates. -type BaseImageTriggerType string - -const ( - BaseImageTriggerTypeAll BaseImageTriggerType = "All" - BaseImageTriggerTypeRuntime BaseImageTriggerType = "Runtime" -) - -// PossibleBaseImageTriggerTypeValues returns the possible values for the BaseImageTriggerType const type. -func PossibleBaseImageTriggerTypeValues() []BaseImageTriggerType { - return []BaseImageTriggerType{ - BaseImageTriggerTypeAll, - BaseImageTriggerTypeRuntime, - } -} - -// CertificateType - The type of certificate location. -type CertificateType string - -const ( - CertificateTypeLocalDirectory CertificateType = "LocalDirectory" -) - -// PossibleCertificateTypeValues returns the possible values for the CertificateType const type. -func PossibleCertificateTypeValues() []CertificateType { - return []CertificateType{ - CertificateTypeLocalDirectory, - } -} - -// ConnectedRegistryMode - The mode of the connected registry resource that indicates the permissions of the registry. -type ConnectedRegistryMode string - -const ( - ConnectedRegistryModeMirror ConnectedRegistryMode = "Mirror" - ConnectedRegistryModeReadOnly ConnectedRegistryMode = "ReadOnly" - ConnectedRegistryModeReadWrite ConnectedRegistryMode = "ReadWrite" - ConnectedRegistryModeRegistry ConnectedRegistryMode = "Registry" -) - -// PossibleConnectedRegistryModeValues returns the possible values for the ConnectedRegistryMode const type. -func PossibleConnectedRegistryModeValues() []ConnectedRegistryMode { - return []ConnectedRegistryMode{ - ConnectedRegistryModeMirror, - ConnectedRegistryModeReadOnly, - ConnectedRegistryModeReadWrite, - ConnectedRegistryModeRegistry, - } -} - -// ConnectionState - The current connection state of the connected registry. -type ConnectionState string - -const ( - ConnectionStateOffline ConnectionState = "Offline" - ConnectionStateOnline ConnectionState = "Online" - ConnectionStateSyncing ConnectionState = "Syncing" - ConnectionStateUnhealthy ConnectionState = "Unhealthy" -) - -// PossibleConnectionStateValues returns the possible values for the ConnectionState const type. -func PossibleConnectionStateValues() []ConnectionState { - return []ConnectionState{ - ConnectionStateOffline, - ConnectionStateOnline, - ConnectionStateSyncing, - ConnectionStateUnhealthy, - } -} - // ConnectionStatus - The private link service connection status. type ConnectionStatus string @@ -354,28 +198,6 @@ func PossibleLastModifiedByTypeValues() []LastModifiedByType { } } -// LogLevel - The verbosity of logs persisted on the connected registry. -type LogLevel string - -const ( - LogLevelDebug LogLevel = "Debug" - LogLevelError LogLevel = "Error" - LogLevelInformation LogLevel = "Information" - LogLevelNone LogLevel = "None" - LogLevelWarning LogLevel = "Warning" -) - -// PossibleLogLevelValues returns the possible values for the LogLevel const type. -func PossibleLogLevelValues() []LogLevel { - return []LogLevel{ - LogLevelDebug, - LogLevelError, - LogLevelInformation, - LogLevelNone, - LogLevelWarning, - } -} - // NetworkRuleBypassOptions - Whether to allow trusted Azure services to access a network restricted registry. type NetworkRuleBypassOptions string @@ -392,22 +214,6 @@ func PossibleNetworkRuleBypassOptionsValues() []NetworkRuleBypassOptions { } } -// OS - The OS of agent machine -type OS string - -const ( - OSLinux OS = "Linux" - OSWindows OS = "Windows" -) - -// PossibleOSValues returns the possible values for the OS const type. -func PossibleOSValues() []OS { - return []OS{ - OSLinux, - OSWindows, - } -} - // PasswordName - The password name. type PasswordName string @@ -424,67 +230,6 @@ func PossiblePasswordNameValues() []PasswordName { } } -type PipelineOptions string - -const ( - PipelineOptionsContinueOnErrors PipelineOptions = "ContinueOnErrors" - PipelineOptionsDeleteSourceBlobOnSuccess PipelineOptions = "DeleteSourceBlobOnSuccess" - PipelineOptionsOverwriteBlobs PipelineOptions = "OverwriteBlobs" - PipelineOptionsOverwriteTags PipelineOptions = "OverwriteTags" -) - -// PossiblePipelineOptionsValues returns the possible values for the PipelineOptions const type. -func PossiblePipelineOptionsValues() []PipelineOptions { - return []PipelineOptions{ - PipelineOptionsContinueOnErrors, - PipelineOptionsDeleteSourceBlobOnSuccess, - PipelineOptionsOverwriteBlobs, - PipelineOptionsOverwriteTags, - } -} - -// PipelineRunSourceType - The type of the source. -type PipelineRunSourceType string - -const ( - PipelineRunSourceTypeAzureStorageBlob PipelineRunSourceType = "AzureStorageBlob" -) - -// PossiblePipelineRunSourceTypeValues returns the possible values for the PipelineRunSourceType const type. -func PossiblePipelineRunSourceTypeValues() []PipelineRunSourceType { - return []PipelineRunSourceType{ - PipelineRunSourceTypeAzureStorageBlob, - } -} - -// PipelineRunTargetType - The type of the target. -type PipelineRunTargetType string - -const ( - PipelineRunTargetTypeAzureStorageBlob PipelineRunTargetType = "AzureStorageBlob" -) - -// PossiblePipelineRunTargetTypeValues returns the possible values for the PipelineRunTargetType const type. -func PossiblePipelineRunTargetTypeValues() []PipelineRunTargetType { - return []PipelineRunTargetType{ - PipelineRunTargetTypeAzureStorageBlob, - } -} - -// PipelineSourceType - The type of source for the import pipeline. -type PipelineSourceType string - -const ( - PipelineSourceTypeAzureStorageBlobContainer PipelineSourceType = "AzureStorageBlobContainer" -) - -// PossiblePipelineSourceTypeValues returns the possible values for the PipelineSourceType const type. -func PossiblePipelineSourceTypeValues() []PipelineSourceType { - return []PipelineSourceType{ - PipelineSourceTypeAzureStorageBlobContainer, - } -} - // PolicyStatus - The value that indicates whether the policy is enabled or not. type PolicyStatus string @@ -501,7 +246,7 @@ func PossiblePolicyStatusValues() []PolicyStatus { } } -// ProvisioningState - The provisioning state of this agent pool +// ProvisioningState - Provisioning state of the resource. type ProvisioningState string const ( @@ -577,54 +322,6 @@ func PossibleResourceIdentityTypeValues() []ResourceIdentityType { } } -// RunStatus - The current status of the run. -type RunStatus string - -const ( - RunStatusCanceled RunStatus = "Canceled" - RunStatusError RunStatus = "Error" - RunStatusFailed RunStatus = "Failed" - RunStatusQueued RunStatus = "Queued" - RunStatusRunning RunStatus = "Running" - RunStatusStarted RunStatus = "Started" - RunStatusSucceeded RunStatus = "Succeeded" - RunStatusTimeout RunStatus = "Timeout" -) - -// PossibleRunStatusValues returns the possible values for the RunStatus const type. -func PossibleRunStatusValues() []RunStatus { - return []RunStatus{ - RunStatusCanceled, - RunStatusError, - RunStatusFailed, - RunStatusQueued, - RunStatusRunning, - RunStatusStarted, - RunStatusSucceeded, - RunStatusTimeout, - } -} - -// RunType - The type of run. -type RunType string - -const ( - RunTypeAutoBuild RunType = "AutoBuild" - RunTypeAutoRun RunType = "AutoRun" - RunTypeQuickBuild RunType = "QuickBuild" - RunTypeQuickRun RunType = "QuickRun" -) - -// PossibleRunTypeValues returns the possible values for the RunType const type. -func PossibleRunTypeValues() []RunType { - return []RunType{ - RunTypeAutoBuild, - RunTypeAutoRun, - RunTypeQuickBuild, - RunTypeQuickRun, - } -} - // SKUName - The SKU name of the container registry. Required for registry creation. type SKUName string @@ -665,121 +362,6 @@ func PossibleSKUTierValues() []SKUTier { } } -// SecretObjectType - The type of the secret object which determines how the value of the secret object has to be interpreted. -type SecretObjectType string - -const ( - SecretObjectTypeOpaque SecretObjectType = "Opaque" - SecretObjectTypeVaultsecret SecretObjectType = "Vaultsecret" -) - -// PossibleSecretObjectTypeValues returns the possible values for the SecretObjectType const type. -func PossibleSecretObjectTypeValues() []SecretObjectType { - return []SecretObjectType{ - SecretObjectTypeOpaque, - SecretObjectTypeVaultsecret, - } -} - -// SourceControlType - The type of source control service. -type SourceControlType string - -const ( - SourceControlTypeGithub SourceControlType = "Github" - SourceControlTypeVisualStudioTeamService SourceControlType = "VisualStudioTeamService" -) - -// PossibleSourceControlTypeValues returns the possible values for the SourceControlType const type. -func PossibleSourceControlTypeValues() []SourceControlType { - return []SourceControlType{ - SourceControlTypeGithub, - SourceControlTypeVisualStudioTeamService, - } -} - -// SourceRegistryLoginMode - The authentication mode which determines the source registry login scope. The credentials for -// the source registry will be generated using the given scope. These credentials will be used to login to -// the source registry during the run. -type SourceRegistryLoginMode string - -const ( - SourceRegistryLoginModeDefault SourceRegistryLoginMode = "Default" - SourceRegistryLoginModeNone SourceRegistryLoginMode = "None" -) - -// PossibleSourceRegistryLoginModeValues returns the possible values for the SourceRegistryLoginMode const type. -func PossibleSourceRegistryLoginModeValues() []SourceRegistryLoginMode { - return []SourceRegistryLoginMode{ - SourceRegistryLoginModeDefault, - SourceRegistryLoginModeNone, - } -} - -type SourceTriggerEvent string - -const ( - SourceTriggerEventCommit SourceTriggerEvent = "commit" - SourceTriggerEventPullrequest SourceTriggerEvent = "pullrequest" -) - -// PossibleSourceTriggerEventValues returns the possible values for the SourceTriggerEvent const type. -func PossibleSourceTriggerEventValues() []SourceTriggerEvent { - return []SourceTriggerEvent{ - SourceTriggerEventCommit, - SourceTriggerEventPullrequest, - } -} - -// StepType - The type of the step. -type StepType string - -const ( - StepTypeDocker StepType = "Docker" - StepTypeEncodedTask StepType = "EncodedTask" - StepTypeFileTask StepType = "FileTask" -) - -// PossibleStepTypeValues returns the possible values for the StepType const type. -func PossibleStepTypeValues() []StepType { - return []StepType{ - StepTypeDocker, - StepTypeEncodedTask, - StepTypeFileTask, - } -} - -// TLSStatus - Indicates whether HTTPS is enabled for the login server. -type TLSStatus string - -const ( - TLSStatusDisabled TLSStatus = "Disabled" - TLSStatusEnabled TLSStatus = "Enabled" -) - -// PossibleTLSStatusValues returns the possible values for the TLSStatus const type. -func PossibleTLSStatusValues() []TLSStatus { - return []TLSStatus{ - TLSStatusDisabled, - TLSStatusEnabled, - } -} - -// TaskStatus - The current status of task. -type TaskStatus string - -const ( - TaskStatusDisabled TaskStatus = "Disabled" - TaskStatusEnabled TaskStatus = "Enabled" -) - -// PossibleTaskStatusValues returns the possible values for the TaskStatus const type. -func PossibleTaskStatusValues() []TaskStatus { - return []TaskStatus{ - TaskStatusDisabled, - TaskStatusEnabled, - } -} - type TokenCertificateName string const ( @@ -827,38 +409,6 @@ func PossibleTokenStatusValues() []TokenStatus { } } -// TokenType - The type of Auth token. -type TokenType string - -const ( - TokenTypeOAuth TokenType = "OAuth" - TokenTypePAT TokenType = "PAT" -) - -// PossibleTokenTypeValues returns the possible values for the TokenType const type. -func PossibleTokenTypeValues() []TokenType { - return []TokenType{ - TokenTypeOAuth, - TokenTypePAT, - } -} - -// TriggerStatus - The current status of trigger. -type TriggerStatus string - -const ( - TriggerStatusDisabled TriggerStatus = "Disabled" - TriggerStatusEnabled TriggerStatus = "Enabled" -) - -// PossibleTriggerStatusValues returns the possible values for the TriggerStatus const type. -func PossibleTriggerStatusValues() []TriggerStatus { - return []TriggerStatus{ - TriggerStatusDisabled, - TriggerStatusEnabled, - } -} - // TrustPolicyType - The type of trust policy. type TrustPolicyType string @@ -873,40 +423,6 @@ func PossibleTrustPolicyTypeValues() []TrustPolicyType { } } -// UpdateTriggerPayloadType - Type of Payload body for Base image update triggers. -type UpdateTriggerPayloadType string - -const ( - UpdateTriggerPayloadTypeDefault UpdateTriggerPayloadType = "Default" - UpdateTriggerPayloadTypeToken UpdateTriggerPayloadType = "Token" -) - -// PossibleUpdateTriggerPayloadTypeValues returns the possible values for the UpdateTriggerPayloadType const type. -func PossibleUpdateTriggerPayloadTypeValues() []UpdateTriggerPayloadType { - return []UpdateTriggerPayloadType{ - UpdateTriggerPayloadTypeDefault, - UpdateTriggerPayloadTypeToken, - } -} - -// Variant - Variant of the CPU. -type Variant string - -const ( - VariantV6 Variant = "v6" - VariantV7 Variant = "v7" - VariantV8 Variant = "v8" -) - -// PossibleVariantValues returns the possible values for the Variant const type. -func PossibleVariantValues() []Variant { - return []Variant{ - VariantV6, - VariantV7, - VariantV8, - } -} - type WebhookAction string const ( diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client.go index daf741dfa898..65a51e2a1f6e 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client.go @@ -46,7 +46,7 @@ func NewCredentialSetsClient(subscriptionID string, credential azcore.TokenCrede // BeginCreate - Creates a credential set for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - credentialSetName - The name of the credential set. @@ -71,7 +71,7 @@ func (client *CredentialSetsClient) BeginCreate(ctx context.Context, resourceGro // Create - Creates a credential set for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *CredentialSetsClient) create(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, credentialSetCreateParameters CredentialSet, options *CredentialSetsClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "CredentialSetsClient.BeginCreate" @@ -114,7 +114,7 @@ func (client *CredentialSetsClient) createCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, credentialSetCreateParameters); err != nil { @@ -126,7 +126,7 @@ func (client *CredentialSetsClient) createCreateRequest(ctx context.Context, res // BeginDelete - Deletes a credential set from a container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - credentialSetName - The name of the credential set. @@ -150,7 +150,7 @@ func (client *CredentialSetsClient) BeginDelete(ctx context.Context, resourceGro // Delete - Deletes a credential set from a container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *CredentialSetsClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, options *CredentialSetsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "CredentialSetsClient.BeginDelete" @@ -193,7 +193,7 @@ func (client *CredentialSetsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -202,7 +202,7 @@ func (client *CredentialSetsClient) deleteCreateRequest(ctx context.Context, res // Get - Gets the properties of the specified credential set resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - credentialSetName - The name of the credential set. @@ -250,7 +250,7 @@ func (client *CredentialSetsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -267,7 +267,7 @@ func (client *CredentialSetsClient) getHandleResponse(resp *http.Response) (Cred // NewListPager - Lists all credential set resources for the specified container registry. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - options - CredentialSetsClientListOptions contains the optional parameters for the CredentialSetsClient.NewListPager method. @@ -318,7 +318,7 @@ func (client *CredentialSetsClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -336,7 +336,7 @@ func (client *CredentialSetsClient) listHandleResponse(resp *http.Response) (Cre // BeginUpdate - Updates a credential set for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - credentialSetName - The name of the credential set. @@ -361,7 +361,7 @@ func (client *CredentialSetsClient) BeginUpdate(ctx context.Context, resourceGro // Update - Updates a credential set for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *CredentialSetsClient) update(ctx context.Context, resourceGroupName string, registryName string, credentialSetName string, credentialSetUpdateParameters CredentialSetUpdateParameters, options *CredentialSetsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "CredentialSetsClient.BeginUpdate" @@ -404,7 +404,7 @@ func (client *CredentialSetsClient) updateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, credentialSetUpdateParameters); err != nil { diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/credentialsets_client_example_test.go 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 deleted file mode 100644 index 782b4446aefb..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/exportpipelines_client.go +++ /dev/null @@ -1,335 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcontainerregistry - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// ExportPipelinesClient contains the methods for the ExportPipelines group. -// Don't use this type directly, use NewExportPipelinesClient() instead. -type ExportPipelinesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewExportPipelinesClient creates a new instance of ExportPipelinesClient with the specified values. -// - subscriptionID - The ID of the target subscription. The value must be an UUID. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewExportPipelinesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExportPipelinesClient, error) { - cl, err := arm.NewClient(moduleName+".ExportPipelinesClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ExportPipelinesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginCreate - Creates an export pipeline for a container registry with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - registryName - The name of the container registry. -// - exportPipelineName - The name of the export pipeline. -// - exportPipelineCreateParameters - The parameters for creating an export pipeline. -// - options - ExportPipelinesClientBeginCreateOptions contains the optional parameters for the ExportPipelinesClient.BeginCreate -// method. -func (client *ExportPipelinesClient) BeginCreate(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, exportPipelineCreateParameters ExportPipeline, options *ExportPipelinesClientBeginCreateOptions) (*runtime.Poller[ExportPipelinesClientCreateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, registryName, exportPipelineName, exportPipelineCreateParameters, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExportPipelinesClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken[ExportPipelinesClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Create - Creates an export pipeline for a container registry with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -func (client *ExportPipelinesClient) create(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, exportPipelineCreateParameters ExportPipeline, options *ExportPipelinesClientBeginCreateOptions) (*http.Response, error) { - var err error - const operationName = "ExportPipelinesClient.BeginCreate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, exportPipelineName, exportPipelineCreateParameters, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// createCreateRequest creates the Create request. -func (client *ExportPipelinesClient) createCreateRequest(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, exportPipelineCreateParameters ExportPipeline, options *ExportPipelinesClientBeginCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}" - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - if exportPipelineName == "" { - return nil, errors.New("parameter exportPipelineName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{exportPipelineName}", url.PathEscape(exportPipelineName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, exportPipelineCreateParameters); err != nil { - return nil, err - } - return req, nil -} - -// BeginDelete - Deletes an export pipeline from a container registry. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - registryName - The name of the container registry. -// - exportPipelineName - The name of the export pipeline. -// - options - ExportPipelinesClientBeginDeleteOptions contains the optional parameters for the ExportPipelinesClient.BeginDelete -// method. -func (client *ExportPipelinesClient) BeginDelete(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, options *ExportPipelinesClientBeginDeleteOptions) (*runtime.Poller[ExportPipelinesClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, registryName, exportPipelineName, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExportPipelinesClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken[ExportPipelinesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Delete - Deletes an export pipeline from a container registry. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -func (client *ExportPipelinesClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, options *ExportPipelinesClientBeginDeleteOptions) (*http.Response, error) { - var err error - const operationName = "ExportPipelinesClient.BeginDelete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, exportPipelineName, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *ExportPipelinesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, options *ExportPipelinesClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}" - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - if exportPipelineName == "" { - return nil, errors.New("parameter exportPipelineName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{exportPipelineName}", url.PathEscape(exportPipelineName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Gets the properties of the export pipeline. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - registryName - The name of the container registry. -// - exportPipelineName - The name of the export pipeline. -// - options - ExportPipelinesClientGetOptions contains the optional parameters for the ExportPipelinesClient.Get method. -func (client *ExportPipelinesClient) Get(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, options *ExportPipelinesClientGetOptions) (ExportPipelinesClientGetResponse, error) { - var err error - const operationName = "ExportPipelinesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, exportPipelineName, options) - if err != nil { - return ExportPipelinesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ExportPipelinesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ExportPipelinesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ExportPipelinesClient) getCreateRequest(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, options *ExportPipelinesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}" - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - if exportPipelineName == "" { - return nil, errors.New("parameter exportPipelineName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{exportPipelineName}", url.PathEscape(exportPipelineName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ExportPipelinesClient) getHandleResponse(resp *http.Response) (ExportPipelinesClientGetResponse, error) { - result := ExportPipelinesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ExportPipeline); err != nil { - return ExportPipelinesClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Lists all export pipelines for the specified container registry. -// -// Generated from API version 2023-01-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - registryName - The name of the container registry. -// - options - ExportPipelinesClientListOptions contains the optional parameters for the ExportPipelinesClient.NewListPager -// method. -func (client *ExportPipelinesClient) NewListPager(resourceGroupName string, registryName string, options *ExportPipelinesClientListOptions) *runtime.Pager[ExportPipelinesClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[ExportPipelinesClientListResponse]{ - More: func(page ExportPipelinesClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ExportPipelinesClientListResponse) (ExportPipelinesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ExportPipelinesClient.NewListPager") - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, resourceGroupName, registryName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ExportPipelinesClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ExportPipelinesClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ExportPipelinesClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *ExportPipelinesClient) listCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *ExportPipelinesClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/exportPipelines" - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *ExportPipelinesClient) listHandleResponse(resp *http.Response) (ExportPipelinesClientListResponse, error) { - result := ExportPipelinesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ExportPipelineListResult); err != nil { - return ExportPipelinesClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/exportpipelines_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/exportpipelines_client_example_test.go deleted file mode 100644 index a889c62c5891..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/exportpipelines_client_example_test.go +++ /dev/null @@ -1,189 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcontainerregistry_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ExportPipelineList.json -func ExampleExportPipelinesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewExportPipelinesClient().NewListPager("myResourceGroup", "myRegistry", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ExportPipelineListResult = armcontainerregistry.ExportPipelineListResult{ - // Value: []*armcontainerregistry.ExportPipeline{ - // { - // Name: to.Ptr("myExportPipeline"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/exportPipelines"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/exportPipelines/myExportPipeline"), - // Identity: &armcontainerregistry.IdentityProperties{ - // Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("fa153151-b9fd-46f4-9088-5e6600f2689v"), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-abu4gm510ccd"), - // }, - // Location: to.Ptr("westus"), - // Properties: &armcontainerregistry.ExportPipelineProperties{ - // Options: []*armcontainerregistry.PipelineOptions{ - // to.Ptr(armcontainerregistry.PipelineOptionsOverwriteBlobs)}, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Target: &armcontainerregistry.ExportPipelineTargetProperties{ - // Type: to.Ptr("AzureStorageBlobContainer"), - // KeyVaultURI: to.Ptr("https://myvault.vault.azure.net/secrets/acrexportsas"), - // URI: to.Ptr("https://accountname.blob.core.windows.net/containername"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ExportPipelineGet.json -func ExampleExportPipelinesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportPipelinesClient().Get(ctx, "myResourceGroup", "myRegistry", "myExportPipeline", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExportPipeline = armcontainerregistry.ExportPipeline{ - // Name: to.Ptr("myExportPipeline"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/exportPipelines"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/exportPipelines/myExportPipeline"), - // Identity: &armcontainerregistry.IdentityProperties{ - // Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("fa153151-b9fd-46f4-9088-5e6600f2689v"), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-abu4gm510ccd"), - // }, - // Location: to.Ptr("westus"), - // Properties: &armcontainerregistry.ExportPipelineProperties{ - // Options: []*armcontainerregistry.PipelineOptions{ - // to.Ptr(armcontainerregistry.PipelineOptionsOverwriteBlobs)}, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Target: &armcontainerregistry.ExportPipelineTargetProperties{ - // Type: to.Ptr("AzureStorageBlobContainer"), - // KeyVaultURI: to.Ptr("https://myvault.vault.azure.net/secrets/acrexportsas"), - // URI: to.Ptr("https://accountname.blob.core.windows.net/containername"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ExportPipelineCreate.json -func ExampleExportPipelinesClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExportPipelinesClient().BeginCreate(ctx, "myResourceGroup", "myRegistry", "myExportPipeline", armcontainerregistry.ExportPipeline{ - Identity: &armcontainerregistry.IdentityProperties{ - Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeSystemAssigned), - }, - Location: to.Ptr("westus"), - Properties: &armcontainerregistry.ExportPipelineProperties{ - Options: []*armcontainerregistry.PipelineOptions{ - to.Ptr(armcontainerregistry.PipelineOptionsOverwriteBlobs)}, - Target: &armcontainerregistry.ExportPipelineTargetProperties{ - Type: to.Ptr("AzureStorageBlobContainer"), - KeyVaultURI: to.Ptr("https://myvault.vault.azure.net/secrets/acrexportsas"), - URI: to.Ptr("https://accountname.blob.core.windows.net/containername"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExportPipeline = armcontainerregistry.ExportPipeline{ - // Name: to.Ptr("myExportPipeline"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/exportPipelines"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/exportPipelines/myExportPipeline"), - // Identity: &armcontainerregistry.IdentityProperties{ - // Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("fa153151-b9fd-46f4-9088-5e6600f2689v"), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-abu4gm510ccd"), - // }, - // Location: to.Ptr("westus"), - // Properties: &armcontainerregistry.ExportPipelineProperties{ - // Options: []*armcontainerregistry.PipelineOptions{ - // to.Ptr(armcontainerregistry.PipelineOptionsOverwriteBlobs)}, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Target: &armcontainerregistry.ExportPipelineTargetProperties{ - // Type: to.Ptr("AzureStorageBlobContainer"), - // KeyVaultURI: to.Ptr("https://myvault.vault.azure.net/secrets/acrexportsas"), - // URI: to.Ptr("https://accountname.blob.core.windows.net/containername"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ExportPipelineDelete.json -func ExampleExportPipelinesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExportPipelinesClient().BeginDelete(ctx, "myResourceGroup", "myRegistry", "myExportPipeline", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/agentpools_server.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/agentpools_server.go deleted file mode 100644 index b9a559e8836a..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/agentpools_server.go +++ /dev/null @@ -1,357 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" - "net/http" - "net/url" - "regexp" -) - -// AgentPoolsServer is a fake server for instances of the armcontainerregistry.AgentPoolsClient type. -type AgentPoolsServer struct { - // BeginCreate is the fake for method AgentPoolsClient.BeginCreate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, agentPool armcontainerregistry.AgentPool, options *armcontainerregistry.AgentPoolsClientBeginCreateOptions) (resp azfake.PollerResponder[armcontainerregistry.AgentPoolsClientCreateResponse], errResp azfake.ErrorResponder) - - // BeginDelete is the fake for method AgentPoolsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, options *armcontainerregistry.AgentPoolsClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerregistry.AgentPoolsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method AgentPoolsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, options *armcontainerregistry.AgentPoolsClientGetOptions) (resp azfake.Responder[armcontainerregistry.AgentPoolsClientGetResponse], errResp azfake.ErrorResponder) - - // GetQueueStatus is the fake for method AgentPoolsClient.GetQueueStatus - // HTTP status codes to indicate success: http.StatusOK - GetQueueStatus func(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, options *armcontainerregistry.AgentPoolsClientGetQueueStatusOptions) (resp azfake.Responder[armcontainerregistry.AgentPoolsClientGetQueueStatusResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method AgentPoolsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, registryName string, options *armcontainerregistry.AgentPoolsClientListOptions) (resp azfake.PagerResponder[armcontainerregistry.AgentPoolsClientListResponse]) - - // BeginUpdate is the fake for method AgentPoolsClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginUpdate func(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, updateParameters armcontainerregistry.AgentPoolUpdateParameters, options *armcontainerregistry.AgentPoolsClientBeginUpdateOptions) (resp azfake.PollerResponder[armcontainerregistry.AgentPoolsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewAgentPoolsServerTransport creates a new instance of AgentPoolsServerTransport with the provided implementation. -// The returned AgentPoolsServerTransport instance is connected to an instance of armcontainerregistry.AgentPoolsClient by way of the -// undefined.Transporter field. -func NewAgentPoolsServerTransport(srv *AgentPoolsServer) *AgentPoolsServerTransport { - return &AgentPoolsServerTransport{srv: srv} -} - -// AgentPoolsServerTransport connects instances of armcontainerregistry.AgentPoolsClient to instances of AgentPoolsServer. -// Don't use this type directly, use NewAgentPoolsServerTransport instead. -type AgentPoolsServerTransport struct { - srv *AgentPoolsServer - beginCreate *azfake.PollerResponder[armcontainerregistry.AgentPoolsClientCreateResponse] - beginDelete *azfake.PollerResponder[armcontainerregistry.AgentPoolsClientDeleteResponse] - newListPager *azfake.PagerResponder[armcontainerregistry.AgentPoolsClientListResponse] - beginUpdate *azfake.PollerResponder[armcontainerregistry.AgentPoolsClientUpdateResponse] -} - -// Do implements the policy.Transporter interface for AgentPoolsServerTransport. -func (a *AgentPoolsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "AgentPoolsClient.BeginCreate": - resp, err = a.dispatchBeginCreate(req) - case "AgentPoolsClient.BeginDelete": - resp, err = a.dispatchBeginDelete(req) - case "AgentPoolsClient.Get": - resp, err = a.dispatchGet(req) - case "AgentPoolsClient.GetQueueStatus": - resp, err = a.dispatchGetQueueStatus(req) - case "AgentPoolsClient.NewListPager": - resp, err = a.dispatchNewListPager(req) - case "AgentPoolsClient.BeginUpdate": - resp, err = a.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *AgentPoolsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { - if a.srv.BeginCreate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} - } - if a.beginCreate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/agentPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.AgentPool](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - agentPoolNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("agentPoolName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.BeginCreate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, agentPoolNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - a.beginCreate = &respr - } - - resp, err := server.PollerResponderNext(a.beginCreate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(a.beginCreate) { - a.beginCreate = nil - } - - return resp, nil -} - -func (a *AgentPoolsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if a.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - if a.beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/agentPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - agentPoolNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("agentPoolName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.BeginDelete(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, agentPoolNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - a.beginDelete = &respr - } - - resp, err := server.PollerResponderNext(a.beginDelete, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} - } - if !server.PollerResponderMore(a.beginDelete) { - a.beginDelete = nil - } - - return resp, nil -} - -func (a *AgentPoolsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if a.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/agentPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - agentPoolNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("agentPoolName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, agentPoolNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AgentPool, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AgentPoolsServerTransport) dispatchGetQueueStatus(req *http.Request) (*http.Response, error) { - if a.srv.GetQueueStatus == nil { - return nil, &nonRetriableError{errors.New("fake for method GetQueueStatus not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/agentPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listQueueStatus` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - agentPoolNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("agentPoolName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.GetQueueStatus(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, agentPoolNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AgentPoolQueueStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AgentPoolsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - if a.newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/agentPools` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - resp := a.srv.NewListPager(resourceGroupNameUnescaped, registryNameUnescaped, nil) - a.newListPager = &resp - server.PagerResponderInjectNextLinks(a.newListPager, req, func(page *armcontainerregistry.AgentPoolsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(a.newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(a.newListPager) { - a.newListPager = nil - } - return resp, nil -} - -func (a *AgentPoolsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { - if a.srv.BeginUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} - } - if a.beginUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/agentPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.AgentPoolUpdateParameters](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - agentPoolNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("agentPoolName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.BeginUpdate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, agentPoolNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - a.beginUpdate = &respr - } - - resp, err := server.PollerResponderNext(a.beginUpdate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(a.beginUpdate) { - a.beginUpdate = nil - } - - return resp, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/connectedregistries_server.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/connectedregistries_server.go deleted file mode 100644 index bddab21fb9da..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/connectedregistries_server.go +++ /dev/null @@ -1,378 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" - "net/http" - "net/url" - "regexp" -) - -// ConnectedRegistriesServer is a fake server for instances of the armcontainerregistry.ConnectedRegistriesClient type. -type ConnectedRegistriesServer struct { - // BeginCreate is the fake for method ConnectedRegistriesClient.BeginCreate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryCreateParameters armcontainerregistry.ConnectedRegistry, options *armcontainerregistry.ConnectedRegistriesClientBeginCreateOptions) (resp azfake.PollerResponder[armcontainerregistry.ConnectedRegistriesClientCreateResponse], errResp azfake.ErrorResponder) - - // BeginDeactivate is the fake for method ConnectedRegistriesClient.BeginDeactivate - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginDeactivate func(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, options *armcontainerregistry.ConnectedRegistriesClientBeginDeactivateOptions) (resp azfake.PollerResponder[armcontainerregistry.ConnectedRegistriesClientDeactivateResponse], errResp azfake.ErrorResponder) - - // BeginDelete is the fake for method ConnectedRegistriesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, options *armcontainerregistry.ConnectedRegistriesClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerregistry.ConnectedRegistriesClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method ConnectedRegistriesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, options *armcontainerregistry.ConnectedRegistriesClientGetOptions) (resp azfake.Responder[armcontainerregistry.ConnectedRegistriesClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method ConnectedRegistriesClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, registryName string, options *armcontainerregistry.ConnectedRegistriesClientListOptions) (resp azfake.PagerResponder[armcontainerregistry.ConnectedRegistriesClientListResponse]) - - // BeginUpdate is the fake for method ConnectedRegistriesClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginUpdate func(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryUpdateParameters armcontainerregistry.ConnectedRegistryUpdateParameters, options *armcontainerregistry.ConnectedRegistriesClientBeginUpdateOptions) (resp azfake.PollerResponder[armcontainerregistry.ConnectedRegistriesClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewConnectedRegistriesServerTransport creates a new instance of ConnectedRegistriesServerTransport with the provided implementation. -// The returned ConnectedRegistriesServerTransport instance is connected to an instance of armcontainerregistry.ConnectedRegistriesClient by way of the -// undefined.Transporter field. -func NewConnectedRegistriesServerTransport(srv *ConnectedRegistriesServer) *ConnectedRegistriesServerTransport { - return &ConnectedRegistriesServerTransport{srv: srv} -} - -// ConnectedRegistriesServerTransport connects instances of armcontainerregistry.ConnectedRegistriesClient to instances of ConnectedRegistriesServer. -// Don't use this type directly, use NewConnectedRegistriesServerTransport instead. -type ConnectedRegistriesServerTransport struct { - srv *ConnectedRegistriesServer - beginCreate *azfake.PollerResponder[armcontainerregistry.ConnectedRegistriesClientCreateResponse] - beginDeactivate *azfake.PollerResponder[armcontainerregistry.ConnectedRegistriesClientDeactivateResponse] - beginDelete *azfake.PollerResponder[armcontainerregistry.ConnectedRegistriesClientDeleteResponse] - newListPager *azfake.PagerResponder[armcontainerregistry.ConnectedRegistriesClientListResponse] - beginUpdate *azfake.PollerResponder[armcontainerregistry.ConnectedRegistriesClientUpdateResponse] -} - -// Do implements the policy.Transporter interface for ConnectedRegistriesServerTransport. -func (c *ConnectedRegistriesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ConnectedRegistriesClient.BeginCreate": - resp, err = c.dispatchBeginCreate(req) - case "ConnectedRegistriesClient.BeginDeactivate": - resp, err = c.dispatchBeginDeactivate(req) - case "ConnectedRegistriesClient.BeginDelete": - resp, err = c.dispatchBeginDelete(req) - case "ConnectedRegistriesClient.Get": - resp, err = c.dispatchGet(req) - case "ConnectedRegistriesClient.NewListPager": - resp, err = c.dispatchNewListPager(req) - case "ConnectedRegistriesClient.BeginUpdate": - resp, err = c.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (c *ConnectedRegistriesServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { - if c.srv.BeginCreate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} - } - if c.beginCreate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/connectedRegistries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.ConnectedRegistry](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - connectedRegistryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("connectedRegistryName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.BeginCreate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, connectedRegistryNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - c.beginCreate = &respr - } - - resp, err := server.PollerResponderNext(c.beginCreate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(c.beginCreate) { - c.beginCreate = nil - } - - return resp, nil -} - -func (c *ConnectedRegistriesServerTransport) dispatchBeginDeactivate(req *http.Request) (*http.Response, error) { - if c.srv.BeginDeactivate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDeactivate not implemented")} - } - if c.beginDeactivate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/connectedRegistries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/deactivate` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - connectedRegistryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("connectedRegistryName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.BeginDeactivate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, connectedRegistryNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - c.beginDeactivate = &respr - } - - resp, err := server.PollerResponderNext(c.beginDeactivate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(c.beginDeactivate) { - c.beginDeactivate = nil - } - - return resp, nil -} - -func (c *ConnectedRegistriesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if c.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - if c.beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/connectedRegistries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - connectedRegistryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("connectedRegistryName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.BeginDelete(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, connectedRegistryNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - c.beginDelete = &respr - } - - resp, err := server.PollerResponderNext(c.beginDelete, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} - } - if !server.PollerResponderMore(c.beginDelete) { - c.beginDelete = nil - } - - return resp, nil -} - -func (c *ConnectedRegistriesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if c.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/connectedRegistries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - connectedRegistryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("connectedRegistryName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, connectedRegistryNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ConnectedRegistry, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (c *ConnectedRegistriesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if c.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - if c.newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/connectedRegistries` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - var options *armcontainerregistry.ConnectedRegistriesClientListOptions - if filterParam != nil { - options = &armcontainerregistry.ConnectedRegistriesClientListOptions{ - Filter: filterParam, - } - } - resp := c.srv.NewListPager(resourceGroupNameUnescaped, registryNameUnescaped, options) - c.newListPager = &resp - server.PagerResponderInjectNextLinks(c.newListPager, req, func(page *armcontainerregistry.ConnectedRegistriesClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(c.newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(c.newListPager) { - c.newListPager = nil - } - return resp, nil -} - -func (c *ConnectedRegistriesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { - if c.srv.BeginUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} - } - if c.beginUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/connectedRegistries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.ConnectedRegistryUpdateParameters](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - connectedRegistryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("connectedRegistryName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.BeginUpdate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, connectedRegistryNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - c.beginUpdate = &respr - } - - resp, err := server.PollerResponderNext(c.beginUpdate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(c.beginUpdate) { - c.beginUpdate = nil - } - - return resp, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/exportpipelines_server.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/exportpipelines_server.go deleted file mode 100644 index d36b5d52d8d8..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/exportpipelines_server.go +++ /dev/null @@ -1,258 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" - "net/http" - "net/url" - "regexp" -) - -// ExportPipelinesServer is a fake server for instances of the armcontainerregistry.ExportPipelinesClient type. -type ExportPipelinesServer struct { - // BeginCreate is the fake for method ExportPipelinesClient.BeginCreate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, exportPipelineCreateParameters armcontainerregistry.ExportPipeline, options *armcontainerregistry.ExportPipelinesClientBeginCreateOptions) (resp azfake.PollerResponder[armcontainerregistry.ExportPipelinesClientCreateResponse], errResp azfake.ErrorResponder) - - // BeginDelete is the fake for method ExportPipelinesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, options *armcontainerregistry.ExportPipelinesClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerregistry.ExportPipelinesClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method ExportPipelinesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, options *armcontainerregistry.ExportPipelinesClientGetOptions) (resp azfake.Responder[armcontainerregistry.ExportPipelinesClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method ExportPipelinesClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, registryName string, options *armcontainerregistry.ExportPipelinesClientListOptions) (resp azfake.PagerResponder[armcontainerregistry.ExportPipelinesClientListResponse]) -} - -// NewExportPipelinesServerTransport creates a new instance of ExportPipelinesServerTransport with the provided implementation. -// The returned ExportPipelinesServerTransport instance is connected to an instance of armcontainerregistry.ExportPipelinesClient by way of the -// undefined.Transporter field. -func NewExportPipelinesServerTransport(srv *ExportPipelinesServer) *ExportPipelinesServerTransport { - return &ExportPipelinesServerTransport{srv: srv} -} - -// ExportPipelinesServerTransport connects instances of armcontainerregistry.ExportPipelinesClient to instances of ExportPipelinesServer. -// Don't use this type directly, use NewExportPipelinesServerTransport instead. -type ExportPipelinesServerTransport struct { - srv *ExportPipelinesServer - beginCreate *azfake.PollerResponder[armcontainerregistry.ExportPipelinesClientCreateResponse] - beginDelete *azfake.PollerResponder[armcontainerregistry.ExportPipelinesClientDeleteResponse] - newListPager *azfake.PagerResponder[armcontainerregistry.ExportPipelinesClientListResponse] -} - -// Do implements the policy.Transporter interface for ExportPipelinesServerTransport. -func (e *ExportPipelinesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ExportPipelinesClient.BeginCreate": - resp, err = e.dispatchBeginCreate(req) - case "ExportPipelinesClient.BeginDelete": - resp, err = e.dispatchBeginDelete(req) - case "ExportPipelinesClient.Get": - resp, err = e.dispatchGet(req) - case "ExportPipelinesClient.NewListPager": - resp, err = e.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (e *ExportPipelinesServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { - if e.srv.BeginCreate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} - } - if e.beginCreate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/exportPipelines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.ExportPipeline](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - exportPipelineNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("exportPipelineName")]) - if err != nil { - return nil, err - } - respr, errRespr := e.srv.BeginCreate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, exportPipelineNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - e.beginCreate = &respr - } - - resp, err := server.PollerResponderNext(e.beginCreate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(e.beginCreate) { - e.beginCreate = nil - } - - return resp, nil -} - -func (e *ExportPipelinesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if e.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - if e.beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/exportPipelines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - exportPipelineNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("exportPipelineName")]) - if err != nil { - return nil, err - } - respr, errRespr := e.srv.BeginDelete(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, exportPipelineNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - e.beginDelete = &respr - } - - resp, err := server.PollerResponderNext(e.beginDelete, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} - } - if !server.PollerResponderMore(e.beginDelete) { - e.beginDelete = nil - } - - return resp, nil -} - -func (e *ExportPipelinesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if e.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/exportPipelines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - exportPipelineNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("exportPipelineName")]) - if err != nil { - return nil, err - } - respr, errRespr := e.srv.Get(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, exportPipelineNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ExportPipeline, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (e *ExportPipelinesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if e.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - if e.newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/exportPipelines` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - resp := e.srv.NewListPager(resourceGroupNameUnescaped, registryNameUnescaped, nil) - e.newListPager = &resp - server.PagerResponderInjectNextLinks(e.newListPager, req, func(page *armcontainerregistry.ExportPipelinesClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(e.newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(e.newListPager) { - e.newListPager = nil - } - return resp, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/importpipelines_server.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/importpipelines_server.go deleted file mode 100644 index 821f7a0183ec..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/importpipelines_server.go +++ /dev/null @@ -1,258 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" - "net/http" - "net/url" - "regexp" -) - -// ImportPipelinesServer is a fake server for instances of the armcontainerregistry.ImportPipelinesClient type. -type ImportPipelinesServer struct { - // BeginCreate is the fake for method ImportPipelinesClient.BeginCreate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, importPipelineCreateParameters armcontainerregistry.ImportPipeline, options *armcontainerregistry.ImportPipelinesClientBeginCreateOptions) (resp azfake.PollerResponder[armcontainerregistry.ImportPipelinesClientCreateResponse], errResp azfake.ErrorResponder) - - // BeginDelete is the fake for method ImportPipelinesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, options *armcontainerregistry.ImportPipelinesClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerregistry.ImportPipelinesClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method ImportPipelinesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, options *armcontainerregistry.ImportPipelinesClientGetOptions) (resp azfake.Responder[armcontainerregistry.ImportPipelinesClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method ImportPipelinesClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, registryName string, options *armcontainerregistry.ImportPipelinesClientListOptions) (resp azfake.PagerResponder[armcontainerregistry.ImportPipelinesClientListResponse]) -} - -// NewImportPipelinesServerTransport creates a new instance of ImportPipelinesServerTransport with the provided implementation. -// The returned ImportPipelinesServerTransport instance is connected to an instance of armcontainerregistry.ImportPipelinesClient by way of the -// undefined.Transporter field. -func NewImportPipelinesServerTransport(srv *ImportPipelinesServer) *ImportPipelinesServerTransport { - return &ImportPipelinesServerTransport{srv: srv} -} - -// ImportPipelinesServerTransport connects instances of armcontainerregistry.ImportPipelinesClient to instances of ImportPipelinesServer. -// Don't use this type directly, use NewImportPipelinesServerTransport instead. -type ImportPipelinesServerTransport struct { - srv *ImportPipelinesServer - beginCreate *azfake.PollerResponder[armcontainerregistry.ImportPipelinesClientCreateResponse] - beginDelete *azfake.PollerResponder[armcontainerregistry.ImportPipelinesClientDeleteResponse] - newListPager *azfake.PagerResponder[armcontainerregistry.ImportPipelinesClientListResponse] -} - -// Do implements the policy.Transporter interface for ImportPipelinesServerTransport. -func (i *ImportPipelinesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ImportPipelinesClient.BeginCreate": - resp, err = i.dispatchBeginCreate(req) - case "ImportPipelinesClient.BeginDelete": - resp, err = i.dispatchBeginDelete(req) - case "ImportPipelinesClient.Get": - resp, err = i.dispatchGet(req) - case "ImportPipelinesClient.NewListPager": - resp, err = i.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (i *ImportPipelinesServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { - if i.srv.BeginCreate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} - } - if i.beginCreate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/importPipelines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.ImportPipeline](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - importPipelineNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("importPipelineName")]) - if err != nil { - return nil, err - } - respr, errRespr := i.srv.BeginCreate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, importPipelineNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - i.beginCreate = &respr - } - - resp, err := server.PollerResponderNext(i.beginCreate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(i.beginCreate) { - i.beginCreate = nil - } - - return resp, nil -} - -func (i *ImportPipelinesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if i.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - if i.beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/importPipelines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - importPipelineNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("importPipelineName")]) - if err != nil { - return nil, err - } - respr, errRespr := i.srv.BeginDelete(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, importPipelineNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - i.beginDelete = &respr - } - - resp, err := server.PollerResponderNext(i.beginDelete, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} - } - if !server.PollerResponderMore(i.beginDelete) { - i.beginDelete = nil - } - - return resp, nil -} - -func (i *ImportPipelinesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if i.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/importPipelines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - importPipelineNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("importPipelineName")]) - if err != nil { - return nil, err - } - respr, errRespr := i.srv.Get(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, importPipelineNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ImportPipeline, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (i *ImportPipelinesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if i.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - if i.newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/importPipelines` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - resp := i.srv.NewListPager(resourceGroupNameUnescaped, registryNameUnescaped, nil) - i.newListPager = &resp - server.PagerResponderInjectNextLinks(i.newListPager, req, func(page *armcontainerregistry.ImportPipelinesClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(i.newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(i.newListPager) { - i.newListPager = nil - } - return resp, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/pipelineruns_server.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/pipelineruns_server.go deleted file mode 100644 index b05e37eca036..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/pipelineruns_server.go +++ /dev/null @@ -1,258 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" - "net/http" - "net/url" - "regexp" -) - -// PipelineRunsServer is a fake server for instances of the armcontainerregistry.PipelineRunsClient type. -type PipelineRunsServer struct { - // BeginCreate is the fake for method PipelineRunsClient.BeginCreate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, pipelineRunCreateParameters armcontainerregistry.PipelineRun, options *armcontainerregistry.PipelineRunsClientBeginCreateOptions) (resp azfake.PollerResponder[armcontainerregistry.PipelineRunsClientCreateResponse], errResp azfake.ErrorResponder) - - // BeginDelete is the fake for method PipelineRunsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, options *armcontainerregistry.PipelineRunsClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerregistry.PipelineRunsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method PipelineRunsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, options *armcontainerregistry.PipelineRunsClientGetOptions) (resp azfake.Responder[armcontainerregistry.PipelineRunsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method PipelineRunsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, registryName string, options *armcontainerregistry.PipelineRunsClientListOptions) (resp azfake.PagerResponder[armcontainerregistry.PipelineRunsClientListResponse]) -} - -// NewPipelineRunsServerTransport creates a new instance of PipelineRunsServerTransport with the provided implementation. -// The returned PipelineRunsServerTransport instance is connected to an instance of armcontainerregistry.PipelineRunsClient by way of the -// undefined.Transporter field. -func NewPipelineRunsServerTransport(srv *PipelineRunsServer) *PipelineRunsServerTransport { - return &PipelineRunsServerTransport{srv: srv} -} - -// PipelineRunsServerTransport connects instances of armcontainerregistry.PipelineRunsClient to instances of PipelineRunsServer. -// Don't use this type directly, use NewPipelineRunsServerTransport instead. -type PipelineRunsServerTransport struct { - srv *PipelineRunsServer - beginCreate *azfake.PollerResponder[armcontainerregistry.PipelineRunsClientCreateResponse] - beginDelete *azfake.PollerResponder[armcontainerregistry.PipelineRunsClientDeleteResponse] - newListPager *azfake.PagerResponder[armcontainerregistry.PipelineRunsClientListResponse] -} - -// Do implements the policy.Transporter interface for PipelineRunsServerTransport. -func (p *PipelineRunsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "PipelineRunsClient.BeginCreate": - resp, err = p.dispatchBeginCreate(req) - case "PipelineRunsClient.BeginDelete": - resp, err = p.dispatchBeginDelete(req) - case "PipelineRunsClient.Get": - resp, err = p.dispatchGet(req) - case "PipelineRunsClient.NewListPager": - resp, err = p.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *PipelineRunsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { - if p.srv.BeginCreate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} - } - if p.beginCreate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/pipelineRuns/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.PipelineRun](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - pipelineRunNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("pipelineRunName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.BeginCreate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, pipelineRunNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - p.beginCreate = &respr - } - - resp, err := server.PollerResponderNext(p.beginCreate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(p.beginCreate) { - p.beginCreate = nil - } - - return resp, nil -} - -func (p *PipelineRunsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if p.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - if p.beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/pipelineRuns/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - pipelineRunNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("pipelineRunName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, pipelineRunNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - p.beginDelete = &respr - } - - resp, err := server.PollerResponderNext(p.beginDelete, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} - } - if !server.PollerResponderMore(p.beginDelete) { - p.beginDelete = nil - } - - return resp, nil -} - -func (p *PipelineRunsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/pipelineRuns/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - pipelineRunNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("pipelineRunName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, pipelineRunNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PipelineRun, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (p *PipelineRunsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if p.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - if p.newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/pipelineRuns` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - resp := p.srv.NewListPager(resourceGroupNameUnescaped, registryNameUnescaped, nil) - p.newListPager = &resp - server.PagerResponderInjectNextLinks(p.newListPager, req, func(page *armcontainerregistry.PipelineRunsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(p.newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(p.newListPager) { - p.newListPager = nil - } - return resp, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/polymorphic_helpers.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/polymorphic_helpers.go deleted file mode 100644 index 73d14565ff9d..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/polymorphic_helpers.go +++ /dev/null @@ -1,91 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "encoding/json" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" -) - -func unmarshalRunRequestClassification(rawMsg json.RawMessage) (armcontainerregistry.RunRequestClassification, error) { - if rawMsg == nil { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b armcontainerregistry.RunRequestClassification - switch m["type"] { - case "DockerBuildRequest": - b = &armcontainerregistry.DockerBuildRequest{} - case "EncodedTaskRunRequest": - b = &armcontainerregistry.EncodedTaskRunRequest{} - case "FileTaskRunRequest": - b = &armcontainerregistry.FileTaskRunRequest{} - case "TaskRunRequest": - b = &armcontainerregistry.TaskRunRequest{} - default: - b = &armcontainerregistry.RunRequest{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalTaskStepPropertiesClassification(rawMsg json.RawMessage) (armcontainerregistry.TaskStepPropertiesClassification, error) { - if rawMsg == nil { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b armcontainerregistry.TaskStepPropertiesClassification - switch m["type"] { - case string(armcontainerregistry.StepTypeDocker): - b = &armcontainerregistry.DockerBuildStep{} - case string(armcontainerregistry.StepTypeEncodedTask): - b = &armcontainerregistry.EncodedTaskStep{} - case string(armcontainerregistry.StepTypeFileTask): - b = &armcontainerregistry.FileTaskStep{} - default: - b = &armcontainerregistry.TaskStepProperties{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalTaskStepUpdateParametersClassification(rawMsg json.RawMessage) (armcontainerregistry.TaskStepUpdateParametersClassification, error) { - if rawMsg == nil { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b armcontainerregistry.TaskStepUpdateParametersClassification - switch m["type"] { - case string(armcontainerregistry.StepTypeDocker): - b = &armcontainerregistry.DockerBuildStepUpdateParameters{} - case string(armcontainerregistry.StepTypeEncodedTask): - b = &armcontainerregistry.EncodedTaskStepUpdateParameters{} - case string(armcontainerregistry.StepTypeFileTask): - b = &armcontainerregistry.FileTaskStepUpdateParameters{} - default: - b = &armcontainerregistry.TaskStepUpdateParameters{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/registries_server.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/registries_server.go index 7b3459fe53ef..cb365fc8fe34 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/registries_server.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/registries_server.go @@ -44,10 +44,6 @@ type RegistriesServer struct { // HTTP status codes to indicate success: http.StatusOK Get func(ctx context.Context, resourceGroupName string, registryName string, options *armcontainerregistry.RegistriesClientGetOptions) (resp azfake.Responder[armcontainerregistry.RegistriesClientGetResponse], errResp azfake.ErrorResponder) - // GetBuildSourceUploadURL is the fake for method RegistriesClient.GetBuildSourceUploadURL - // HTTP status codes to indicate success: http.StatusOK - GetBuildSourceUploadURL func(ctx context.Context, resourceGroupName string, registryName string, options *armcontainerregistry.RegistriesClientGetBuildSourceUploadURLOptions) (resp azfake.Responder[armcontainerregistry.RegistriesClientGetBuildSourceUploadURLResponse], errResp azfake.ErrorResponder) - // GetPrivateLinkResource is the fake for method RegistriesClient.GetPrivateLinkResource // HTTP status codes to indicate success: http.StatusOK GetPrivateLinkResource func(ctx context.Context, resourceGroupName string, registryName string, groupName string, options *armcontainerregistry.RegistriesClientGetPrivateLinkResourceOptions) (resp azfake.Responder[armcontainerregistry.RegistriesClientGetPrivateLinkResourceResponse], errResp azfake.ErrorResponder) @@ -80,10 +76,6 @@ type RegistriesServer struct { // HTTP status codes to indicate success: http.StatusOK RegenerateCredential func(ctx context.Context, resourceGroupName string, registryName string, regenerateCredentialParameters armcontainerregistry.RegenerateCredentialParameters, options *armcontainerregistry.RegistriesClientRegenerateCredentialOptions) (resp azfake.Responder[armcontainerregistry.RegistriesClientRegenerateCredentialResponse], errResp azfake.ErrorResponder) - // BeginScheduleRun is the fake for method RegistriesClient.BeginScheduleRun - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginScheduleRun func(ctx context.Context, resourceGroupName string, registryName string, runRequest armcontainerregistry.RunRequestClassification, options *armcontainerregistry.RegistriesClientBeginScheduleRunOptions) (resp azfake.PollerResponder[armcontainerregistry.RegistriesClientScheduleRunResponse], errResp azfake.ErrorResponder) - // BeginUpdate is the fake for method RegistriesClient.BeginUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated BeginUpdate func(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters armcontainerregistry.RegistryUpdateParameters, options *armcontainerregistry.RegistriesClientBeginUpdateOptions) (resp azfake.PollerResponder[armcontainerregistry.RegistriesClientUpdateResponse], errResp azfake.ErrorResponder) @@ -107,7 +99,6 @@ type RegistriesServerTransport struct { newListPager *azfake.PagerResponder[armcontainerregistry.RegistriesClientListResponse] newListByResourceGroupPager *azfake.PagerResponder[armcontainerregistry.RegistriesClientListByResourceGroupResponse] newListPrivateLinkResourcesPager *azfake.PagerResponder[armcontainerregistry.RegistriesClientListPrivateLinkResourcesResponse] - beginScheduleRun *azfake.PollerResponder[armcontainerregistry.RegistriesClientScheduleRunResponse] beginUpdate *azfake.PollerResponder[armcontainerregistry.RegistriesClientUpdateResponse] } @@ -133,8 +124,6 @@ func (r *RegistriesServerTransport) Do(req *http.Request) (*http.Response, error resp, err = r.dispatchBeginGenerateCredentials(req) case "RegistriesClient.Get": resp, err = r.dispatchGet(req) - case "RegistriesClient.GetBuildSourceUploadURL": - resp, err = r.dispatchGetBuildSourceUploadURL(req) case "RegistriesClient.GetPrivateLinkResource": resp, err = r.dispatchGetPrivateLinkResource(req) case "RegistriesClient.BeginImportImage": @@ -151,8 +140,6 @@ func (r *RegistriesServerTransport) Do(req *http.Request) (*http.Response, error resp, err = r.dispatchListUsages(req) case "RegistriesClient.RegenerateCredential": resp, err = r.dispatchRegenerateCredential(req) - case "RegistriesClient.BeginScheduleRun": - resp, err = r.dispatchBeginScheduleRun(req) case "RegistriesClient.BeginUpdate": resp, err = r.dispatchBeginUpdate(req) default: @@ -359,39 +346,6 @@ func (r *RegistriesServerTransport) dispatchGet(req *http.Request) (*http.Respon return resp, nil } -func (r *RegistriesServerTransport) dispatchGetBuildSourceUploadURL(req *http.Request) (*http.Response, error) { - if r.srv.GetBuildSourceUploadURL == nil { - return nil, &nonRetriableError{errors.New("fake for method GetBuildSourceUploadURL not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listBuildSourceUploadUrl` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.GetBuildSourceUploadURL(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SourceUploadDefinition, req) - if err != nil { - return nil, err - } - return resp, nil -} - func (r *RegistriesServerTransport) dispatchGetPrivateLinkResource(req *http.Request) (*http.Response, error) { if r.srv.GetPrivateLinkResource == nil { return nil, &nonRetriableError{errors.New("fake for method GetPrivateLinkResource not implemented")} @@ -679,55 +633,6 @@ func (r *RegistriesServerTransport) dispatchRegenerateCredential(req *http.Reque return resp, nil } -func (r *RegistriesServerTransport) dispatchBeginScheduleRun(req *http.Request) (*http.Response, error) { - if r.srv.BeginScheduleRun == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginScheduleRun not implemented")} - } - if r.beginScheduleRun == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/scheduleRun` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - raw, err := readRequestBody(req) - if err != nil { - return nil, err - } - body, err := unmarshalRunRequestClassification(raw) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.BeginScheduleRun(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - r.beginScheduleRun = &respr - } - - resp, err := server.PollerResponderNext(r.beginScheduleRun, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(r.beginScheduleRun) { - r.beginScheduleRun = nil - } - - return resp, nil -} - func (r *RegistriesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { if r.srv.BeginUpdate == nil { return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/runs_server.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/runs_server.go deleted file mode 100644 index 4927fd699665..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/runs_server.go +++ /dev/null @@ -1,329 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" - "net/http" - "net/url" - "regexp" - "strconv" -) - -// RunsServer is a fake server for instances of the armcontainerregistry.RunsClient type. -type RunsServer struct { - // BeginCancel is the fake for method RunsClient.BeginCancel - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginCancel func(ctx context.Context, resourceGroupName string, registryName string, runID string, options *armcontainerregistry.RunsClientBeginCancelOptions) (resp azfake.PollerResponder[armcontainerregistry.RunsClientCancelResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method RunsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, registryName string, runID string, options *armcontainerregistry.RunsClientGetOptions) (resp azfake.Responder[armcontainerregistry.RunsClientGetResponse], errResp azfake.ErrorResponder) - - // GetLogSasURL is the fake for method RunsClient.GetLogSasURL - // HTTP status codes to indicate success: http.StatusOK - GetLogSasURL func(ctx context.Context, resourceGroupName string, registryName string, runID string, options *armcontainerregistry.RunsClientGetLogSasURLOptions) (resp azfake.Responder[armcontainerregistry.RunsClientGetLogSasURLResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method RunsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, registryName string, options *armcontainerregistry.RunsClientListOptions) (resp azfake.PagerResponder[armcontainerregistry.RunsClientListResponse]) - - // BeginUpdate is the fake for method RunsClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginUpdate func(ctx context.Context, resourceGroupName string, registryName string, runID string, runUpdateParameters armcontainerregistry.RunUpdateParameters, options *armcontainerregistry.RunsClientBeginUpdateOptions) (resp azfake.PollerResponder[armcontainerregistry.RunsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewRunsServerTransport creates a new instance of RunsServerTransport with the provided implementation. -// The returned RunsServerTransport instance is connected to an instance of armcontainerregistry.RunsClient by way of the -// undefined.Transporter field. -func NewRunsServerTransport(srv *RunsServer) *RunsServerTransport { - return &RunsServerTransport{srv: srv} -} - -// RunsServerTransport connects instances of armcontainerregistry.RunsClient to instances of RunsServer. -// Don't use this type directly, use NewRunsServerTransport instead. -type RunsServerTransport struct { - srv *RunsServer - beginCancel *azfake.PollerResponder[armcontainerregistry.RunsClientCancelResponse] - newListPager *azfake.PagerResponder[armcontainerregistry.RunsClientListResponse] - beginUpdate *azfake.PollerResponder[armcontainerregistry.RunsClientUpdateResponse] -} - -// Do implements the policy.Transporter interface for RunsServerTransport. -func (r *RunsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "RunsClient.BeginCancel": - resp, err = r.dispatchBeginCancel(req) - case "RunsClient.Get": - resp, err = r.dispatchGet(req) - case "RunsClient.GetLogSasURL": - resp, err = r.dispatchGetLogSasURL(req) - case "RunsClient.NewListPager": - resp, err = r.dispatchNewListPager(req) - case "RunsClient.BeginUpdate": - resp, err = r.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (r *RunsServerTransport) dispatchBeginCancel(req *http.Request) (*http.Response, error) { - if r.srv.BeginCancel == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCancel not implemented")} - } - if r.beginCancel == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cancel` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - runIDUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("runId")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.BeginCancel(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, runIDUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - r.beginCancel = &respr - } - - resp, err := server.PollerResponderNext(r.beginCancel, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(r.beginCancel) { - r.beginCancel = nil - } - - return resp, nil -} - -func (r *RunsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if r.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - runIDUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("runId")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.Get(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, runIDUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Run, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (r *RunsServerTransport) dispatchGetLogSasURL(req *http.Request) (*http.Response, error) { - if r.srv.GetLogSasURL == nil { - return nil, &nonRetriableError{errors.New("fake for method GetLogSasURL not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listLogSasUrl` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - runIDUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("runId")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.GetLogSasURL(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, runIDUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RunGetLogResult, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (r *RunsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if r.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - if r.newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runs` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - topUnescaped, err := url.QueryUnescape(qp.Get("$top")) - if err != nil { - return nil, err - } - topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { - p, parseErr := strconv.ParseInt(v, 10, 32) - if parseErr != nil { - return 0, parseErr - } - return int32(p), nil - }) - if err != nil { - return nil, err - } - var options *armcontainerregistry.RunsClientListOptions - if filterParam != nil || topParam != nil { - options = &armcontainerregistry.RunsClientListOptions{ - Filter: filterParam, - Top: topParam, - } - } - resp := r.srv.NewListPager(resourceGroupNameUnescaped, registryNameUnescaped, options) - r.newListPager = &resp - server.PagerResponderInjectNextLinks(r.newListPager, req, func(page *armcontainerregistry.RunsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(r.newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(r.newListPager) { - r.newListPager = nil - } - return resp, nil -} - -func (r *RunsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { - if r.srv.BeginUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} - } - if r.beginUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.RunUpdateParameters](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - runIDUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("runId")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.BeginUpdate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, runIDUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - r.beginUpdate = &respr - } - - resp, err := server.PollerResponderNext(r.beginUpdate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(r.beginUpdate) { - r.beginUpdate = nil - } - - return resp, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/taskruns_server.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/taskruns_server.go deleted file mode 100644 index 4b22e71731a8..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/taskruns_server.go +++ /dev/null @@ -1,357 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" - "net/http" - "net/url" - "regexp" -) - -// TaskRunsServer is a fake server for instances of the armcontainerregistry.TaskRunsClient type. -type TaskRunsServer struct { - // BeginCreate is the fake for method TaskRunsClient.BeginCreate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, taskRun armcontainerregistry.TaskRun, options *armcontainerregistry.TaskRunsClientBeginCreateOptions) (resp azfake.PollerResponder[armcontainerregistry.TaskRunsClientCreateResponse], errResp azfake.ErrorResponder) - - // BeginDelete is the fake for method TaskRunsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, options *armcontainerregistry.TaskRunsClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerregistry.TaskRunsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method TaskRunsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, options *armcontainerregistry.TaskRunsClientGetOptions) (resp azfake.Responder[armcontainerregistry.TaskRunsClientGetResponse], errResp azfake.ErrorResponder) - - // GetDetails is the fake for method TaskRunsClient.GetDetails - // HTTP status codes to indicate success: http.StatusOK - GetDetails func(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, options *armcontainerregistry.TaskRunsClientGetDetailsOptions) (resp azfake.Responder[armcontainerregistry.TaskRunsClientGetDetailsResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method TaskRunsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, registryName string, options *armcontainerregistry.TaskRunsClientListOptions) (resp azfake.PagerResponder[armcontainerregistry.TaskRunsClientListResponse]) - - // BeginUpdate is the fake for method TaskRunsClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginUpdate func(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, updateParameters armcontainerregistry.TaskRunUpdateParameters, options *armcontainerregistry.TaskRunsClientBeginUpdateOptions) (resp azfake.PollerResponder[armcontainerregistry.TaskRunsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewTaskRunsServerTransport creates a new instance of TaskRunsServerTransport with the provided implementation. -// The returned TaskRunsServerTransport instance is connected to an instance of armcontainerregistry.TaskRunsClient by way of the -// undefined.Transporter field. -func NewTaskRunsServerTransport(srv *TaskRunsServer) *TaskRunsServerTransport { - return &TaskRunsServerTransport{srv: srv} -} - -// TaskRunsServerTransport connects instances of armcontainerregistry.TaskRunsClient to instances of TaskRunsServer. -// Don't use this type directly, use NewTaskRunsServerTransport instead. -type TaskRunsServerTransport struct { - srv *TaskRunsServer - beginCreate *azfake.PollerResponder[armcontainerregistry.TaskRunsClientCreateResponse] - beginDelete *azfake.PollerResponder[armcontainerregistry.TaskRunsClientDeleteResponse] - newListPager *azfake.PagerResponder[armcontainerregistry.TaskRunsClientListResponse] - beginUpdate *azfake.PollerResponder[armcontainerregistry.TaskRunsClientUpdateResponse] -} - -// Do implements the policy.Transporter interface for TaskRunsServerTransport. -func (t *TaskRunsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "TaskRunsClient.BeginCreate": - resp, err = t.dispatchBeginCreate(req) - case "TaskRunsClient.BeginDelete": - resp, err = t.dispatchBeginDelete(req) - case "TaskRunsClient.Get": - resp, err = t.dispatchGet(req) - case "TaskRunsClient.GetDetails": - resp, err = t.dispatchGetDetails(req) - case "TaskRunsClient.NewListPager": - resp, err = t.dispatchNewListPager(req) - case "TaskRunsClient.BeginUpdate": - resp, err = t.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (t *TaskRunsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { - if t.srv.BeginCreate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} - } - if t.beginCreate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/taskRuns/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.TaskRun](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - taskRunNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("taskRunName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.BeginCreate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, taskRunNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - t.beginCreate = &respr - } - - resp, err := server.PollerResponderNext(t.beginCreate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(t.beginCreate) { - t.beginCreate = nil - } - - return resp, nil -} - -func (t *TaskRunsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if t.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - if t.beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/taskRuns/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - taskRunNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("taskRunName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.BeginDelete(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, taskRunNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - t.beginDelete = &respr - } - - resp, err := server.PollerResponderNext(t.beginDelete, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} - } - if !server.PollerResponderMore(t.beginDelete) { - t.beginDelete = nil - } - - return resp, nil -} - -func (t *TaskRunsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if t.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/taskRuns/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - taskRunNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("taskRunName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.Get(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, taskRunNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).TaskRun, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (t *TaskRunsServerTransport) dispatchGetDetails(req *http.Request) (*http.Response, error) { - if t.srv.GetDetails == nil { - return nil, &nonRetriableError{errors.New("fake for method GetDetails not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/taskRuns/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listDetails` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - taskRunNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("taskRunName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.GetDetails(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, taskRunNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).TaskRun, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (t *TaskRunsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if t.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - if t.newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/taskRuns` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - resp := t.srv.NewListPager(resourceGroupNameUnescaped, registryNameUnescaped, nil) - t.newListPager = &resp - server.PagerResponderInjectNextLinks(t.newListPager, req, func(page *armcontainerregistry.TaskRunsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(t.newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(t.newListPager) { - t.newListPager = nil - } - return resp, nil -} - -func (t *TaskRunsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { - if t.srv.BeginUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} - } - if t.beginUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/taskRuns/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.TaskRunUpdateParameters](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - taskRunNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("taskRunName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.BeginUpdate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, taskRunNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - t.beginUpdate = &respr - } - - resp, err := server.PollerResponderNext(t.beginUpdate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(t.beginUpdate) { - t.beginUpdate = nil - } - - return resp, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/tasks_server.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/tasks_server.go deleted file mode 100644 index 6b683a6c3a15..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/fake/tasks_server.go +++ /dev/null @@ -1,357 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" - "net/http" - "net/url" - "regexp" -) - -// TasksServer is a fake server for instances of the armcontainerregistry.TasksClient type. -type TasksServer struct { - // BeginCreate is the fake for method TasksClient.BeginCreate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskCreateParameters armcontainerregistry.Task, options *armcontainerregistry.TasksClientBeginCreateOptions) (resp azfake.PollerResponder[armcontainerregistry.TasksClientCreateResponse], errResp azfake.ErrorResponder) - - // BeginDelete is the fake for method TasksClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, registryName string, taskName string, options *armcontainerregistry.TasksClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerregistry.TasksClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method TasksClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, registryName string, taskName string, options *armcontainerregistry.TasksClientGetOptions) (resp azfake.Responder[armcontainerregistry.TasksClientGetResponse], errResp azfake.ErrorResponder) - - // GetDetails is the fake for method TasksClient.GetDetails - // HTTP status codes to indicate success: http.StatusOK - GetDetails func(ctx context.Context, resourceGroupName string, registryName string, taskName string, options *armcontainerregistry.TasksClientGetDetailsOptions) (resp azfake.Responder[armcontainerregistry.TasksClientGetDetailsResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method TasksClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, registryName string, options *armcontainerregistry.TasksClientListOptions) (resp azfake.PagerResponder[armcontainerregistry.TasksClientListResponse]) - - // BeginUpdate is the fake for method TasksClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginUpdate func(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskUpdateParameters armcontainerregistry.TaskUpdateParameters, options *armcontainerregistry.TasksClientBeginUpdateOptions) (resp azfake.PollerResponder[armcontainerregistry.TasksClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewTasksServerTransport creates a new instance of TasksServerTransport with the provided implementation. -// The returned TasksServerTransport instance is connected to an instance of armcontainerregistry.TasksClient by way of the -// undefined.Transporter field. -func NewTasksServerTransport(srv *TasksServer) *TasksServerTransport { - return &TasksServerTransport{srv: srv} -} - -// TasksServerTransport connects instances of armcontainerregistry.TasksClient to instances of TasksServer. -// Don't use this type directly, use NewTasksServerTransport instead. -type TasksServerTransport struct { - srv *TasksServer - beginCreate *azfake.PollerResponder[armcontainerregistry.TasksClientCreateResponse] - beginDelete *azfake.PollerResponder[armcontainerregistry.TasksClientDeleteResponse] - newListPager *azfake.PagerResponder[armcontainerregistry.TasksClientListResponse] - beginUpdate *azfake.PollerResponder[armcontainerregistry.TasksClientUpdateResponse] -} - -// Do implements the policy.Transporter interface for TasksServerTransport. -func (t *TasksServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "TasksClient.BeginCreate": - resp, err = t.dispatchBeginCreate(req) - case "TasksClient.BeginDelete": - resp, err = t.dispatchBeginDelete(req) - case "TasksClient.Get": - resp, err = t.dispatchGet(req) - case "TasksClient.GetDetails": - resp, err = t.dispatchGetDetails(req) - case "TasksClient.NewListPager": - resp, err = t.dispatchNewListPager(req) - case "TasksClient.BeginUpdate": - resp, err = t.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (t *TasksServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { - if t.srv.BeginCreate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} - } - if t.beginCreate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tasks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.Task](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - taskNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("taskName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.BeginCreate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, taskNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - t.beginCreate = &respr - } - - resp, err := server.PollerResponderNext(t.beginCreate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(t.beginCreate) { - t.beginCreate = nil - } - - return resp, nil -} - -func (t *TasksServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if t.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - if t.beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tasks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - taskNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("taskName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.BeginDelete(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, taskNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - t.beginDelete = &respr - } - - resp, err := server.PollerResponderNext(t.beginDelete, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} - } - if !server.PollerResponderMore(t.beginDelete) { - t.beginDelete = nil - } - - return resp, nil -} - -func (t *TasksServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if t.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tasks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - taskNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("taskName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.Get(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, taskNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Task, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (t *TasksServerTransport) dispatchGetDetails(req *http.Request) (*http.Response, error) { - if t.srv.GetDetails == nil { - return nil, &nonRetriableError{errors.New("fake for method GetDetails not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tasks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listDetails` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - taskNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("taskName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.GetDetails(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, taskNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Task, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (t *TasksServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if t.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - if t.newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tasks` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - resp := t.srv.NewListPager(resourceGroupNameUnescaped, registryNameUnescaped, nil) - t.newListPager = &resp - server.PagerResponderInjectNextLinks(t.newListPager, req, func(page *armcontainerregistry.TasksClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(t.newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(t.newListPager) { - t.newListPager = nil - } - return resp, nil -} - -func (t *TasksServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { - if t.srv.BeginUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} - } - if t.beginUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.ContainerRegistry/registries/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tasks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armcontainerregistry.TaskUpdateParameters](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - registryNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("registryName")]) - if err != nil { - return nil, err - } - taskNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("taskName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.BeginUpdate(req.Context(), resourceGroupNameUnescaped, registryNameUnescaped, taskNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - t.beginUpdate = &respr - } - - resp, err := server.PollerResponderNext(t.beginUpdate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(t.beginUpdate) { - t.beginUpdate = nil - } - - return resp, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/go.mod b/sdk/resourcemanager/containerregistry/armcontainerregistry/go.mod index 31becb3d4c3e..3589afd881f0 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/go.mod +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/go.mod @@ -1,15 +1,15 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry/v2 go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0-beta.2 - 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 deleted file mode 100644 index 9f586ca37df7..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/importpipelines_client.go +++ /dev/null @@ -1,335 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcontainerregistry - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// ImportPipelinesClient contains the methods for the ImportPipelines group. -// Don't use this type directly, use NewImportPipelinesClient() instead. -type ImportPipelinesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewImportPipelinesClient creates a new instance of ImportPipelinesClient with the specified values. -// - subscriptionID - The ID of the target subscription. The value must be an UUID. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewImportPipelinesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ImportPipelinesClient, error) { - cl, err := arm.NewClient(moduleName+".ImportPipelinesClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ImportPipelinesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginCreate - Creates an import pipeline for a container registry with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - registryName - The name of the container registry. -// - importPipelineName - The name of the import pipeline. -// - importPipelineCreateParameters - The parameters for creating an import pipeline. -// - options - ImportPipelinesClientBeginCreateOptions contains the optional parameters for the ImportPipelinesClient.BeginCreate -// method. -func (client *ImportPipelinesClient) BeginCreate(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, importPipelineCreateParameters ImportPipeline, options *ImportPipelinesClientBeginCreateOptions) (*runtime.Poller[ImportPipelinesClientCreateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, registryName, importPipelineName, importPipelineCreateParameters, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ImportPipelinesClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken[ImportPipelinesClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Create - Creates an import pipeline for a container registry with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -func (client *ImportPipelinesClient) create(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, importPipelineCreateParameters ImportPipeline, options *ImportPipelinesClientBeginCreateOptions) (*http.Response, error) { - var err error - const operationName = "ImportPipelinesClient.BeginCreate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, importPipelineName, importPipelineCreateParameters, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// createCreateRequest creates the Create request. -func (client *ImportPipelinesClient) createCreateRequest(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, importPipelineCreateParameters ImportPipeline, options *ImportPipelinesClientBeginCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}" - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - if importPipelineName == "" { - return nil, errors.New("parameter importPipelineName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{importPipelineName}", url.PathEscape(importPipelineName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, importPipelineCreateParameters); err != nil { - return nil, err - } - return req, nil -} - -// BeginDelete - Deletes an import pipeline from a container registry. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - registryName - The name of the container registry. -// - importPipelineName - The name of the import pipeline. -// - options - ImportPipelinesClientBeginDeleteOptions contains the optional parameters for the ImportPipelinesClient.BeginDelete -// method. -func (client *ImportPipelinesClient) BeginDelete(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, options *ImportPipelinesClientBeginDeleteOptions) (*runtime.Poller[ImportPipelinesClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, registryName, importPipelineName, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ImportPipelinesClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken[ImportPipelinesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Delete - Deletes an import pipeline from a container registry. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -func (client *ImportPipelinesClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, options *ImportPipelinesClientBeginDeleteOptions) (*http.Response, error) { - var err error - const operationName = "ImportPipelinesClient.BeginDelete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, importPipelineName, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *ImportPipelinesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, options *ImportPipelinesClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}" - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - if importPipelineName == "" { - return nil, errors.New("parameter importPipelineName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{importPipelineName}", url.PathEscape(importPipelineName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Gets the properties of the import pipeline. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - registryName - The name of the container registry. -// - importPipelineName - The name of the import pipeline. -// - options - ImportPipelinesClientGetOptions contains the optional parameters for the ImportPipelinesClient.Get method. -func (client *ImportPipelinesClient) Get(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, options *ImportPipelinesClientGetOptions) (ImportPipelinesClientGetResponse, error) { - var err error - const operationName = "ImportPipelinesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, importPipelineName, options) - if err != nil { - return ImportPipelinesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ImportPipelinesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ImportPipelinesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ImportPipelinesClient) getCreateRequest(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, options *ImportPipelinesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}" - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - if importPipelineName == "" { - return nil, errors.New("parameter importPipelineName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{importPipelineName}", url.PathEscape(importPipelineName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ImportPipelinesClient) getHandleResponse(resp *http.Response) (ImportPipelinesClientGetResponse, error) { - result := ImportPipelinesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ImportPipeline); err != nil { - return ImportPipelinesClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Lists all import pipelines for the specified container registry. -// -// Generated from API version 2023-01-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - registryName - The name of the container registry. -// - options - ImportPipelinesClientListOptions contains the optional parameters for the ImportPipelinesClient.NewListPager -// method. -func (client *ImportPipelinesClient) NewListPager(resourceGroupName string, registryName string, options *ImportPipelinesClientListOptions) *runtime.Pager[ImportPipelinesClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[ImportPipelinesClientListResponse]{ - More: func(page ImportPipelinesClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ImportPipelinesClientListResponse) (ImportPipelinesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ImportPipelinesClient.NewListPager") - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, resourceGroupName, registryName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ImportPipelinesClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ImportPipelinesClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ImportPipelinesClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *ImportPipelinesClient) listCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *ImportPipelinesClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/importPipelines" - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *ImportPipelinesClient) listHandleResponse(resp *http.Response) (ImportPipelinesClientListResponse, error) { - result := ImportPipelinesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ImportPipelineListResult); err != nil { - return ImportPipelinesClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/importpipelines_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/importpipelines_client_example_test.go deleted file mode 100644 index 835ca0165faa..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/importpipelines_client_example_test.go +++ /dev/null @@ -1,227 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcontainerregistry_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ImportPipelineList.json -func ExampleImportPipelinesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewImportPipelinesClient().NewListPager("myResourceGroup", "myRegistry", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ImportPipelineListResult = armcontainerregistry.ImportPipelineListResult{ - // Value: []*armcontainerregistry.ImportPipeline{ - // { - // Name: to.Ptr("myImportPipeline"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/importPipelines"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/importPipelines/myImportPipeline"), - // Identity: &armcontainerregistry.IdentityProperties{ - // Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armcontainerregistry.UserIdentityProperties{ - // "/subscriptions/f9d7ebed-adbd-4cb4-b973-aaf82c136138/resourcegroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity2": &armcontainerregistry.UserIdentityProperties{ - // ClientID: to.Ptr("d3ce1bc2-f7d7-4a5b-9979-950f4e57680e"), - // PrincipalID: to.Ptr("b6p9f58b-6fbf-4efd-a7e0-fvd46911a466"), - // }, - // }, - // }, - // Location: to.Ptr("westus"), - // Properties: &armcontainerregistry.ImportPipelineProperties{ - // Options: []*armcontainerregistry.PipelineOptions{ - // to.Ptr(armcontainerregistry.PipelineOptionsOverwriteTags), - // to.Ptr(armcontainerregistry.PipelineOptionsDeleteSourceBlobOnSuccess), - // to.Ptr(armcontainerregistry.PipelineOptionsContinueOnErrors)}, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Source: &armcontainerregistry.ImportPipelineSourceProperties{ - // Type: to.Ptr(armcontainerregistry.PipelineSourceTypeAzureStorageBlobContainer), - // KeyVaultURI: to.Ptr("https://myvault.vault.azure.net/secrets/acrimportsas"), - // URI: to.Ptr("https://accountname.blob.core.windows.net/containername"), - // }, - // Trigger: &armcontainerregistry.PipelineTriggerProperties{ - // SourceTrigger: &armcontainerregistry.PipelineSourceTriggerProperties{ - // Status: to.Ptr(armcontainerregistry.TriggerStatusEnabled), - // }, - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ImportPipelineGet.json -func ExampleImportPipelinesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewImportPipelinesClient().Get(ctx, "myResourceGroup", "myRegistry", "myImportPipeline", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ImportPipeline = armcontainerregistry.ImportPipeline{ - // Name: to.Ptr("myImportPipeline"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/importPipelines"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/importPipelines/myImportPipeline"), - // Identity: &armcontainerregistry.IdentityProperties{ - // Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armcontainerregistry.UserIdentityProperties{ - // "/subscriptions/f9d7ebed-adbd-4cb4-b973-aaf82c136138/resourcegroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity2": &armcontainerregistry.UserIdentityProperties{ - // ClientID: to.Ptr("d3ce1bc2-f7d7-4a5b-9979-950f4e57680e"), - // PrincipalID: to.Ptr("b6p9f58b-6fbf-4efd-a7e0-fvd46911a466"), - // }, - // }, - // }, - // Location: to.Ptr("westus"), - // Properties: &armcontainerregistry.ImportPipelineProperties{ - // Options: []*armcontainerregistry.PipelineOptions{ - // to.Ptr(armcontainerregistry.PipelineOptionsOverwriteTags), - // to.Ptr(armcontainerregistry.PipelineOptionsDeleteSourceBlobOnSuccess), - // to.Ptr(armcontainerregistry.PipelineOptionsContinueOnErrors)}, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Source: &armcontainerregistry.ImportPipelineSourceProperties{ - // Type: to.Ptr(armcontainerregistry.PipelineSourceTypeAzureStorageBlobContainer), - // KeyVaultURI: to.Ptr("https://myvault.vault.azure.net/secrets/acrimportsas"), - // URI: to.Ptr("https://accountname.blob.core.windows.net/containername"), - // }, - // Trigger: &armcontainerregistry.PipelineTriggerProperties{ - // SourceTrigger: &armcontainerregistry.PipelineSourceTriggerProperties{ - // Status: to.Ptr(armcontainerregistry.TriggerStatusEnabled), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ImportPipelineCreate.json -func ExampleImportPipelinesClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImportPipelinesClient().BeginCreate(ctx, "myResourceGroup", "myRegistry", "myImportPipeline", armcontainerregistry.ImportPipeline{ - Identity: &armcontainerregistry.IdentityProperties{ - Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armcontainerregistry.UserIdentityProperties{ - "/subscriptions/f9d7ebed-adbd-4cb4-b973-aaf82c136138/resourcegroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity2": {}, - }, - }, - Location: to.Ptr("westus"), - Properties: &armcontainerregistry.ImportPipelineProperties{ - Options: []*armcontainerregistry.PipelineOptions{ - to.Ptr(armcontainerregistry.PipelineOptionsOverwriteTags), - to.Ptr(armcontainerregistry.PipelineOptionsDeleteSourceBlobOnSuccess), - to.Ptr(armcontainerregistry.PipelineOptionsContinueOnErrors)}, - Source: &armcontainerregistry.ImportPipelineSourceProperties{ - Type: to.Ptr(armcontainerregistry.PipelineSourceTypeAzureStorageBlobContainer), - KeyVaultURI: to.Ptr("https://myvault.vault.azure.net/secrets/acrimportsas"), - URI: to.Ptr("https://accountname.blob.core.windows.net/containername"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ImportPipeline = armcontainerregistry.ImportPipeline{ - // Name: to.Ptr("myImportPipeline"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/importPipelines"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/importPipelines/myImportPipeline"), - // Identity: &armcontainerregistry.IdentityProperties{ - // Type: to.Ptr(armcontainerregistry.ResourceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armcontainerregistry.UserIdentityProperties{ - // "/subscriptions/f9d7ebed-adbd-4cb4-b973-aaf82c136138/resourcegroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity2": &armcontainerregistry.UserIdentityProperties{ - // ClientID: to.Ptr("d3ce1bc2-f7d7-4a5b-9979-950f4e57680e"), - // PrincipalID: to.Ptr("b6p9f58b-6fbf-4efd-a7e0-fvd46911a466"), - // }, - // }, - // }, - // Location: to.Ptr("westus"), - // Properties: &armcontainerregistry.ImportPipelineProperties{ - // Options: []*armcontainerregistry.PipelineOptions{ - // to.Ptr(armcontainerregistry.PipelineOptionsOverwriteTags), - // to.Ptr(armcontainerregistry.PipelineOptionsDeleteSourceBlobOnSuccess), - // to.Ptr(armcontainerregistry.PipelineOptionsContinueOnErrors)}, - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Source: &armcontainerregistry.ImportPipelineSourceProperties{ - // Type: to.Ptr(armcontainerregistry.PipelineSourceTypeAzureStorageBlobContainer), - // KeyVaultURI: to.Ptr("https://myvault.vault.azure.net/secrets/acrimportsas"), - // URI: to.Ptr("https://accountname.blob.core.windows.net/containername"), - // }, - // Trigger: &armcontainerregistry.PipelineTriggerProperties{ - // SourceTrigger: &armcontainerregistry.PipelineSourceTriggerProperties{ - // Status: to.Ptr(armcontainerregistry.TriggerStatusEnabled), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/ImportPipelineDelete.json -func ExampleImportPipelinesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImportPipelinesClient().BeginDelete(ctx, "myResourceGroup", "myRegistry", "myImportPipeline", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/models.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/models.go index 5fdac611e903..8b03d16fff43 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/models.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/models.go @@ -10,12 +10,6 @@ package armcontainerregistry import "time" -// ActivationProperties - The activation properties of the connected registry. -type ActivationProperties struct { - // READ-ONLY; The activation status of the connected registry. - Status *ActivationStatus -} - // ActiveDirectoryObject - The Active Directory Object that will be used for authenticating the token of a container registry. type ActiveDirectoryObject struct { // The user/group/application object ID for Active Directory Object that will be used for authenticating the token of a container @@ -33,129 +27,6 @@ type Actor struct { Name *string } -// AgentPool - The agentpool that has the ARM resource and properties. The agentpool will have all information to create an -// agent pool. -type AgentPool struct { - // REQUIRED; The location of the resource. This cannot be changed after the resource is created. - Location *string - - // The properties associated with the agent pool - Properties *AgentPoolProperties - - // The tags of the resource. - Tags map[string]*string - - // READ-ONLY; The resource ID. - ID *string - - // READ-ONLY; The name of the resource. - Name *string - - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData - - // READ-ONLY; The type of the resource. - Type *string -} - -// AgentPoolListResult - The collection of agent pools. -type AgentPoolListResult struct { - // The URI that can be used to request the next set of paged results. - NextLink *string - - // The collection value. - Value []*AgentPool -} - -// AgentPoolProperties - The properties of agent pool. -type AgentPoolProperties struct { - // The count of agent machine - Count *int32 - - // The OS of agent machine - OS *OS - - // The Tier of agent machine - Tier *string - - // The Virtual Network Subnet Resource Id of the agent machine - VirtualNetworkSubnetResourceID *string - - // READ-ONLY; The provisioning state of this agent pool - ProvisioningState *ProvisioningState -} - -type AgentPoolPropertiesUpdateParameters struct { - // The count of agent machine - Count *int32 -} - -// AgentPoolQueueStatus - The QueueStatus of Agent Pool -type AgentPoolQueueStatus struct { - // The number of pending runs in the queue - Count *int32 -} - -// AgentPoolUpdateParameters - The parameters for updating an agent pool. -type AgentPoolUpdateParameters struct { - // The properties associated with the agent pool - Properties *AgentPoolPropertiesUpdateParameters - - // The ARM resource tags. - Tags map[string]*string -} - -// AgentPoolsClientBeginCreateOptions contains the optional parameters for the AgentPoolsClient.BeginCreate method. -type AgentPoolsClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// AgentPoolsClientBeginDeleteOptions contains the optional parameters for the AgentPoolsClient.BeginDelete method. -type AgentPoolsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// AgentPoolsClientBeginUpdateOptions contains the optional parameters for the AgentPoolsClient.BeginUpdate method. -type AgentPoolsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// AgentPoolsClientGetOptions contains the optional parameters for the AgentPoolsClient.Get method. -type AgentPoolsClientGetOptions struct { - // placeholder for future optional parameters -} - -// AgentPoolsClientGetQueueStatusOptions contains the optional parameters for the AgentPoolsClient.GetQueueStatus method. -type AgentPoolsClientGetQueueStatusOptions struct { - // placeholder for future optional parameters -} - -// AgentPoolsClientListOptions contains the optional parameters for the AgentPoolsClient.NewListPager method. -type AgentPoolsClientListOptions struct { - // placeholder for future optional parameters -} - -// AgentProperties - The properties that determine the run agent configuration. -type AgentProperties struct { - // The CPU configuration in terms of number of cores required for the run. - CPU *int32 -} - -// Argument - The properties of a run argument. -type Argument struct { - // REQUIRED; The name of the argument. - Name *string - - // REQUIRED; The value of the argument. - Value *string - - // Flag to indicate whether the argument represents a secret and want to be removed from build logs. - IsSecret *bool -} - // AuthCredential - Authentication credential stored for an upstream. type AuthCredential struct { // The name of the credential. @@ -171,102 +42,6 @@ type AuthCredential struct { CredentialHealth *CredentialHealth } -// AuthInfo - The authorization properties for accessing the source code repository. -type AuthInfo struct { - // REQUIRED; The access token used to access the source control provider. - Token *string - - // REQUIRED; The type of Auth token. - TokenType *TokenType - - // Time in seconds that the token remains valid - ExpiresIn *int32 - - // The refresh token used to refresh the access token. - RefreshToken *string - - // The scope of the access token. - Scope *string -} - -// AuthInfoUpdateParameters - The authorization properties for accessing the source code repository. -type AuthInfoUpdateParameters struct { - // Time in seconds that the token remains valid - ExpiresIn *int32 - - // The refresh token used to refresh the access token. - RefreshToken *string - - // The scope of the access token. - Scope *string - - // The access token used to access the source control provider. - Token *string - - // The type of Auth token. - TokenType *TokenType -} - -// AzureADAuthenticationAsArmPolicy - The policy for using ARM audience token for a container registry. -type AzureADAuthenticationAsArmPolicy struct { - // The value that indicates whether the policy is enabled or not. - Status *AzureADAuthenticationAsArmPolicyStatus -} - -// BaseImageDependency - Properties that describe a base image dependency. -type BaseImageDependency struct { - // The sha256-based digest of the image manifest. - Digest *string - - // The registry login server. - Registry *string - - // The repository name. - Repository *string - - // The tag name. - Tag *string - - // The type of the base image dependency. - Type *BaseImageDependencyType -} - -// BaseImageTrigger - The trigger based on base image dependency. -type BaseImageTrigger struct { - // REQUIRED; The type of the auto trigger for base image dependency updates. - BaseImageTriggerType *BaseImageTriggerType - - // REQUIRED; The name of the trigger. - Name *string - - // The current status of trigger. - Status *TriggerStatus - - // The endpoint URL for receiving update triggers. - UpdateTriggerEndpoint *string - - // Type of Payload body for Base image update triggers. - UpdateTriggerPayloadType *UpdateTriggerPayloadType -} - -// BaseImageTriggerUpdateParameters - The properties for updating base image dependency trigger. -type BaseImageTriggerUpdateParameters struct { - // REQUIRED; The name of the trigger. - Name *string - - // The type of the auto trigger for base image dependency updates. - BaseImageTriggerType *BaseImageTriggerType - - // The current status of trigger. - Status *TriggerStatus - - // The endpoint URL for receiving update triggers. - UpdateTriggerEndpoint *string - - // Type of Payload body for Base image update triggers. - UpdateTriggerPayloadType *UpdateTriggerPayloadType -} - // CacheRule - An object that represents a cache rule for a container registry. type CacheRule struct { // The properties of the cache rule. @@ -361,135 +136,6 @@ type CallbackConfig struct { CustomHeaders map[string]*string } -// ConnectedRegistriesClientBeginCreateOptions contains the optional parameters for the ConnectedRegistriesClient.BeginCreate -// method. -type ConnectedRegistriesClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ConnectedRegistriesClientBeginDeactivateOptions contains the optional parameters for the ConnectedRegistriesClient.BeginDeactivate -// method. -type ConnectedRegistriesClientBeginDeactivateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ConnectedRegistriesClientBeginDeleteOptions contains the optional parameters for the ConnectedRegistriesClient.BeginDelete -// method. -type ConnectedRegistriesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ConnectedRegistriesClientBeginUpdateOptions contains the optional parameters for the ConnectedRegistriesClient.BeginUpdate -// method. -type ConnectedRegistriesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ConnectedRegistriesClientGetOptions contains the optional parameters for the ConnectedRegistriesClient.Get method. -type ConnectedRegistriesClientGetOptions struct { - // placeholder for future optional parameters -} - -// ConnectedRegistriesClientListOptions contains the optional parameters for the ConnectedRegistriesClient.NewListPager method. -type ConnectedRegistriesClientListOptions struct { - // An OData filter expression that describes a subset of connectedRegistries to return. The parameters that can be filtered - // are parent.id (the resource id of the connectedRegistry parent), mode, and - // connectionState. The supported operator is eq. - Filter *string -} - -// ConnectedRegistry - An object that represents a connected registry for a container registry. -type ConnectedRegistry struct { - // The properties of the connected registry. - Properties *ConnectedRegistryProperties - - // READ-ONLY; The resource ID. - ID *string - - // READ-ONLY; The name of the resource. - Name *string - - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData - - // READ-ONLY; The type of the resource. - Type *string -} - -// ConnectedRegistryListResult - The result of a request to list connected registries for a container registry. -type ConnectedRegistryListResult struct { - // The URI that can be used to request the next list of connected registries. - NextLink *string - - // The list of connected registries. Since this list may be incomplete, the nextLink field should be used to request the next - // list of connected registries. - Value []*ConnectedRegistry -} - -// ConnectedRegistryProperties - The properties of a connected registry. -type ConnectedRegistryProperties struct { - // REQUIRED; The mode of the connected registry resource that indicates the permissions of the registry. - Mode *ConnectedRegistryMode - - // REQUIRED; The parent of the connected registry. - Parent *ParentProperties - - // The list of the ACR token resource IDs used to authenticate clients to the connected registry. - ClientTokenIDs []*string - - // The logging properties of the connected registry. - Logging *LoggingProperties - - // The login server properties of the connected registry. - LoginServer *LoginServerProperties - - // The list of notifications subscription information for the connected registry. - NotificationsList []*string - - // READ-ONLY; The activation properties of the connected registry. - Activation *ActivationProperties - - // READ-ONLY; The current connection state of the connected registry. - ConnectionState *ConnectionState - - // READ-ONLY; The last activity time of the connected registry. - LastActivityTime *time.Time - - // READ-ONLY; Provisioning state of the resource. - ProvisioningState *ProvisioningState - - // READ-ONLY; The list of current statuses of the connected registry. - StatusDetails []*StatusDetailProperties - - // READ-ONLY; The current version of ACR runtime on the connected registry. - Version *string -} - -// ConnectedRegistryUpdateParameters - The parameters for updating a connected registry. -type ConnectedRegistryUpdateParameters struct { - // The properties of the connected registry update parameters. - Properties *ConnectedRegistryUpdateProperties -} - -// ConnectedRegistryUpdateProperties - The parameters for updating token properties. -type ConnectedRegistryUpdateProperties struct { - // The list of the ACR token resource IDs used to authenticate clients to the connected registry. - ClientTokenIDs []*string - - // The logging properties of the connected registry. - Logging *LoggingProperties - - // The list of notifications subscription information for the connected registry. - NotificationsList []*string - - // The sync properties of the connected registry with its parent. - SyncProperties *SyncUpdateProperties -} - // CredentialHealth - The health of the auth credential. type CredentialHealth struct { // Error code representing the health check error. @@ -591,387 +237,104 @@ type CredentialSetsClientListOptions struct { // placeholder for future optional parameters } -// Credentials - The parameters that describes a set of credentials that will be used when a run is invoked. -type Credentials struct { - // Describes the credential parameters for accessing other custom registries. The key for the dictionary item will be the - // registry login server (myregistry.azurecr.io) and the value of the item will be - // the registry credentials for accessing the registry. - CustomRegistries map[string]*CustomRegistryCredentials +type EncryptionProperty struct { + // Key vault properties. + KeyVaultProperties *KeyVaultProperties - // Describes the credential parameters for accessing the source registry. - SourceRegistry *SourceRegistryCredentials + // Indicates whether or not the encryption is enabled for container registry. + Status *EncryptionStatus } -// CustomRegistryCredentials - Describes the credentials that will be used to access a custom registry during a run. -type CustomRegistryCredentials struct { - // Indicates the managed identity assigned to the custom credential. If a user-assigned identity this value is the Client - // ID. If a system-assigned identity, the value will be system. In the case of a - // system-assigned identity, the Client ID will be determined by the runner. This identity may be used to authenticate to - // key vault to retrieve credentials or it may be the only source of authentication - // used for accessing the registry. - Identity *string - - // The password for logging into the custom registry. The password is a secret object that allows multiple ways of providing - // the value for it. - Password *SecretObject - - // The username for logging into the custom registry. - UserName *SecretObject +// ErrorResponse - An error response from the Azure Container Registry service. +type ErrorResponse struct { + // Azure container registry build API error body. + Error *ErrorResponseBody } -// DockerBuildRequest - The parameters for a docker quick build. -type DockerBuildRequest struct { - // REQUIRED; The Docker file path relative to the source location. - DockerFilePath *string - - // REQUIRED; The platform properties against which the run has to happen. - Platform *PlatformProperties +// ErrorResponseBody - An error response from the Azure Container Registry service. +type ErrorResponseBody struct { + // REQUIRED; error code. + Code *string - // REQUIRED; The type of the run request. - Type *string + // REQUIRED; error message. + Message *string - // The machine configuration of the run agent. - AgentConfiguration *AgentProperties + // an array of additional nested error response info objects, as described by this contract. + Details []*InnerErrorDescription - // The dedicated agent pool for the run. - AgentPoolName *string + // target of the particular error. + Target *string +} - // The collection of override arguments to be used when executing the run. - Arguments []*Argument +// Event - The event for a webhook. +type Event struct { + // The event request message sent to the service URI. + EventRequestMessage *EventRequestMessage - // The properties that describes a set of credentials that will be used when this run is invoked. - Credentials *Credentials + // The event response message received from the service URI. + EventResponseMessage *EventResponseMessage - // The fully qualified image names including the repository and tag. - ImageNames []*string + // The event ID. + ID *string +} - // The value that indicates whether archiving is enabled for the run or not. - IsArchiveEnabled *bool +// EventContent - The content of the event request message. +type EventContent struct { + // The action that encompasses the provided event. + Action *string - // The value of this property indicates whether the image built should be pushed to the registry or not. - IsPushEnabled *bool + // The agent that initiated the event. For most situations, this could be from the authorization context of the request. + Actor *Actor - // The template that describes the repository and tag information for run log artifact. - LogTemplate *string + // The event ID. + ID *string - // The value of this property indicates whether the image cache is enabled or not. - NoCache *bool + // The request that generated the event. + Request *Request - // The URL(absolute or relative) of the source context. It can be an URL to a tar or git repository. If it is relative URL, - // the relative path should be obtained from calling listBuildSourceUploadUrl API. - SourceLocation *string + // The registry node that generated the event. Put differently, while the actor initiates the event, the source generates + // it. + Source *Source - // The name of the target build stage for the docker build. - Target *string + // The target of the event. + Target *Target - // Run timeout in seconds. - Timeout *int32 + // The time at which the event occurred. + Timestamp *time.Time } -// GetRunRequest implements the RunRequestClassification interface for type DockerBuildRequest. -func (d *DockerBuildRequest) GetRunRequest() *RunRequest { - return &RunRequest{ - Type: d.Type, - IsArchiveEnabled: d.IsArchiveEnabled, - AgentPoolName: d.AgentPoolName, - LogTemplate: d.LogTemplate, - } +// EventInfo - The basic information of an event. +type EventInfo struct { + // The event ID. + ID *string } -// DockerBuildStep - The Docker build step. -type DockerBuildStep struct { - // REQUIRED; The Docker file path relative to the source context. - DockerFilePath *string - - // REQUIRED; The type of the step. - Type *StepType +// EventListResult - The result of a request to list events for a webhook. +type EventListResult struct { + // The URI that can be used to request the next list of events. + NextLink *string - // The collection of override arguments to be used when executing this build step. - Arguments []*Argument + // The list of events. Since this list may be incomplete, the nextLink field should be used to request the next list of events. + Value []*Event +} - // The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string +// EventRequestMessage - The event request message sent to the service URI. +type EventRequestMessage struct { + // The content of the event request message. + Content *EventContent - // The URL(absolute or relative) of the source context for the task step. - ContextPath *string + // The headers of the event request message. + Headers map[string]*string - // The fully qualified image names including the repository and tag. - ImageNames []*string + // The HTTP method used to send the event request message. + Method *string - // The value of this property indicates whether the image built should be pushed to the registry or not. - IsPushEnabled *bool + // The URI used to send the event request message. + RequestURI *string - // The value of this property indicates whether the image cache is enabled or not. - NoCache *bool - - // The name of the target build stage for the docker build. - Target *string - - // READ-ONLY; List of base image dependencies for a step. - BaseImageDependencies []*BaseImageDependency -} - -// GetTaskStepProperties implements the TaskStepPropertiesClassification interface for type DockerBuildStep. -func (d *DockerBuildStep) GetTaskStepProperties() *TaskStepProperties { - return &TaskStepProperties{ - Type: d.Type, - BaseImageDependencies: d.BaseImageDependencies, - ContextPath: d.ContextPath, - ContextAccessToken: d.ContextAccessToken, - } -} - -// DockerBuildStepUpdateParameters - The properties for updating a docker build step. -type DockerBuildStepUpdateParameters struct { - // REQUIRED; The type of the step. - Type *StepType - - // The collection of override arguments to be used when executing this build step. - Arguments []*Argument - - // The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string - - // The URL(absolute or relative) of the source context for the task step. - ContextPath *string - - // The Docker file path relative to the source context. - DockerFilePath *string - - // The fully qualified image names including the repository and tag. - ImageNames []*string - - // The value of this property indicates whether the image built should be pushed to the registry or not. - IsPushEnabled *bool - - // The value of this property indicates whether the image cache is enabled or not. - NoCache *bool - - // The name of the target build stage for the docker build. - Target *string -} - -// GetTaskStepUpdateParameters implements the TaskStepUpdateParametersClassification interface for type DockerBuildStepUpdateParameters. -func (d *DockerBuildStepUpdateParameters) GetTaskStepUpdateParameters() *TaskStepUpdateParameters { - return &TaskStepUpdateParameters{ - Type: d.Type, - ContextPath: d.ContextPath, - ContextAccessToken: d.ContextAccessToken, - } -} - -// EncodedTaskRunRequest - The parameters for a quick task run request. -type EncodedTaskRunRequest struct { - // REQUIRED; Base64 encoded value of the template/definition file content. - EncodedTaskContent *string - - // REQUIRED; The platform properties against which the run has to happen. - Platform *PlatformProperties - - // REQUIRED; The type of the run request. - Type *string - - // The machine configuration of the run agent. - AgentConfiguration *AgentProperties - - // The dedicated agent pool for the run. - AgentPoolName *string - - // The properties that describes a set of credentials that will be used when this run is invoked. - Credentials *Credentials - - // Base64 encoded value of the parameters/values file content. - EncodedValuesContent *string - - // The value that indicates whether archiving is enabled for the run or not. - IsArchiveEnabled *bool - - // The template that describes the repository and tag information for run log artifact. - LogTemplate *string - - // The URL(absolute or relative) of the source context. It can be an URL to a tar or git repository. If it is relative URL, - // the relative path should be obtained from calling listBuildSourceUploadUrl API. - SourceLocation *string - - // Run timeout in seconds. - Timeout *int32 - - // The collection of overridable values that can be passed when running a task. - Values []*SetValue -} - -// GetRunRequest implements the RunRequestClassification interface for type EncodedTaskRunRequest. -func (e *EncodedTaskRunRequest) GetRunRequest() *RunRequest { - return &RunRequest{ - Type: e.Type, - IsArchiveEnabled: e.IsArchiveEnabled, - AgentPoolName: e.AgentPoolName, - LogTemplate: e.LogTemplate, - } -} - -// EncodedTaskStep - The properties of a encoded task step. -type EncodedTaskStep struct { - // REQUIRED; Base64 encoded value of the template/definition file content. - EncodedTaskContent *string - - // REQUIRED; The type of the step. - Type *StepType - - // The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string - - // The URL(absolute or relative) of the source context for the task step. - ContextPath *string - - // Base64 encoded value of the parameters/values file content. - EncodedValuesContent *string - - // The collection of overridable values that can be passed when running a task. - Values []*SetValue - - // READ-ONLY; List of base image dependencies for a step. - BaseImageDependencies []*BaseImageDependency -} - -// GetTaskStepProperties implements the TaskStepPropertiesClassification interface for type EncodedTaskStep. -func (e *EncodedTaskStep) GetTaskStepProperties() *TaskStepProperties { - return &TaskStepProperties{ - Type: e.Type, - BaseImageDependencies: e.BaseImageDependencies, - ContextPath: e.ContextPath, - ContextAccessToken: e.ContextAccessToken, - } -} - -// EncodedTaskStepUpdateParameters - The properties for updating encoded task step. -type EncodedTaskStepUpdateParameters struct { - // REQUIRED; The type of the step. - Type *StepType - - // The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string - - // The URL(absolute or relative) of the source context for the task step. - ContextPath *string - - // Base64 encoded value of the template/definition file content. - EncodedTaskContent *string - - // Base64 encoded value of the parameters/values file content. - EncodedValuesContent *string - - // The collection of overridable values that can be passed when running a task. - Values []*SetValue -} - -// GetTaskStepUpdateParameters implements the TaskStepUpdateParametersClassification interface for type EncodedTaskStepUpdateParameters. -func (e *EncodedTaskStepUpdateParameters) GetTaskStepUpdateParameters() *TaskStepUpdateParameters { - return &TaskStepUpdateParameters{ - Type: e.Type, - ContextPath: e.ContextPath, - ContextAccessToken: e.ContextAccessToken, - } -} - -type EncryptionProperty struct { - // Key vault properties. - KeyVaultProperties *KeyVaultProperties - - // Indicates whether or not the encryption is enabled for container registry. - Status *EncryptionStatus -} - -// ErrorResponse - An error response from the Azure Container Registry service. -type ErrorResponse struct { - // Azure container registry build API error body. - Error *ErrorResponseBody -} - -// ErrorResponseBody - An error response from the Azure Container Registry service. -type ErrorResponseBody struct { - // REQUIRED; error code. - Code *string - - // REQUIRED; error message. - Message *string - - // an array of additional nested error response info objects, as described by this contract. - Details []*InnerErrorDescription - - // target of the particular error. - Target *string -} - -// Event - The event for a webhook. -type Event struct { - // The event request message sent to the service URI. - EventRequestMessage *EventRequestMessage - - // The event response message received from the service URI. - EventResponseMessage *EventResponseMessage - - // The event ID. - ID *string -} - -// EventContent - The content of the event request message. -type EventContent struct { - // The action that encompasses the provided event. - Action *string - - // The agent that initiated the event. For most situations, this could be from the authorization context of the request. - Actor *Actor - - // The event ID. - ID *string - - // The request that generated the event. - Request *Request - - // The registry node that generated the event. Put differently, while the actor initiates the event, the source generates - // it. - Source *Source - - // The target of the event. - Target *Target - - // The time at which the event occurred. - Timestamp *time.Time -} - -// EventInfo - The basic information of an event. -type EventInfo struct { - // The event ID. - ID *string -} - -// EventListResult - The result of a request to list events for a webhook. -type EventListResult struct { - // The URI that can be used to request the next list of events. - NextLink *string - - // The list of events. Since this list may be incomplete, the nextLink field should be used to request the next list of events. - Value []*Event -} - -// EventRequestMessage - The event request message sent to the service URI. -type EventRequestMessage struct { - // The content of the event request message. - Content *EventContent - - // The headers of the event request message. - Headers map[string]*string - - // The HTTP method used to send the event request message. - Method *string - - // The URI used to send the event request message. - RequestURI *string - - // The HTTP message version. - Version *string -} + // The HTTP message version. + Version *string +} // EventResponseMessage - The event response message received from the service URI. type EventResponseMessage struct { @@ -991,208 +354,12 @@ type EventResponseMessage struct { Version *string } -// ExportPipeline - An object that represents an export pipeline for a container registry. -type ExportPipeline struct { - // The identity of the export pipeline. - Identity *IdentityProperties - - // The location of the export pipeline. - Location *string - - // The properties of the export pipeline. - Properties *ExportPipelineProperties - - // READ-ONLY; The resource ID. - ID *string - - // READ-ONLY; The name of the resource. - Name *string - - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData - - // READ-ONLY; The type of the resource. - Type *string -} - -// ExportPipelineListResult - The result of a request to list export pipelines for a container registry. -type ExportPipelineListResult struct { - // The URI that can be used to request the next list of pipeline runs. - NextLink *string - - // The list of export pipelines. Since this list may be incomplete, the nextLink field should be used to request the next - // list of export pipelines. - Value []*ExportPipeline -} - -// ExportPipelineProperties - The properties of an export pipeline. -type ExportPipelineProperties struct { - // REQUIRED; The target properties of the export pipeline. - Target *ExportPipelineTargetProperties - - // The list of all options configured for the pipeline. - Options []*PipelineOptions - - // READ-ONLY; The provisioning state of the pipeline at the time the operation was called. - ProvisioningState *ProvisioningState -} - -// ExportPipelineTargetProperties - The properties of the export pipeline target. -type ExportPipelineTargetProperties struct { - // REQUIRED; They key vault secret uri to obtain the target storage SAS token. - KeyVaultURI *string - - // The type of target for the export pipeline. - Type *string - - // The target uri of the export pipeline. When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" - // When 'AzureStorageBlobContainer': - // "https://accountName.blob.core.windows.net/containerName" - URI *string -} - -// ExportPipelinesClientBeginCreateOptions contains the optional parameters for the ExportPipelinesClient.BeginCreate method. -type ExportPipelinesClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ExportPipelinesClientBeginDeleteOptions contains the optional parameters for the ExportPipelinesClient.BeginDelete method. -type ExportPipelinesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ExportPipelinesClientGetOptions contains the optional parameters for the ExportPipelinesClient.Get method. -type ExportPipelinesClientGetOptions struct { - // placeholder for future optional parameters -} - -// ExportPipelinesClientListOptions contains the optional parameters for the ExportPipelinesClient.NewListPager method. -type ExportPipelinesClientListOptions struct { - // placeholder for future optional parameters -} - // ExportPolicy - The export policy for a container registry. type ExportPolicy struct { // The value that indicates whether the policy is enabled or not. Status *ExportPolicyStatus } -// FileTaskRunRequest - The request parameters for a scheduling run against a task file. -type FileTaskRunRequest struct { - // REQUIRED; The platform properties against which the run has to happen. - Platform *PlatformProperties - - // REQUIRED; The template/definition file path relative to the source. - TaskFilePath *string - - // REQUIRED; The type of the run request. - Type *string - - // The machine configuration of the run agent. - AgentConfiguration *AgentProperties - - // The dedicated agent pool for the run. - AgentPoolName *string - - // The properties that describes a set of credentials that will be used when this run is invoked. - Credentials *Credentials - - // The value that indicates whether archiving is enabled for the run or not. - IsArchiveEnabled *bool - - // The template that describes the repository and tag information for run log artifact. - LogTemplate *string - - // The URL(absolute or relative) of the source context. It can be an URL to a tar or git repository. If it is relative URL, - // the relative path should be obtained from calling listBuildSourceUploadUrl API. - SourceLocation *string - - // Run timeout in seconds. - Timeout *int32 - - // The collection of overridable values that can be passed when running a task. - Values []*SetValue - - // The values/parameters file path relative to the source. - ValuesFilePath *string -} - -// GetRunRequest implements the RunRequestClassification interface for type FileTaskRunRequest. -func (f *FileTaskRunRequest) GetRunRequest() *RunRequest { - return &RunRequest{ - Type: f.Type, - IsArchiveEnabled: f.IsArchiveEnabled, - AgentPoolName: f.AgentPoolName, - LogTemplate: f.LogTemplate, - } -} - -// FileTaskStep - The properties of a task step. -type FileTaskStep struct { - // REQUIRED; The task template/definition file path relative to the source context. - TaskFilePath *string - - // REQUIRED; The type of the step. - Type *StepType - - // The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string - - // The URL(absolute or relative) of the source context for the task step. - ContextPath *string - - // The collection of overridable values that can be passed when running a task. - Values []*SetValue - - // The task values/parameters file path relative to the source context. - ValuesFilePath *string - - // READ-ONLY; List of base image dependencies for a step. - BaseImageDependencies []*BaseImageDependency -} - -// GetTaskStepProperties implements the TaskStepPropertiesClassification interface for type FileTaskStep. -func (f *FileTaskStep) GetTaskStepProperties() *TaskStepProperties { - return &TaskStepProperties{ - Type: f.Type, - BaseImageDependencies: f.BaseImageDependencies, - ContextPath: f.ContextPath, - ContextAccessToken: f.ContextAccessToken, - } -} - -// FileTaskStepUpdateParameters - The properties of updating a task step. -type FileTaskStepUpdateParameters struct { - // REQUIRED; The type of the step. - Type *StepType - - // The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string - - // The URL(absolute or relative) of the source context for the task step. - ContextPath *string - - // The task template/definition file path relative to the source context. - TaskFilePath *string - - // The collection of overridable values that can be passed when running a task. - Values []*SetValue - - // The values/parameters file path relative to the source context. - ValuesFilePath *string -} - -// GetTaskStepUpdateParameters implements the TaskStepUpdateParametersClassification interface for type FileTaskStepUpdateParameters. -func (f *FileTaskStepUpdateParameters) GetTaskStepUpdateParameters() *TaskStepUpdateParameters { - return &TaskStepUpdateParameters{ - Type: f.Type, - ContextPath: f.ContextPath, - ContextAccessToken: f.ContextAccessToken, - } -} - // GenerateCredentialsParameters - The parameters used to generate credentials for a specified token or user of a container // registry. type GenerateCredentialsParameters struct { @@ -1226,12 +393,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 @@ -1239,33 +400,12 @@ type IdentityProperties struct { // ids in the form: // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. UserAssignedIdentities map[string]*UserIdentityProperties -} - -// ImageDescriptor - Properties for a registry image. -type ImageDescriptor struct { - // The sha256-based digest of the image manifest. - Digest *string - // The registry login server. - Registry *string - - // The repository name. - Repository *string - - // The tag name. - Tag *string -} - -// ImageUpdateTrigger - The image update trigger that caused a build. -type ImageUpdateTrigger struct { - // The unique ID of the trigger. - ID *string - - // The list of image updates that caused the build. - Images []*ImageDescriptor + // READ-ONLY; The principal ID of resource identity. + PrincipalID *string - // The timestamp when the image update happened. - Timestamp *time.Time + // READ-ONLY; The tenant ID of resource. + TenantID *string } type ImportImageParameters struct { @@ -1284,91 +424,6 @@ type ImportImageParameters struct { UntaggedTargetRepositories []*string } -// ImportPipeline - An object that represents an import pipeline for a container registry. -type ImportPipeline struct { - // The identity of the import pipeline. - Identity *IdentityProperties - - // The location of the import pipeline. - Location *string - - // The properties of the import pipeline. - Properties *ImportPipelineProperties - - // READ-ONLY; The resource ID. - ID *string - - // READ-ONLY; The name of the resource. - Name *string - - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData - - // READ-ONLY; The type of the resource. - Type *string -} - -// ImportPipelineListResult - The result of a request to list import pipelines for a container registry. -type ImportPipelineListResult struct { - // The URI that can be used to request the next list of pipeline runs. - NextLink *string - - // The list of import pipelines. Since this list may be incomplete, the nextLink field should be used to request the next - // list of import pipelines. - Value []*ImportPipeline -} - -// ImportPipelineProperties - The properties of an import pipeline. -type ImportPipelineProperties struct { - // REQUIRED; The source properties of the import pipeline. - Source *ImportPipelineSourceProperties - - // The list of all options configured for the pipeline. - Options []*PipelineOptions - - // The properties that describe the trigger of the import pipeline. - Trigger *PipelineTriggerProperties - - // READ-ONLY; The provisioning state of the pipeline at the time the operation was called. - ProvisioningState *ProvisioningState -} - -// ImportPipelineSourceProperties - The properties of the import pipeline source. -type ImportPipelineSourceProperties struct { - // REQUIRED; They key vault secret uri to obtain the source storage SAS token. - KeyVaultURI *string - - // The type of source for the import pipeline. - Type *PipelineSourceType - - // The source uri of the import pipeline. When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" - // When 'AzureStorageBlobContainer': - // "https://accountName.blob.core.windows.net/containerName" - URI *string -} - -// ImportPipelinesClientBeginCreateOptions contains the optional parameters for the ImportPipelinesClient.BeginCreate method. -type ImportPipelinesClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ImportPipelinesClientBeginDeleteOptions contains the optional parameters for the ImportPipelinesClient.BeginDelete method. -type ImportPipelinesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ImportPipelinesClientGetOptions contains the optional parameters for the ImportPipelinesClient.Get method. -type ImportPipelinesClientGetOptions struct { - // placeholder for future optional parameters -} - -// ImportPipelinesClientListOptions contains the optional parameters for the ImportPipelinesClient.NewListPager method. -type ImportPipelinesClientListOptions struct { - // placeholder for future optional parameters -} - type ImportSource struct { // REQUIRED; Repository name of the source image. Specify an image by repository ('hello-world'). This will use the 'latest' // tag. Specify an image by tag ('hello-world:latest'). Specify an image by sha256-based @@ -1422,24 +477,6 @@ type KeyVaultProperties struct { VersionedKeyIdentifier *string } -// LoggingProperties - The logging properties of the connected registry. -type LoggingProperties struct { - // Indicates whether audit logs are enabled on the connected registry. - AuditLogStatus *AuditLogStatus - - // The verbosity of logs persisted on the connected registry. - LogLevel *LogLevel -} - -// LoginServerProperties - The login server properties of the connected registry. -type LoginServerProperties struct { - // READ-ONLY; The host of the connected registry. Can be FQDN or IP. - Host *string - - // READ-ONLY; The TLS properties of the connected registry login server. - TLS *TLSProperties -} - // NetworkRuleSet - The network rule set for a container registry. type NetworkRuleSet struct { // REQUIRED; The default action of allow or deny when no other rules match. @@ -1545,26 +582,6 @@ type OperationsClientListOptions struct { // placeholder for future optional parameters } -type OverrideTaskStepProperties struct { - // Gets or sets the collection of override arguments to be used when executing a build step. - Arguments []*Argument - - // The source context against which run has to be queued. - ContextPath *string - - // The file against which run has to be queued. - File *string - - // The name of the target build stage for the docker build. - Target *string - - // Base64 encoded update trigger token that will be attached with the base image trigger webhook. - UpdateTriggerToken *string - - // The collection of overridable values that can be passed when running a Task. - Values []*SetValue -} - // PackageType - The properties of a package type. type PackageType struct { // The name of the package type. @@ -1574,198 +591,8 @@ type PackageType struct { Endpoint *string } -// ParentProperties - The properties of the connected registry parent. -type ParentProperties struct { - // REQUIRED; The sync properties of the connected registry with its parent. - SyncProperties *SyncProperties - - // The resource ID of the parent to which the connected registry will be associated. - ID *string -} - -// PipelineRun - An object that represents a pipeline run for a container registry. -type PipelineRun struct { - // The properties of a pipeline run. - Properties *PipelineRunProperties - - // READ-ONLY; The resource ID. - ID *string - - // READ-ONLY; The name of the resource. - Name *string - - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData - - // READ-ONLY; The type of the resource. - Type *string -} - -// PipelineRunListResult - The result of a request to list pipeline runs for a container registry. -type PipelineRunListResult struct { - // The URI that can be used to request the next list of pipeline runs. - NextLink *string - - // The list of pipeline runs. Since this list may be incomplete, the nextLink field should be used to request the next list - // of pipeline runs. - Value []*PipelineRun -} - -// PipelineRunProperties - The properties of a pipeline run. -type PipelineRunProperties struct { - // How the pipeline run should be forced to recreate even if the pipeline run configuration has not changed. - ForceUpdateTag *string - - // The request parameters for a pipeline run. - Request *PipelineRunRequest - - // READ-ONLY; The provisioning state of a pipeline run. - ProvisioningState *ProvisioningState - - // READ-ONLY; The response of a pipeline run. - Response *PipelineRunResponse -} - -// PipelineRunRequest - The request properties provided for a pipeline run. -type PipelineRunRequest struct { - // List of source artifacts to be transferred by the pipeline. Specify an image by repository ('hello-world'). This will use - // the 'latest' tag. Specify an image by tag ('hello-world:latest'). Specify an - // image by sha256-based manifest digest ('hello-world@sha256:abc123'). - Artifacts []*string - - // The digest of the tar used to transfer the artifacts. - CatalogDigest *string - - // The resource ID of the pipeline to run. - PipelineResourceID *string - - // The source properties of the pipeline run. - Source *PipelineRunSourceProperties - - // The target properties of the pipeline run. - Target *PipelineRunTargetProperties -} - -// PipelineRunResponse - The response properties returned for a pipeline run. -type PipelineRunResponse struct { - // The digest of the tar used to transfer the artifacts. - CatalogDigest *string - - // The time the pipeline run finished. - FinishTime *time.Time - - // The artifacts imported in the pipeline run. - ImportedArtifacts []*string - - // The detailed error message for the pipeline run in the case of failure. - PipelineRunErrorMessage *string - - // The current progress of the copy operation. - Progress *ProgressProperties - - // The source of the pipeline run. - Source *ImportPipelineSourceProperties - - // The time the pipeline run started. - StartTime *time.Time - - // The current status of the pipeline run. - Status *string - - // The target of the pipeline run. - Target *ExportPipelineTargetProperties - - // The trigger that caused the pipeline run. - Trigger *PipelineTriggerDescriptor -} - -type PipelineRunSourceProperties struct { - // The name of the source. - Name *string - - // The type of the source. - Type *PipelineRunSourceType -} - -type PipelineRunTargetProperties struct { - // The name of the target. - Name *string - - // The type of the target. - Type *PipelineRunTargetType -} - -// PipelineRunsClientBeginCreateOptions contains the optional parameters for the PipelineRunsClient.BeginCreate method. -type PipelineRunsClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PipelineRunsClientBeginDeleteOptions contains the optional parameters for the PipelineRunsClient.BeginDelete method. -type PipelineRunsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PipelineRunsClientGetOptions contains the optional parameters for the PipelineRunsClient.Get method. -type PipelineRunsClientGetOptions struct { - // placeholder for future optional parameters -} - -// PipelineRunsClientListOptions contains the optional parameters for the PipelineRunsClient.NewListPager method. -type PipelineRunsClientListOptions struct { - // placeholder for future optional parameters -} - -type PipelineSourceTriggerDescriptor struct { - // The timestamp when the source update happened. - Timestamp *time.Time -} - -type PipelineSourceTriggerProperties struct { - // REQUIRED; The current status of the source trigger. - Status *TriggerStatus -} - -type PipelineTriggerDescriptor struct { - // The source trigger that caused the pipeline run. - SourceTrigger *PipelineSourceTriggerDescriptor -} - -type PipelineTriggerProperties struct { - // The source trigger properties of the pipeline. - SourceTrigger *PipelineSourceTriggerProperties -} - -// PlatformProperties - The platform properties against which the run has to happen. -type PlatformProperties struct { - // REQUIRED; The operating system type required for the run. - OS *OS - - // The OS architecture. - Architecture *Architecture - - // Variant of the CPU. - Variant *Variant -} - -// PlatformUpdateParameters - The properties for updating the platform configuration. -type PlatformUpdateParameters struct { - // The OS architecture. - Architecture *Architecture - - // The operating system type required for the run. - OS *OS - - // Variant of the CPU. - Variant *Variant -} - // Policies - The policies for a container registry. type Policies struct { - // The policy for using ARM audience token for a container registry. - AzureADAuthenticationAsArmPolicy *AzureADAuthenticationAsArmPolicy - // The export policy for a container registry. ExportPolicy *ExportPolicy @@ -1775,9 +602,6 @@ type Policies struct { // The retention policy for a container registry. RetentionPolicy *RetentionPolicy - // The soft delete policy for a container registry. - SoftDeletePolicy *SoftDeletePolicy - // The content trust policy for a container registry. TrustPolicy *TrustPolicy } @@ -1903,11 +727,6 @@ type PrivateLinkServiceConnectionState struct { Status *ConnectionStatus } -type ProgressProperties struct { - // The percentage complete of the copy operation. - Percentage *string -} - // ProxyResource - The resource model definition for a ARM proxy resource. It will have everything other than required location // and tags. type ProxyResource struct { @@ -1961,12 +780,6 @@ type RegistriesClientBeginImportImageOptions struct { ResumeToken string } -// RegistriesClientBeginScheduleRunOptions contains the optional parameters for the RegistriesClient.BeginScheduleRun method. -type RegistriesClientBeginScheduleRunOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - // RegistriesClientBeginUpdateOptions contains the optional parameters for the RegistriesClient.BeginUpdate method. type RegistriesClientBeginUpdateOptions struct { // Resumes the LRO from the provided token. @@ -1979,12 +792,6 @@ type RegistriesClientCheckNameAvailabilityOptions struct { // placeholder for future optional parameters } -// RegistriesClientGetBuildSourceUploadURLOptions contains the optional parameters for the RegistriesClient.GetBuildSourceUploadURL -// method. -type RegistriesClientGetBuildSourceUploadURLOptions struct { - // placeholder for future optional parameters -} - // RegistriesClientGetOptions contains the optional parameters for the RegistriesClient.Get method. type RegistriesClientGetOptions struct { // placeholder for future optional parameters @@ -2114,9 +921,6 @@ type RegistryProperties struct { // The value that indicates whether the admin user is enabled. AdminUserEnabled *bool - // Enables registry-wide pull from unauthenticated clients. - AnonymousPullEnabled *bool - // Enable a single data endpoint per region for serving data. DataEndpointEnabled *bool @@ -2162,9 +966,6 @@ type RegistryPropertiesUpdateParameters struct { // The value that indicates whether the admin user is enabled. AdminUserEnabled *bool - // Enables registry-wide pull from unauthenticated clients. - AnonymousPullEnabled *bool - // Enable a single data endpoint per region for serving data. DataEndpointEnabled *bool @@ -2221,749 +1022,12 @@ type RegistryUsageListResult struct { } // Replication - An object that represents a replication for a container registry. -type Replication struct { - // REQUIRED; The location of the resource. This cannot be changed after the resource is created. - Location *string - - // The properties of the replication. - Properties *ReplicationProperties - - // The tags of the resource. - Tags map[string]*string - - // READ-ONLY; The resource ID. - ID *string - - // READ-ONLY; The name of the resource. - Name *string - - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData - - // READ-ONLY; The type of the resource. - Type *string -} - -// ReplicationListResult - The result of a request to list replications for a container registry. -type ReplicationListResult struct { - // The URI that can be used to request the next list of replications. - NextLink *string - - // The list of replications. Since this list may be incomplete, the nextLink field should be used to request the next list - // of replications. - Value []*Replication -} - -// ReplicationProperties - The properties of a replication. -type ReplicationProperties struct { - // Specifies whether the replication's regional endpoint is enabled. Requests will not be routed to a replication whose regional - // endpoint is disabled, however its data will continue to be synced with - // other replications. - RegionEndpointEnabled *bool - - // Whether or not zone redundancy is enabled for this container registry replication - ZoneRedundancy *ZoneRedundancy - - // READ-ONLY; The provisioning state of the replication at the time the operation was called. - ProvisioningState *ProvisioningState - - // READ-ONLY; The status of the replication at the time the operation was called. - Status *Status -} - -// ReplicationUpdateParameters - The parameters for updating a replication. -type ReplicationUpdateParameters struct { - // The parameters for updating a replication's properties - Properties *ReplicationUpdateParametersProperties - - // The tags for the replication. - Tags map[string]*string -} - -type ReplicationUpdateParametersProperties struct { - // Specifies whether the replication's regional endpoint is enabled. Requests will not be routed to a replication whose regional - // endpoint is disabled, however its data will continue to be synced with - // other replications. - RegionEndpointEnabled *bool -} - -// ReplicationsClientBeginCreateOptions contains the optional parameters for the ReplicationsClient.BeginCreate method. -type ReplicationsClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ReplicationsClientBeginDeleteOptions contains the optional parameters for the ReplicationsClient.BeginDelete method. -type ReplicationsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ReplicationsClientBeginUpdateOptions contains the optional parameters for the ReplicationsClient.BeginUpdate method. -type ReplicationsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ReplicationsClientGetOptions contains the optional parameters for the ReplicationsClient.Get method. -type ReplicationsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ReplicationsClientListOptions contains the optional parameters for the ReplicationsClient.NewListPager method. -type ReplicationsClientListOptions struct { - // placeholder for future optional parameters -} - -// Request - The request that generated the event. -type Request struct { - // The IP or hostname and possibly port of the client connection that initiated the event. This is the RemoteAddr from the - // standard http request. - Addr *string - - // The externally accessible hostname of the registry instance, as specified by the http host header on incoming requests. - Host *string - - // The ID of the request that initiated the event. - ID *string - - // The request method that generated the event. - Method *string - - // The user agent header of the request. - Useragent *string -} - -// Resource - An Azure resource. -type Resource struct { - // REQUIRED; The location of the resource. This cannot be changed after the resource is created. - Location *string - - // The tags of the resource. - Tags map[string]*string - - // READ-ONLY; The resource ID. - ID *string - - // READ-ONLY; The name of the resource. - Name *string - - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData - - // READ-ONLY; The type of the resource. - Type *string -} - -// RetentionPolicy - The retention policy for a container registry. -type RetentionPolicy struct { - // The number of days to retain an untagged manifest after which it gets purged. - Days *int32 - - // The value that indicates whether the policy is enabled or not. - Status *PolicyStatus - - // READ-ONLY; The timestamp when the policy was last updated. - LastUpdatedTime *time.Time -} - -// Run resource properties -type Run struct { - // The properties of a run. - Properties *RunProperties - - // 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 -} - -// RunFilter - Properties that are enabled for Odata querying on runs. -type RunFilter struct { - // The name of the agent pool that the run corresponds to. - AgentPoolName *string - - // The create time for a run. - CreateTime *time.Time - - // The time the run finished. - FinishTime *time.Time - - // The value that indicates whether archiving is enabled or not. - IsArchiveEnabled *bool - - // The list of comma-separated image manifests that were generated from the run. This is applicable if the run is of build - // type. - OutputImageManifests *string - - // The unique identifier for the run. - RunID *string - - // The type of run. - RunType *RunType - - // The current status of the run. - Status *RunStatus - - // The name of the task that the run corresponds to. - TaskName *string -} - -// RunGetLogResult - The result of get log link operation. -type RunGetLogResult struct { - // The link to logs in registry for a run on a azure container registry. - LogArtifactLink *string - - // The link to logs for a run on a azure container registry. - LogLink *string -} - -// RunListResult - Collection of runs. -type RunListResult struct { - // The URI that can be used to request the next set of paged results. - NextLink *string - - // The collection value. - Value []*Run -} - -// RunProperties - The properties for a run. -type RunProperties struct { - // The machine configuration of the run agent. - AgentConfiguration *AgentProperties - - // The dedicated agent pool for the run. - AgentPoolName *string - - // The time the run was scheduled. - CreateTime *time.Time - - // The list of custom registries that were logged in during this run. - CustomRegistries []*string - - // The time the run finished. - FinishTime *time.Time - - // The image update trigger that caused the run. This is applicable if the task has base image trigger configured. - ImageUpdateTrigger *ImageUpdateTrigger - - // The value that indicates whether archiving is enabled or not. - IsArchiveEnabled *bool - - // The last updated time for the run. - LastUpdatedTime *time.Time - - // The list of all images that were generated from the run. This is applicable if the run generates base image dependencies. - OutputImages []*ImageDescriptor - - // The platform properties against which the run will happen. - Platform *PlatformProperties - - // The provisioning state of a run. - ProvisioningState *ProvisioningState - - // The unique identifier for the run. - RunID *string - - // The type of run. - RunType *RunType - - // The scope of the credentials that were used to login to the source registry during this run. - SourceRegistryAuth *string - - // The source trigger that caused the run. - SourceTrigger *SourceTriggerDescriptor - - // The time the run started. - StartTime *time.Time - - // The current status of the run. - Status *RunStatus - - // The task against which run was scheduled. - Task *string - - // The timer trigger that caused the run. - TimerTrigger *TimerTriggerDescriptor - - // The update trigger token passed for the Run. - UpdateTriggerToken *string - - // READ-ONLY; The image description for the log artifact. - LogArtifact *ImageDescriptor - - // READ-ONLY; The error message received from backend systems after the run is scheduled. - RunErrorMessage *string -} - -// RunRequestClassification provides polymorphic access to related types. -// Call the interface's GetRunRequest() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *DockerBuildRequest, *EncodedTaskRunRequest, *FileTaskRunRequest, *RunRequest, *TaskRunRequest -type RunRequestClassification interface { - // GetRunRequest returns the RunRequest content of the underlying type. - GetRunRequest() *RunRequest -} - -// RunRequest - The request parameters for scheduling a run. -type RunRequest struct { - // REQUIRED; The type of the run request. - Type *string - - // The dedicated agent pool for the run. - AgentPoolName *string - - // The value that indicates whether archiving is enabled for the run or not. - IsArchiveEnabled *bool - - // The template that describes the repository and tag information for run log artifact. - LogTemplate *string -} - -// GetRunRequest implements the RunRequestClassification interface for type RunRequest. -func (r *RunRequest) GetRunRequest() *RunRequest { return r } - -// RunUpdateParameters - The set of run properties that can be updated. -type RunUpdateParameters struct { - // The value that indicates whether archiving is enabled or not. - IsArchiveEnabled *bool -} - -// RunsClientBeginCancelOptions contains the optional parameters for the RunsClient.BeginCancel method. -type RunsClientBeginCancelOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// RunsClientBeginUpdateOptions contains the optional parameters for the RunsClient.BeginUpdate method. -type RunsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// RunsClientGetLogSasURLOptions contains the optional parameters for the RunsClient.GetLogSasURL method. -type RunsClientGetLogSasURLOptions struct { - // placeholder for future optional parameters -} - -// RunsClientGetOptions contains the optional parameters for the RunsClient.Get method. -type RunsClientGetOptions struct { - // placeholder for future optional parameters -} - -// RunsClientListOptions contains the optional parameters for the RunsClient.NewListPager method. -type RunsClientListOptions struct { - // The runs filter to apply on the operation. Arithmetic operators are not supported. The allowed string function is 'contains'. - // All logical operators except 'Not', 'Has', 'All' are allowed. - Filter *string - // $top is supported for get list of runs, which limits the maximum number of runs to return. - Top *int32 -} - -// SKU - The SKU of a container registry. -type SKU struct { - // REQUIRED; The SKU name of the container registry. Required for registry creation. - Name *SKUName - - // READ-ONLY; The SKU tier based on the SKU name. - Tier *SKUTier -} - -// ScopeMap - An object that represents a scope map for a container registry. -type ScopeMap struct { - // The properties of the scope map. - Properties *ScopeMapProperties - - // 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 -} - -// ScopeMapListResult - The result of a request to list scope maps for a container registry. -type ScopeMapListResult struct { - // The URI that can be used to request the next list of scope maps. - NextLink *string - - // The list of scope maps. Since this list may be incomplete, the nextLink field should be used to request the next list of - // scope maps. - Value []*ScopeMap -} - -// ScopeMapProperties - The properties of a scope map. -type ScopeMapProperties struct { - // REQUIRED; The list of scoped permissions for registry artifacts. E.g. repositories/repository-name/content/read, repositories/repository-name/metadata/write - Actions []*string - - // The user friendly description of the scope map. - Description *string - - // READ-ONLY; The creation date of scope map. - CreationDate *time.Time - - // READ-ONLY; Provisioning state of the resource. - ProvisioningState *ProvisioningState - - // READ-ONLY; The type of the scope map. E.g. BuildIn scope map. - Type *string -} - -// ScopeMapPropertiesUpdateParameters - The update parameters for scope map properties. -type ScopeMapPropertiesUpdateParameters struct { - // The list of scope permissions for registry artifacts. E.g. repositories/repository-name/pull, repositories/repository-name/delete - Actions []*string - - // The user friendly description of the scope map. - Description *string -} - -// ScopeMapUpdateParameters - The properties for updating the scope map. -type ScopeMapUpdateParameters struct { - // The update parameters for scope map properties. - Properties *ScopeMapPropertiesUpdateParameters -} - -// ScopeMapsClientBeginCreateOptions contains the optional parameters for the ScopeMapsClient.BeginCreate method. -type ScopeMapsClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ScopeMapsClientBeginDeleteOptions contains the optional parameters for the ScopeMapsClient.BeginDelete method. -type ScopeMapsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ScopeMapsClientBeginUpdateOptions contains the optional parameters for the ScopeMapsClient.BeginUpdate method. -type ScopeMapsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ScopeMapsClientGetOptions contains the optional parameters for the ScopeMapsClient.Get method. -type ScopeMapsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ScopeMapsClientListOptions contains the optional parameters for the ScopeMapsClient.NewListPager method. -type ScopeMapsClientListOptions struct { - // placeholder for future optional parameters -} - -// SecretObject - Describes the properties of a secret object value. -type SecretObject struct { - // The type of the secret object which determines how the value of the secret object has to be interpreted. - Type *SecretObjectType - - // The value of the secret. The format of this value will be determined based on the type of the secret object. If the type - // is Opaque, the value will be used as is without any modification. - Value *string -} - -// SetValue - The properties of a overridable value that can be passed to a task template. -type SetValue struct { - // REQUIRED; The name of the overridable value. - Name *string - - // REQUIRED; The overridable value. - Value *string - - // Flag to indicate whether the value represents a secret or not. - IsSecret *bool -} - -// SoftDeletePolicy - The soft delete policy for a container registry -type SoftDeletePolicy struct { - // The number of days after which a soft-deleted item is permanently deleted. - RetentionDays *int32 - - // The value that indicates whether the policy is enabled or not. - Status *PolicyStatus - - // READ-ONLY; The timestamp when the policy was last updated. - LastUpdatedTime *time.Time -} - -// Source - The registry node that generated the event. Put differently, while the actor initiates the event, the source generates -// it. -type Source struct { - // The IP or hostname and the port of the registry node that generated the event. Generally, this will be resolved by os.Hostname() - // along with the running port. - Addr *string - - // The running instance of an application. Changes after each restart. - InstanceID *string -} - -// SourceProperties - The properties of the source code repository. -type SourceProperties struct { - // REQUIRED; The full URL to the source code repository - RepositoryURL *string - - // REQUIRED; The type of source control service. - SourceControlType *SourceControlType - - // The branch name of the source code. - Branch *string - - // The authorization properties for accessing the source code repository and to set up webhooks for notifications. - SourceControlAuthProperties *AuthInfo -} - -// SourceRegistryCredentials - Describes the credential parameters for accessing the source registry. -type SourceRegistryCredentials struct { - // The authentication mode which determines the source registry login scope. The credentials for the source registry will - // be generated using the given scope. These credentials will be used to login to - // the source registry during the run. - LoginMode *SourceRegistryLoginMode -} - -// SourceTrigger - The properties of a source based trigger. -type SourceTrigger struct { - // REQUIRED; The name of the trigger. - Name *string - - // REQUIRED; The properties that describes the source(code) for the task. - SourceRepository *SourceProperties - - // REQUIRED; The source event corresponding to the trigger. - SourceTriggerEvents []*SourceTriggerEvent - - // The current status of trigger. - Status *TriggerStatus -} - -// SourceTriggerDescriptor - The source trigger that caused a run. -type SourceTriggerDescriptor struct { - // The branch name in the repository. - BranchName *string - - // The unique ID that identifies a commit. - CommitID *string - - // The event type of the trigger. - EventType *string - - // The unique ID of the trigger. - ID *string - - // The source control provider type. - ProviderType *string - - // The unique ID that identifies pull request. - PullRequestID *string - - // The repository URL. - RepositoryURL *string -} - -// SourceTriggerUpdateParameters - The properties for updating a source based trigger. -type SourceTriggerUpdateParameters struct { - // REQUIRED; The name of the trigger. - Name *string - - // The properties that describes the source(code) for the task. - SourceRepository *SourceUpdateParameters - - // The source event corresponding to the trigger. - SourceTriggerEvents []*SourceTriggerEvent - - // The current status of trigger. - Status *TriggerStatus -} - -// SourceUpdateParameters - The properties for updating the source code repository. -type SourceUpdateParameters struct { - // The branch name of the source code. - Branch *string - - // The full URL to the source code repository - RepositoryURL *string - - // The authorization properties for accessing the source code repository and to set up webhooks for notifications. - SourceControlAuthProperties *AuthInfoUpdateParameters - - // The type of source control service. - SourceControlType *SourceControlType -} - -// SourceUploadDefinition - The properties of a response to source upload request. -type SourceUploadDefinition struct { - // The relative path to the source. This is used to submit the subsequent queue build request. - RelativePath *string - - // The URL where the client can upload the source. - UploadURL *string -} - -// Status - The status of an Azure resource at the time the operation was called. -type Status struct { - // READ-ONLY; The short label for the status. - DisplayStatus *string - - // READ-ONLY; The detailed message for the status, including alerts and error messages. - Message *string - - // READ-ONLY; The timestamp when the status was changed to the current value. - Timestamp *time.Time -} - -// StatusDetailProperties - The status detail properties of the connected registry. -type StatusDetailProperties struct { - // READ-ONLY; The code of the status. - Code *string - - // READ-ONLY; The correlation ID of the status. - CorrelationID *string - - // READ-ONLY; The description of the status. - Description *string - - // READ-ONLY; The timestamp of the status. - Timestamp *time.Time - - // READ-ONLY; The component of the connected registry corresponding to the status. - Type *string -} - -// StorageAccountProperties - The properties of a storage account for a container registry. Only applicable to Classic SKU. -type StorageAccountProperties struct { - // REQUIRED; The resource ID of the storage account. - ID *string -} - -// SyncProperties - The sync properties of the connected registry with its parent. -type SyncProperties struct { - // REQUIRED; The period of time for which a message is available to sync before it is expired. Specify the duration using - // the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. - MessageTTL *string - - // REQUIRED; The resource ID of the ACR token used to authenticate the connected registry to its parent during sync. - TokenID *string - - // The cron expression indicating the schedule that the connected registry will sync with its parent. - Schedule *string - - // The time window during which sync is enabled for each schedule occurrence. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S - // as per ISO8601. - SyncWindow *string - - // READ-ONLY; The gateway endpoint used by the connected registry to communicate with its parent. - GatewayEndpoint *string - - // READ-ONLY; The last time a sync occurred between the connected registry and its parent. - LastSyncTime *time.Time -} - -// SyncUpdateProperties - The parameters for updating the sync properties of the connected registry with its parent. -type SyncUpdateProperties struct { - // The period of time for which a message is available to sync before it is expired. Specify the duration using the format - // P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. - MessageTTL *string - - // The cron expression indicating the schedule that the connected registry will sync with its parent. - Schedule *string - - // The time window during which sync is enabled for each schedule occurrence. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S - // as per ISO8601. - SyncWindow *string -} - -// SystemData - Metadata pertaining to creation and last modification of the resource. -type SystemData struct { - // The timestamp of resource creation (UTC). - CreatedAt *time.Time - - // The identity that created the resource. - CreatedBy *string - - // The type of identity that created the resource. - CreatedByType *CreatedByType - - // The timestamp of resource modification (UTC). - LastModifiedAt *time.Time - - // The identity that last modified the resource. - LastModifiedBy *string - - // The type of identity that last modified the resource. - LastModifiedByType *LastModifiedByType -} - -// TLSCertificateProperties - The TLS certificate properties of the connected registry login server. -type TLSCertificateProperties struct { - // READ-ONLY; Indicates the location of the certificates. - Location *string - - // READ-ONLY; The type of certificate location. - Type *CertificateType -} - -// TLSProperties - The TLS properties of the connected registry login server. -type TLSProperties struct { - // READ-ONLY; The certificate used to configure HTTPS for the login server. - Certificate *TLSCertificateProperties - - // READ-ONLY; Indicates whether HTTPS is enabled for the login server. - Status *TLSStatus -} - -// Target - The target of the event. -type Target struct { - // The digest of the content, as defined by the Registry V2 HTTP API Specification. - Digest *string - - // The number of bytes of the content. Same as Size field. - Length *int64 - - // The MIME type of the referenced object. - MediaType *string - - // The name of the artifact. - Name *string - - // The repository name. - Repository *string - - // The number of bytes of the content. Same as Length field. - Size *int64 - - // The tag name. - Tag *string - - // The direct URL to the content. - URL *string - - // The version of the artifact. - Version *string -} - -// Task - The task that has the ARM resource and task properties. The task will have all information to schedule a run against -// it. -type Task struct { +type Replication struct { // REQUIRED; The location of the resource. This cannot be changed after the resource is created. Location *string - // Identity for the resource. - Identity *IdentityProperties - - // The properties of a task. - Properties *TaskProperties + // The properties of the replication. + Properties *ReplicationProperties // The tags of the resource. Tags map[string]*string @@ -2981,95 +1045,103 @@ type Task struct { Type *string } -// TaskListResult - The collection of tasks. -type TaskListResult struct { - // The URI that can be used to request the next set of paged results. +// ReplicationListResult - The result of a request to list replications for a container registry. +type ReplicationListResult struct { + // The URI that can be used to request the next list of replications. NextLink *string - // The collection value. - Value []*Task + // The list of replications. Since this list may be incomplete, the nextLink field should be used to request the next list + // of replications. + Value []*Replication } -// TaskProperties - The properties of a task. -type TaskProperties struct { - // The machine configuration of the run agent. - AgentConfiguration *AgentProperties - - // The dedicated agent pool for the task. - AgentPoolName *string - - // The properties that describes a set of credentials that will be used when this run is invoked. - Credentials *Credentials - - // The value of this property indicates whether the task resource is system task or not. - IsSystemTask *bool - - // The template that describes the repository and tag information for run log artifact. - LogTemplate *string +// ReplicationProperties - The properties of a replication. +type ReplicationProperties struct { + // Specifies whether the replication's regional endpoint is enabled. Requests will not be routed to a replication whose regional + // endpoint is disabled, however its data will continue to be synced with + // other replications. + RegionEndpointEnabled *bool - // The platform properties against which the run has to happen. - Platform *PlatformProperties + // Whether or not zone redundancy is enabled for this container registry replication + ZoneRedundancy *ZoneRedundancy - // The current status of task. - Status *TaskStatus + // READ-ONLY; The provisioning state of the replication at the time the operation was called. + ProvisioningState *ProvisioningState - // The properties of a task step. - Step TaskStepPropertiesClassification + // READ-ONLY; The status of the replication at the time the operation was called. + Status *Status +} - // Run timeout in seconds. - Timeout *int32 +// ReplicationUpdateParameters - The parameters for updating a replication. +type ReplicationUpdateParameters struct { + // The parameters for updating a replication's properties + Properties *ReplicationUpdateParametersProperties - // The properties that describe all triggers for the task. - Trigger *TriggerProperties + // The tags for the replication. + Tags map[string]*string +} - // READ-ONLY; The creation date of task. - CreationDate *time.Time +type ReplicationUpdateParametersProperties struct { + // Specifies whether the replication's regional endpoint is enabled. Requests will not be routed to a replication whose regional + // endpoint is disabled, however its data will continue to be synced with + // other replications. + RegionEndpointEnabled *bool +} - // READ-ONLY; The provisioning state of the task. - ProvisioningState *ProvisioningState +// ReplicationsClientBeginCreateOptions contains the optional parameters for the ReplicationsClient.BeginCreate method. +type ReplicationsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string } -// TaskPropertiesUpdateParameters - The properties for updating a task. -type TaskPropertiesUpdateParameters struct { - // The machine configuration of the run agent. - AgentConfiguration *AgentProperties +// ReplicationsClientBeginDeleteOptions contains the optional parameters for the ReplicationsClient.BeginDelete method. +type ReplicationsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} - // The dedicated agent pool for the task. - AgentPoolName *string +// ReplicationsClientBeginUpdateOptions contains the optional parameters for the ReplicationsClient.BeginUpdate method. +type ReplicationsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} - // The parameters that describes a set of credentials that will be used when this run is invoked. - Credentials *Credentials +// ReplicationsClientGetOptions contains the optional parameters for the ReplicationsClient.Get method. +type ReplicationsClientGetOptions struct { + // placeholder for future optional parameters +} - // The template that describes the repository and tag information for run log artifact. - LogTemplate *string +// ReplicationsClientListOptions contains the optional parameters for the ReplicationsClient.NewListPager method. +type ReplicationsClientListOptions struct { + // placeholder for future optional parameters +} - // The platform properties against which the run has to happen. - Platform *PlatformUpdateParameters +// Request - The request that generated the event. +type Request struct { + // The IP or hostname and possibly port of the client connection that initiated the event. This is the RemoteAddr from the + // standard http request. + Addr *string - // The current status of task. - Status *TaskStatus + // The externally accessible hostname of the registry instance, as specified by the http host header on incoming requests. + Host *string - // The properties for updating a task step. - Step TaskStepUpdateParametersClassification + // The ID of the request that initiated the event. + ID *string - // Run timeout in seconds. - Timeout *int32 + // The request method that generated the event. + Method *string - // The properties for updating trigger properties. - Trigger *TriggerUpdateParameters + // The user agent header of the request. + Useragent *string } -// TaskRun - The task run that has the ARM resource and properties. The task run will have the information of request and -// result of a run. -type TaskRun struct { - // Identity for the resource. - Identity *IdentityProperties - - // The location of the resource +// Resource - An Azure resource. +type Resource struct { + // REQUIRED; The location of the resource. This cannot be changed after the resource is created. Location *string - // The properties associated with the task run, i.e., request and result of the run - Properties *TaskRunProperties + // The tags of the resource. + Tags map[string]*string // READ-ONLY; The resource ID. ID *string @@ -3084,244 +1156,194 @@ type TaskRun struct { Type *string } -// TaskRunListResult - The collection of task runs. -type TaskRunListResult struct { - // The URI that can be used to request the next set of paged results. - NextLink *string +// RetentionPolicy - The retention policy for a container registry. +type RetentionPolicy struct { + // The number of days to retain an untagged manifest after which it gets purged. + Days *int32 + + // The value that indicates whether the policy is enabled or not. + Status *PolicyStatus - // The collection value. - Value []*TaskRun + // READ-ONLY; The timestamp when the policy was last updated. + LastUpdatedTime *time.Time } -// TaskRunProperties - The properties of task run. -type TaskRunProperties struct { - // How the run should be forced to rerun even if the run request configuration has not changed - ForceUpdateTag *string +// SKU - The SKU of a container registry. +type SKU struct { + // REQUIRED; The SKU name of the container registry. Required for registry creation. + Name *SKUName + + // READ-ONLY; The SKU tier based on the SKU name. + Tier *SKUTier +} - // The request (parameters) for the run - RunRequest RunRequestClassification +// ScopeMap - An object that represents a scope map for a container registry. +type ScopeMap struct { + // The properties of the scope map. + Properties *ScopeMapProperties - // READ-ONLY; The provisioning state of this task run - ProvisioningState *ProvisioningState + // READ-ONLY; The resource ID. + ID *string - // READ-ONLY; The result of this task run - RunResult *Run -} + // READ-ONLY; The name of the resource. + Name *string -// TaskRunPropertiesUpdateParameters - The properties of a task run update parameters. -type TaskRunPropertiesUpdateParameters struct { - // How the run should be forced to rerun even if the run request configuration has not changed - ForceUpdateTag *string + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData - // The request (parameters) for the new run - RunRequest RunRequestClassification + // READ-ONLY; The type of the resource. + Type *string } -// TaskRunRequest - The parameters for a task run request. -type TaskRunRequest struct { - // REQUIRED; The resource ID of task against which run has to be queued. - TaskID *string +// ScopeMapListResult - The result of a request to list scope maps for a container registry. +type ScopeMapListResult struct { + // The URI that can be used to request the next list of scope maps. + NextLink *string - // REQUIRED; The type of the run request. - Type *string + // The list of scope maps. Since this list may be incomplete, the nextLink field should be used to request the next list of + // scope maps. + Value []*ScopeMap +} - // The dedicated agent pool for the run. - AgentPoolName *string +// ScopeMapProperties - The properties of a scope map. +type ScopeMapProperties struct { + // REQUIRED; The list of scoped permissions for registry artifacts. E.g. repositories/repository-name/content/read, repositories/repository-name/metadata/write + Actions []*string - // The value that indicates whether archiving is enabled for the run or not. - IsArchiveEnabled *bool + // The user friendly description of the scope map. + Description *string - // The template that describes the repository and tag information for run log artifact. - LogTemplate *string + // READ-ONLY; The creation date of scope map. + CreationDate *time.Time - // Set of overridable parameters that can be passed when running a Task. - OverrideTaskStepProperties *OverrideTaskStepProperties -} + // READ-ONLY; Provisioning state of the resource. + ProvisioningState *ProvisioningState -// GetRunRequest implements the RunRequestClassification interface for type TaskRunRequest. -func (t *TaskRunRequest) GetRunRequest() *RunRequest { - return &RunRequest{ - Type: t.Type, - IsArchiveEnabled: t.IsArchiveEnabled, - AgentPoolName: t.AgentPoolName, - LogTemplate: t.LogTemplate, - } + // READ-ONLY; The type of the scope map. E.g. BuildIn scope map. + Type *string } -// TaskRunUpdateParameters - The parameters for updating a task run. -type TaskRunUpdateParameters struct { - // Identity for the resource. - Identity *IdentityProperties - - // The location of the resource - Location *string +// ScopeMapPropertiesUpdateParameters - The update parameters for scope map properties. +type ScopeMapPropertiesUpdateParameters struct { + // The list of scope permissions for registry artifacts. E.g. repositories/repository-name/pull, repositories/repository-name/delete + Actions []*string - // The properties for updating a task run. - Properties *TaskRunPropertiesUpdateParameters + // The user friendly description of the scope map. + Description *string +} - // The ARM resource tags. - Tags map[string]*string +// ScopeMapUpdateParameters - The properties for updating the scope map. +type ScopeMapUpdateParameters struct { + // The update parameters for scope map properties. + Properties *ScopeMapPropertiesUpdateParameters } -// TaskRunsClientBeginCreateOptions contains the optional parameters for the TaskRunsClient.BeginCreate method. -type TaskRunsClientBeginCreateOptions struct { +// ScopeMapsClientBeginCreateOptions contains the optional parameters for the ScopeMapsClient.BeginCreate method. +type ScopeMapsClientBeginCreateOptions struct { // Resumes the LRO from the provided token. ResumeToken string } -// TaskRunsClientBeginDeleteOptions contains the optional parameters for the TaskRunsClient.BeginDelete method. -type TaskRunsClientBeginDeleteOptions struct { +// ScopeMapsClientBeginDeleteOptions contains the optional parameters for the ScopeMapsClient.BeginDelete method. +type ScopeMapsClientBeginDeleteOptions struct { // Resumes the LRO from the provided token. ResumeToken string } -// TaskRunsClientBeginUpdateOptions contains the optional parameters for the TaskRunsClient.BeginUpdate method. -type TaskRunsClientBeginUpdateOptions struct { +// ScopeMapsClientBeginUpdateOptions contains the optional parameters for the ScopeMapsClient.BeginUpdate method. +type ScopeMapsClientBeginUpdateOptions struct { // Resumes the LRO from the provided token. ResumeToken string } -// TaskRunsClientGetDetailsOptions contains the optional parameters for the TaskRunsClient.GetDetails method. -type TaskRunsClientGetDetailsOptions struct { +// ScopeMapsClientGetOptions contains the optional parameters for the ScopeMapsClient.Get method. +type ScopeMapsClientGetOptions struct { // placeholder for future optional parameters } -// TaskRunsClientGetOptions contains the optional parameters for the TaskRunsClient.Get method. -type TaskRunsClientGetOptions struct { +// ScopeMapsClientListOptions contains the optional parameters for the ScopeMapsClient.NewListPager method. +type ScopeMapsClientListOptions struct { // placeholder for future optional parameters } -// TaskRunsClientListOptions contains the optional parameters for the TaskRunsClient.NewListPager method. -type TaskRunsClientListOptions struct { - // placeholder for future optional parameters -} +// Source - The registry node that generated the event. Put differently, while the actor initiates the event, the source generates +// it. +type Source struct { + // The IP or hostname and the port of the registry node that generated the event. Generally, this will be resolved by os.Hostname() + // along with the running port. + Addr *string -// TaskStepPropertiesClassification provides polymorphic access to related types. -// Call the interface's GetTaskStepProperties() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *DockerBuildStep, *EncodedTaskStep, *FileTaskStep, *TaskStepProperties -type TaskStepPropertiesClassification interface { - // GetTaskStepProperties returns the TaskStepProperties content of the underlying type. - GetTaskStepProperties() *TaskStepProperties + // The running instance of an application. Changes after each restart. + InstanceID *string } -// TaskStepProperties - Base properties for any task step. -type TaskStepProperties struct { - // REQUIRED; The type of the step. - Type *StepType - - // The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string - - // The URL(absolute or relative) of the source context for the task step. - ContextPath *string - - // READ-ONLY; List of base image dependencies for a step. - BaseImageDependencies []*BaseImageDependency -} +// Status - The status of an Azure resource at the time the operation was called. +type Status struct { + // READ-ONLY; The short label for the status. + DisplayStatus *string -// GetTaskStepProperties implements the TaskStepPropertiesClassification interface for type TaskStepProperties. -func (t *TaskStepProperties) GetTaskStepProperties() *TaskStepProperties { return t } + // READ-ONLY; The detailed message for the status, including alerts and error messages. + Message *string -// TaskStepUpdateParametersClassification provides polymorphic access to related types. -// Call the interface's GetTaskStepUpdateParameters() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *DockerBuildStepUpdateParameters, *EncodedTaskStepUpdateParameters, *FileTaskStepUpdateParameters, *TaskStepUpdateParameters -type TaskStepUpdateParametersClassification interface { - // GetTaskStepUpdateParameters returns the TaskStepUpdateParameters content of the underlying type. - GetTaskStepUpdateParameters() *TaskStepUpdateParameters + // READ-ONLY; The timestamp when the status was changed to the current value. + Timestamp *time.Time } -// TaskStepUpdateParameters - Base properties for updating any task step. -type TaskStepUpdateParameters struct { - // REQUIRED; The type of the step. - Type *StepType - - // The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string - - // The URL(absolute or relative) of the source context for the task step. - ContextPath *string +// StorageAccountProperties - The properties of a storage account for a container registry. Only applicable to Classic SKU. +type StorageAccountProperties struct { + // REQUIRED; The resource ID of the storage account. + ID *string } -// GetTaskStepUpdateParameters implements the TaskStepUpdateParametersClassification interface for type TaskStepUpdateParameters. -func (t *TaskStepUpdateParameters) GetTaskStepUpdateParameters() *TaskStepUpdateParameters { return t } - -// TaskUpdateParameters - The parameters for updating a task. -type TaskUpdateParameters struct { - // Identity for the resource. - Identity *IdentityProperties +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time - // The properties for updating a task. - Properties *TaskPropertiesUpdateParameters + // The identity that created the resource. + CreatedBy *string - // The ARM resource tags. - Tags map[string]*string -} + // The type of identity that created the resource. + CreatedByType *CreatedByType -// TasksClientBeginCreateOptions contains the optional parameters for the TasksClient.BeginCreate method. -type TasksClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} + // The timestamp of resource modification (UTC). + LastModifiedAt *time.Time -// TasksClientBeginDeleteOptions contains the optional parameters for the TasksClient.BeginDelete method. -type TasksClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} + // The identity that last modified the resource. + LastModifiedBy *string -// TasksClientBeginUpdateOptions contains the optional parameters for the TasksClient.BeginUpdate method. -type TasksClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string + // The type of identity that last modified the resource. + LastModifiedByType *LastModifiedByType } -// TasksClientGetDetailsOptions contains the optional parameters for the TasksClient.GetDetails method. -type TasksClientGetDetailsOptions struct { - // placeholder for future optional parameters -} +// Target - The target of the event. +type Target struct { + // The digest of the content, as defined by the Registry V2 HTTP API Specification. + Digest *string -// TasksClientGetOptions contains the optional parameters for the TasksClient.Get method. -type TasksClientGetOptions struct { - // placeholder for future optional parameters -} + // The number of bytes of the content. Same as Size field. + Length *int64 -// TasksClientListOptions contains the optional parameters for the TasksClient.NewListPager method. -type TasksClientListOptions struct { - // placeholder for future optional parameters -} + // The MIME type of the referenced object. + MediaType *string -// TimerTrigger - The properties of a timer trigger. -type TimerTrigger struct { - // REQUIRED; The name of the trigger. + // The name of the artifact. Name *string - // REQUIRED; The CRON expression for the task schedule - Schedule *string - - // The current status of trigger. - Status *TriggerStatus -} - -type TimerTriggerDescriptor struct { - // The occurrence that triggered the run. - ScheduleOccurrence *string + // The repository name. + Repository *string - // The timer trigger name that caused the run. - TimerTriggerName *string -} + // The number of bytes of the content. Same as Length field. + Size *int64 -// TimerTriggerUpdateParameters - The properties for updating a timer trigger. -type TimerTriggerUpdateParameters struct { - // REQUIRED; The name of the trigger. - Name *string + // The tag name. + Tag *string - // The CRON expression for the task schedule - Schedule *string + // The direct URL to the content. + URL *string - // The current status of trigger. - Status *TriggerStatus + // The version of the artifact. + Version *string } // Token - An object that represents a token for a container registry. @@ -3449,30 +1471,6 @@ type TokensClientListOptions struct { // placeholder for future optional parameters } -// TriggerProperties - The properties of a trigger. -type TriggerProperties struct { - // The trigger based on base image dependencies. - BaseImageTrigger *BaseImageTrigger - - // The collection of triggers based on source code repository. - SourceTriggers []*SourceTrigger - - // The collection of timer triggers. - TimerTriggers []*TimerTrigger -} - -// TriggerUpdateParameters - The properties for updating triggers. -type TriggerUpdateParameters struct { - // The trigger based on base image dependencies. - BaseImageTrigger *BaseImageTriggerUpdateParameters - - // The collection of triggers based on source code repository. - SourceTriggers []*SourceTriggerUpdateParameters - - // The collection of timer triggers. - TimerTriggers []*TimerTriggerUpdateParameters -} - // TrustPolicy - The content trust policy for a container registry. type TrustPolicy struct { // The value that indicates whether the policy is enabled or not. @@ -3483,10 +1481,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..e6de9e0dbed3 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/models_serde.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/models_serde.go @@ -15,33 +15,6 @@ import ( "reflect" ) -// MarshalJSON implements the json.Marshaller interface for type ActivationProperties. -func (a ActivationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "status", a.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ActivationProperties. -func (a *ActivationProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "status": - err = unpopulate(val, "Status", &a.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type ActiveDirectoryObject. func (a ActiveDirectoryObject) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -100,21 +73,18 @@ func (a *Actor) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AgentPool. -func (a AgentPool) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AuthCredential. +func (a AuthCredential) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", a.ID) - populate(objectMap, "location", a.Location) + populate(objectMap, "credentialHealth", a.CredentialHealth) populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - populate(objectMap, "tags", a.Tags) - populate(objectMap, "type", a.Type) + populate(objectMap, "passwordSecretIdentifier", a.PasswordSecretIdentifier) + populate(objectMap, "usernameSecretIdentifier", a.UsernameSecretIdentifier) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPool. -func (a *AgentPool) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthCredential. +func (a *AuthCredential) 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) @@ -122,26 +92,17 @@ func (a *AgentPool) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &a.Location) + case "credentialHealth": + err = unpopulate(val, "CredentialHealth", &a.CredentialHealth) 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 "tags": - err = unpopulate(val, "Tags", &a.Tags) + case "passwordSecretIdentifier": + err = unpopulate(val, "PasswordSecretIdentifier", &a.PasswordSecretIdentifier) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) + case "usernameSecretIdentifier": + err = unpopulate(val, "UsernameSecretIdentifier", &a.UsernameSecretIdentifier) delete(rawMsg, key) } if err != nil { @@ -151,6860 +112,2938 @@ func (a *AgentPool) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AgentPoolListResult. -func (a AgentPoolListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CacheRule. +func (c CacheRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolListResult. -func (a *AgentPoolListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CacheRule. +func (c *CacheRule) 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) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &a.NextLink) + case "id": + err = unpopulate(val, "ID", &c.ID) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &a.Value) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AgentPoolProperties. -func (a AgentPoolProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CacheRuleProperties. +func (c CacheRuleProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", a.Count) - populate(objectMap, "os", a.OS) - populate(objectMap, "provisioningState", a.ProvisioningState) - populate(objectMap, "tier", a.Tier) - populate(objectMap, "virtualNetworkSubnetResourceId", a.VirtualNetworkSubnetResourceID) + populateTimeRFC3339(objectMap, "creationDate", c.CreationDate) + populate(objectMap, "credentialSetResourceId", c.CredentialSetResourceID) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "sourceRepository", c.SourceRepository) + populate(objectMap, "targetRepository", c.TargetRepository) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolProperties. -func (a *AgentPoolProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CacheRuleProperties. +func (c *CacheRuleProperties) 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) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "count": - err = unpopulate(val, "Count", &a.Count) + case "creationDate": + err = unpopulateTimeRFC3339(val, "CreationDate", &c.CreationDate) delete(rawMsg, key) - case "os": - err = unpopulate(val, "OS", &a.OS) + case "credentialSetResourceId": + err = unpopulate(val, "CredentialSetResourceID", &c.CredentialSetResourceID) delete(rawMsg, key) case "provisioningState": - err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) delete(rawMsg, key) - case "tier": - err = unpopulate(val, "Tier", &a.Tier) + case "sourceRepository": + err = unpopulate(val, "SourceRepository", &c.SourceRepository) delete(rawMsg, key) - case "virtualNetworkSubnetResourceId": - err = unpopulate(val, "VirtualNetworkSubnetResourceID", &a.VirtualNetworkSubnetResourceID) + case "targetRepository": + err = unpopulate(val, "TargetRepository", &c.TargetRepository) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AgentPoolPropertiesUpdateParameters. -func (a AgentPoolPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CacheRuleUpdateParameters. +func (c CacheRuleUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", a.Count) + populate(objectMap, "properties", c.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolPropertiesUpdateParameters. -func (a *AgentPoolPropertiesUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CacheRuleUpdateParameters. +func (c *CacheRuleUpdateParameters) 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) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "count": - err = unpopulate(val, "Count", &a.Count) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AgentPoolQueueStatus. -func (a AgentPoolQueueStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CacheRuleUpdateProperties. +func (c CacheRuleUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "count", a.Count) + populate(objectMap, "credentialSetResourceId", c.CredentialSetResourceID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolQueueStatus. -func (a *AgentPoolQueueStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CacheRuleUpdateProperties. +func (c *CacheRuleUpdateProperties) 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) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "count": - err = unpopulate(val, "Count", &a.Count) + case "credentialSetResourceId": + err = unpopulate(val, "CredentialSetResourceID", &c.CredentialSetResourceID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AgentPoolUpdateParameters. -func (a AgentPoolUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CacheRulesListResult. +func (c CacheRulesListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AgentPoolUpdateParameters. -func (a *AgentPoolUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CacheRulesListResult. +func (c *CacheRulesListResult) 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) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &a.Properties) + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &a.Tags) + case "value": + err = unpopulate(val, "Value", &c.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AgentProperties. -func (a AgentProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CallbackConfig. +func (c CallbackConfig) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "cpu", a.CPU) + populate(objectMap, "customHeaders", c.CustomHeaders) + populate(objectMap, "serviceUri", c.ServiceURI) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AgentProperties. -func (a *AgentProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CallbackConfig. +func (c *CallbackConfig) 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) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "cpu": - err = unpopulate(val, "CPU", &a.CPU) + case "customHeaders": + err = unpopulate(val, "CustomHeaders", &c.CustomHeaders) + delete(rawMsg, key) + case "serviceUri": + err = unpopulate(val, "ServiceURI", &c.ServiceURI) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Argument. -func (a Argument) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CredentialHealth. +func (c CredentialHealth) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "isSecret", a.IsSecret) - populate(objectMap, "name", a.Name) - populate(objectMap, "value", a.Value) + populate(objectMap, "errorCode", c.ErrorCode) + populate(objectMap, "errorMessage", c.ErrorMessage) + populate(objectMap, "status", c.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Argument. -func (a *Argument) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CredentialHealth. +func (c *CredentialHealth) 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) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "isSecret": - err = unpopulate(val, "IsSecret", &a.IsSecret) + case "errorCode": + err = unpopulate(val, "ErrorCode", &c.ErrorCode) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &c.ErrorMessage) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &a.Value) + case "status": + err = unpopulate(val, "Status", &c.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AuthCredential. -func (a AuthCredential) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CredentialSet. +func (c CredentialSet) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "credentialHealth", a.CredentialHealth) - populate(objectMap, "name", a.Name) - populate(objectMap, "passwordSecretIdentifier", a.PasswordSecretIdentifier) - populate(objectMap, "usernameSecretIdentifier", a.UsernameSecretIdentifier) + populate(objectMap, "id", c.ID) + populate(objectMap, "identity", c.Identity) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AuthCredential. -func (a *AuthCredential) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CredentialSet. +func (c *CredentialSet) 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) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "credentialHealth": - err = unpopulate(val, "CredentialHealth", &a.CredentialHealth) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &c.Identity) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &a.Name) + err = unpopulate(val, "Name", &c.Name) delete(rawMsg, key) - case "passwordSecretIdentifier": - err = unpopulate(val, "PasswordSecretIdentifier", &a.PasswordSecretIdentifier) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) delete(rawMsg, key) - case "usernameSecretIdentifier": - err = unpopulate(val, "UsernameSecretIdentifier", &a.UsernameSecretIdentifier) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AuthInfo. -func (a AuthInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CredentialSetListResult. +func (c CredentialSetListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "expiresIn", a.ExpiresIn) - populate(objectMap, "refreshToken", a.RefreshToken) - populate(objectMap, "scope", a.Scope) - populate(objectMap, "token", a.Token) - populate(objectMap, "tokenType", a.TokenType) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AuthInfo. -func (a *AuthInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CredentialSetListResult. +func (c *CredentialSetListResult) 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) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "expiresIn": - err = unpopulate(val, "ExpiresIn", &a.ExpiresIn) - delete(rawMsg, key) - case "refreshToken": - err = unpopulate(val, "RefreshToken", &a.RefreshToken) - delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &a.Scope) - delete(rawMsg, key) - case "token": - err = unpopulate(val, "Token", &a.Token) + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) delete(rawMsg, key) - case "tokenType": - err = unpopulate(val, "TokenType", &a.TokenType) + case "value": + err = unpopulate(val, "Value", &c.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AuthInfoUpdateParameters. -func (a AuthInfoUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CredentialSetProperties. +func (c CredentialSetProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "expiresIn", a.ExpiresIn) - populate(objectMap, "refreshToken", a.RefreshToken) - populate(objectMap, "scope", a.Scope) - populate(objectMap, "token", a.Token) - populate(objectMap, "tokenType", a.TokenType) + populate(objectMap, "authCredentials", c.AuthCredentials) + populateTimeRFC3339(objectMap, "creationDate", c.CreationDate) + populate(objectMap, "loginServer", c.LoginServer) + populate(objectMap, "provisioningState", c.ProvisioningState) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AuthInfoUpdateParameters. -func (a *AuthInfoUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CredentialSetProperties. +func (c *CredentialSetProperties) 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) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "expiresIn": - err = unpopulate(val, "ExpiresIn", &a.ExpiresIn) - delete(rawMsg, key) - case "refreshToken": - err = unpopulate(val, "RefreshToken", &a.RefreshToken) + case "authCredentials": + err = unpopulate(val, "AuthCredentials", &c.AuthCredentials) delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &a.Scope) + case "creationDate": + err = unpopulateTimeRFC3339(val, "CreationDate", &c.CreationDate) delete(rawMsg, key) - case "token": - err = unpopulate(val, "Token", &a.Token) + case "loginServer": + err = unpopulate(val, "LoginServer", &c.LoginServer) delete(rawMsg, key) - case "tokenType": - err = unpopulate(val, "TokenType", &a.TokenType) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureADAuthenticationAsArmPolicy. -func (a AzureADAuthenticationAsArmPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CredentialSetUpdateParameters. +func (c CredentialSetUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "status", a.Status) + populate(objectMap, "identity", c.Identity) + populate(objectMap, "properties", c.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureADAuthenticationAsArmPolicy. -func (a *AzureADAuthenticationAsArmPolicy) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CredentialSetUpdateParameters. +func (c *CredentialSetUpdateParameters) 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) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "status": - err = unpopulate(val, "Status", &a.Status) + case "identity": + err = unpopulate(val, "Identity", &c.Identity) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type BaseImageDependency. -func (b BaseImageDependency) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CredentialSetUpdateProperties. +func (c CredentialSetUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "digest", b.Digest) - populate(objectMap, "registry", b.Registry) - populate(objectMap, "repository", b.Repository) - populate(objectMap, "tag", b.Tag) - populate(objectMap, "type", b.Type) + populate(objectMap, "authCredentials", c.AuthCredentials) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type BaseImageDependency. -func (b *BaseImageDependency) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CredentialSetUpdateProperties. +func (c *CredentialSetUpdateProperties) 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", b, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "digest": - err = unpopulate(val, "Digest", &b.Digest) - delete(rawMsg, key) - case "registry": - err = unpopulate(val, "Registry", &b.Registry) - delete(rawMsg, key) - case "repository": - err = unpopulate(val, "Repository", &b.Repository) - delete(rawMsg, key) - case "tag": - err = unpopulate(val, "Tag", &b.Tag) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &b.Type) + case "authCredentials": + err = unpopulate(val, "AuthCredentials", &c.AuthCredentials) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type BaseImageTrigger. -func (b BaseImageTrigger) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EncryptionProperty. +func (e EncryptionProperty) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "baseImageTriggerType", b.BaseImageTriggerType) - populate(objectMap, "name", b.Name) - populate(objectMap, "status", b.Status) - populate(objectMap, "updateTriggerEndpoint", b.UpdateTriggerEndpoint) - populate(objectMap, "updateTriggerPayloadType", b.UpdateTriggerPayloadType) + populate(objectMap, "keyVaultProperties", e.KeyVaultProperties) + populate(objectMap, "status", e.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type BaseImageTrigger. -func (b *BaseImageTrigger) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionProperty. +func (e *EncryptionProperty) 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", b, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "baseImageTriggerType": - err = unpopulate(val, "BaseImageTriggerType", &b.BaseImageTriggerType) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &b.Name) + case "keyVaultProperties": + err = unpopulate(val, "KeyVaultProperties", &e.KeyVaultProperties) delete(rawMsg, key) case "status": - err = unpopulate(val, "Status", &b.Status) - delete(rawMsg, key) - case "updateTriggerEndpoint": - err = unpopulate(val, "UpdateTriggerEndpoint", &b.UpdateTriggerEndpoint) - delete(rawMsg, key) - case "updateTriggerPayloadType": - err = unpopulate(val, "UpdateTriggerPayloadType", &b.UpdateTriggerPayloadType) + err = unpopulate(val, "Status", &e.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type BaseImageTriggerUpdateParameters. -func (b BaseImageTriggerUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "baseImageTriggerType", b.BaseImageTriggerType) - populate(objectMap, "name", b.Name) - populate(objectMap, "status", b.Status) - populate(objectMap, "updateTriggerEndpoint", b.UpdateTriggerEndpoint) - populate(objectMap, "updateTriggerPayloadType", b.UpdateTriggerPayloadType) + populate(objectMap, "error", e.Error) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type BaseImageTriggerUpdateParameters. -func (b *BaseImageTriggerUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "baseImageTriggerType": - err = unpopulate(val, "BaseImageTriggerType", &b.BaseImageTriggerType) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &b.Name) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &b.Status) - delete(rawMsg, key) - case "updateTriggerEndpoint": - err = unpopulate(val, "UpdateTriggerEndpoint", &b.UpdateTriggerEndpoint) - delete(rawMsg, key) - case "updateTriggerPayloadType": - err = unpopulate(val, "UpdateTriggerPayloadType", &b.UpdateTriggerPayloadType) + case "error": + err = unpopulate(val, "Error", &e.Error) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CacheRule. -func (c CacheRule) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseBody. +func (e ErrorResponseBody) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", c.ID) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "systemData", c.SystemData) - populate(objectMap, "type", c.Type) + 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 CacheRule. -func (c *CacheRule) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseBody. +func (e *ErrorResponseBody) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &c.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &c.Name) + case "code": + err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &c.Properties) + case "details": + err = unpopulate(val, "Details", &e.Details) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &c.SystemData) + case "message": + err = unpopulate(val, "Message", &e.Message) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) + case "target": + err = unpopulate(val, "Target", &e.Target) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CacheRuleProperties. -func (c CacheRuleProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Event. +func (e Event) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "creationDate", c.CreationDate) - populate(objectMap, "credentialSetResourceId", c.CredentialSetResourceID) - populate(objectMap, "provisioningState", c.ProvisioningState) - populate(objectMap, "sourceRepository", c.SourceRepository) - populate(objectMap, "targetRepository", c.TargetRepository) + populate(objectMap, "eventRequestMessage", e.EventRequestMessage) + populate(objectMap, "eventResponseMessage", e.EventResponseMessage) + populate(objectMap, "id", e.ID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CacheRuleProperties. -func (c *CacheRuleProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Event. +func (e *Event) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "creationDate": - err = unpopulateTimeRFC3339(val, "CreationDate", &c.CreationDate) - delete(rawMsg, key) - case "credentialSetResourceId": - err = unpopulate(val, "CredentialSetResourceID", &c.CredentialSetResourceID) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + case "eventRequestMessage": + err = unpopulate(val, "EventRequestMessage", &e.EventRequestMessage) delete(rawMsg, key) - case "sourceRepository": - err = unpopulate(val, "SourceRepository", &c.SourceRepository) + case "eventResponseMessage": + err = unpopulate(val, "EventResponseMessage", &e.EventResponseMessage) delete(rawMsg, key) - case "targetRepository": - err = unpopulate(val, "TargetRepository", &c.TargetRepository) + case "id": + err = unpopulate(val, "ID", &e.ID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CacheRuleUpdateParameters. -func (c CacheRuleUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EventContent. +func (e EventContent) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", c.Properties) + populate(objectMap, "action", e.Action) + populate(objectMap, "actor", e.Actor) + populate(objectMap, "id", e.ID) + populate(objectMap, "request", e.Request) + populate(objectMap, "source", e.Source) + populate(objectMap, "target", e.Target) + populateTimeRFC3339(objectMap, "timestamp", e.Timestamp) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CacheRuleUpdateParameters. -func (c *CacheRuleUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EventContent. +func (e *EventContent) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &c.Properties) + case "action": + err = unpopulate(val, "Action", &e.Action) + delete(rawMsg, key) + case "actor": + err = unpopulate(val, "Actor", &e.Actor) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "request": + err = unpopulate(val, "Request", &e.Request) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &e.Source) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + case "timestamp": + err = unpopulateTimeRFC3339(val, "Timestamp", &e.Timestamp) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CacheRuleUpdateProperties. -func (c CacheRuleUpdateProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EventInfo. +func (e EventInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "credentialSetResourceId", c.CredentialSetResourceID) + populate(objectMap, "id", e.ID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CacheRuleUpdateProperties. -func (c *CacheRuleUpdateProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EventInfo. +func (e *EventInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "credentialSetResourceId": - err = unpopulate(val, "CredentialSetResourceID", &c.CredentialSetResourceID) + case "id": + err = unpopulate(val, "ID", &e.ID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CacheRulesListResult. -func (c CacheRulesListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EventListResult. +func (e EventListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", c.NextLink) - populate(objectMap, "value", c.Value) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CacheRulesListResult. -func (c *CacheRulesListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EventListResult. +func (e *EventListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": - err = unpopulate(val, "NextLink", &c.NextLink) + err = unpopulate(val, "NextLink", &e.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &c.Value) + err = unpopulate(val, "Value", &e.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CallbackConfig. -func (c CallbackConfig) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EventRequestMessage. +func (e EventRequestMessage) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "customHeaders", c.CustomHeaders) - populate(objectMap, "serviceUri", c.ServiceURI) + populate(objectMap, "content", e.Content) + populate(objectMap, "headers", e.Headers) + populate(objectMap, "method", e.Method) + populate(objectMap, "requestUri", e.RequestURI) + populate(objectMap, "version", e.Version) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CallbackConfig. -func (c *CallbackConfig) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EventRequestMessage. +func (e *EventRequestMessage) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "customHeaders": - err = unpopulate(val, "CustomHeaders", &c.CustomHeaders) + case "content": + err = unpopulate(val, "Content", &e.Content) delete(rawMsg, key) - case "serviceUri": - err = unpopulate(val, "ServiceURI", &c.ServiceURI) + case "headers": + err = unpopulate(val, "Headers", &e.Headers) + delete(rawMsg, key) + case "method": + err = unpopulate(val, "Method", &e.Method) + delete(rawMsg, key) + case "requestUri": + err = unpopulate(val, "RequestURI", &e.RequestURI) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &e.Version) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ConnectedRegistry. -func (c ConnectedRegistry) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EventResponseMessage. +func (e EventResponseMessage) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", c.ID) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "systemData", c.SystemData) - populate(objectMap, "type", c.Type) + populate(objectMap, "content", e.Content) + populate(objectMap, "headers", e.Headers) + populate(objectMap, "reasonPhrase", e.ReasonPhrase) + populate(objectMap, "statusCode", e.StatusCode) + populate(objectMap, "version", e.Version) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedRegistry. -func (c *ConnectedRegistry) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EventResponseMessage. +func (e *EventResponseMessage) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &c.ID) + case "content": + err = unpopulate(val, "Content", &e.Content) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &c.Name) + case "headers": + err = unpopulate(val, "Headers", &e.Headers) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &c.Properties) + case "reasonPhrase": + err = unpopulate(val, "ReasonPhrase", &e.ReasonPhrase) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &c.SystemData) + case "statusCode": + err = unpopulate(val, "StatusCode", &e.StatusCode) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) + case "version": + err = unpopulate(val, "Version", &e.Version) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ConnectedRegistryListResult. -func (c ConnectedRegistryListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExportPolicy. +func (e ExportPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", c.NextLink) - populate(objectMap, "value", c.Value) + populate(objectMap, "status", e.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedRegistryListResult. -func (c *ConnectedRegistryListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportPolicy. +func (e *ExportPolicy) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &c.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &c.Value) + case "status": + err = unpopulate(val, "Status", &e.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ConnectedRegistryProperties. -func (c ConnectedRegistryProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GenerateCredentialsParameters. +func (g GenerateCredentialsParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "activation", c.Activation) - populate(objectMap, "clientTokenIds", c.ClientTokenIDs) - populate(objectMap, "connectionState", c.ConnectionState) - populateTimeRFC3339(objectMap, "lastActivityTime", c.LastActivityTime) - populate(objectMap, "logging", c.Logging) - populate(objectMap, "loginServer", c.LoginServer) - populate(objectMap, "mode", c.Mode) - populate(objectMap, "notificationsList", c.NotificationsList) - populate(objectMap, "parent", c.Parent) - populate(objectMap, "provisioningState", c.ProvisioningState) - populate(objectMap, "statusDetails", c.StatusDetails) - populate(objectMap, "version", c.Version) + populateTimeRFC3339(objectMap, "expiry", g.Expiry) + populate(objectMap, "name", g.Name) + populate(objectMap, "tokenId", g.TokenID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedRegistryProperties. -func (c *ConnectedRegistryProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GenerateCredentialsParameters. +func (g *GenerateCredentialsParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "activation": - err = unpopulate(val, "Activation", &c.Activation) - delete(rawMsg, key) - case "clientTokenIds": - err = unpopulate(val, "ClientTokenIDs", &c.ClientTokenIDs) - delete(rawMsg, key) - case "connectionState": - err = unpopulate(val, "ConnectionState", &c.ConnectionState) - delete(rawMsg, key) - case "lastActivityTime": - err = unpopulateTimeRFC3339(val, "LastActivityTime", &c.LastActivityTime) - delete(rawMsg, key) - case "logging": - err = unpopulate(val, "Logging", &c.Logging) - delete(rawMsg, key) - case "loginServer": - err = unpopulate(val, "LoginServer", &c.LoginServer) - delete(rawMsg, key) - case "mode": - err = unpopulate(val, "Mode", &c.Mode) - delete(rawMsg, key) - case "notificationsList": - err = unpopulate(val, "NotificationsList", &c.NotificationsList) - delete(rawMsg, key) - case "parent": - err = unpopulate(val, "Parent", &c.Parent) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + case "expiry": + err = unpopulateTimeRFC3339(val, "Expiry", &g.Expiry) delete(rawMsg, key) - case "statusDetails": - err = unpopulate(val, "StatusDetails", &c.StatusDetails) + case "name": + err = unpopulate(val, "Name", &g.Name) delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &c.Version) + case "tokenId": + err = unpopulate(val, "TokenID", &g.TokenID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ConnectedRegistryUpdateParameters. -func (c ConnectedRegistryUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GenerateCredentialsResult. +func (g GenerateCredentialsResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", c.Properties) + populate(objectMap, "passwords", g.Passwords) + populate(objectMap, "username", g.Username) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedRegistryUpdateParameters. -func (c *ConnectedRegistryUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GenerateCredentialsResult. +func (g *GenerateCredentialsResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &c.Properties) + case "passwords": + err = unpopulate(val, "Passwords", &g.Passwords) + delete(rawMsg, key) + case "username": + err = unpopulate(val, "Username", &g.Username) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ConnectedRegistryUpdateProperties. -func (c ConnectedRegistryUpdateProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IPRule. +func (i IPRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "clientTokenIds", c.ClientTokenIDs) - populate(objectMap, "logging", c.Logging) - populate(objectMap, "notificationsList", c.NotificationsList) - populate(objectMap, "syncProperties", c.SyncProperties) + populate(objectMap, "action", i.Action) + populate(objectMap, "value", i.IPAddressOrRange) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedRegistryUpdateProperties. -func (c *ConnectedRegistryUpdateProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IPRule. +func (i *IPRule) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "clientTokenIds": - err = unpopulate(val, "ClientTokenIDs", &c.ClientTokenIDs) - delete(rawMsg, key) - case "logging": - err = unpopulate(val, "Logging", &c.Logging) - delete(rawMsg, key) - case "notificationsList": - err = unpopulate(val, "NotificationsList", &c.NotificationsList) + case "action": + err = unpopulate(val, "Action", &i.Action) delete(rawMsg, key) - case "syncProperties": - err = unpopulate(val, "SyncProperties", &c.SyncProperties) + case "value": + err = unpopulate(val, "IPAddressOrRange", &i.IPAddressOrRange) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CredentialHealth. -func (c CredentialHealth) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IdentityProperties. +func (i IdentityProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "errorCode", c.ErrorCode) - populate(objectMap, "errorMessage", c.ErrorMessage) - populate(objectMap, "status", c.Status) + populate(objectMap, "principalId", i.PrincipalID) + populate(objectMap, "tenantId", i.TenantID) + populate(objectMap, "type", i.Type) + populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CredentialHealth. -func (c *CredentialHealth) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityProperties. +func (i *IdentityProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "errorCode": - err = unpopulate(val, "ErrorCode", &c.ErrorCode) + case "principalId": + err = unpopulate(val, "PrincipalID", &i.PrincipalID) delete(rawMsg, key) - case "errorMessage": - err = unpopulate(val, "ErrorMessage", &c.ErrorMessage) + case "tenantId": + err = unpopulate(val, "TenantID", &i.TenantID) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &c.Status) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &i.UserAssignedIdentities) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CredentialSet. -func (c CredentialSet) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ImportImageParameters. +func (i ImportImageParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", c.ID) - populate(objectMap, "identity", c.Identity) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "systemData", c.SystemData) - populate(objectMap, "type", c.Type) + populate(objectMap, "mode", i.Mode) + populate(objectMap, "source", i.Source) + populate(objectMap, "targetTags", i.TargetTags) + populate(objectMap, "untaggedTargetRepositories", i.UntaggedTargetRepositories) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CredentialSet. -func (c *CredentialSet) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ImportImageParameters. +func (i *ImportImageParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &c.ID) - delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &c.Identity) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &c.Name) + case "mode": + err = unpopulate(val, "Mode", &i.Mode) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &c.Properties) + case "source": + err = unpopulate(val, "Source", &i.Source) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &c.SystemData) + case "targetTags": + err = unpopulate(val, "TargetTags", &i.TargetTags) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) + case "untaggedTargetRepositories": + err = unpopulate(val, "UntaggedTargetRepositories", &i.UntaggedTargetRepositories) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CredentialSetListResult. -func (c CredentialSetListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ImportSource. +func (i ImportSource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", c.NextLink) - populate(objectMap, "value", c.Value) + populate(objectMap, "credentials", i.Credentials) + populate(objectMap, "registryUri", i.RegistryURI) + populate(objectMap, "resourceId", i.ResourceID) + populate(objectMap, "sourceImage", i.SourceImage) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CredentialSetListResult. -func (c *CredentialSetListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ImportSource. +func (i *ImportSource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &c.NextLink) + case "credentials": + err = unpopulate(val, "Credentials", &i.Credentials) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &c.Value) + case "registryUri": + err = unpopulate(val, "RegistryURI", &i.RegistryURI) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &i.ResourceID) + delete(rawMsg, key) + case "sourceImage": + err = unpopulate(val, "SourceImage", &i.SourceImage) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CredentialSetProperties. -func (c CredentialSetProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ImportSourceCredentials. +func (i ImportSourceCredentials) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "authCredentials", c.AuthCredentials) - populateTimeRFC3339(objectMap, "creationDate", c.CreationDate) - populate(objectMap, "loginServer", c.LoginServer) - populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "password", i.Password) + populate(objectMap, "username", i.Username) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CredentialSetProperties. -func (c *CredentialSetProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ImportSourceCredentials. +func (i *ImportSourceCredentials) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "authCredentials": - err = unpopulate(val, "AuthCredentials", &c.AuthCredentials) - delete(rawMsg, key) - case "creationDate": - err = unpopulateTimeRFC3339(val, "CreationDate", &c.CreationDate) + case "password": + err = unpopulate(val, "Password", &i.Password) delete(rawMsg, key) - case "loginServer": - err = unpopulate(val, "LoginServer", &c.LoginServer) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + case "username": + err = unpopulate(val, "Username", &i.Username) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CredentialSetUpdateParameters. -func (c CredentialSetUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type InnerErrorDescription. +func (i InnerErrorDescription) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "identity", c.Identity) - populate(objectMap, "properties", c.Properties) + populate(objectMap, "code", i.Code) + populate(objectMap, "message", i.Message) + populate(objectMap, "target", i.Target) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CredentialSetUpdateParameters. -func (c *CredentialSetUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type InnerErrorDescription. +func (i *InnerErrorDescription) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "identity": - err = unpopulate(val, "Identity", &c.Identity) + case "code": + err = unpopulate(val, "Code", &i.Code) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &c.Properties) + case "message": + err = unpopulate(val, "Message", &i.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &i.Target) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CredentialSetUpdateProperties. -func (c CredentialSetUpdateProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type KeyVaultProperties. +func (k KeyVaultProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "authCredentials", c.AuthCredentials) + populate(objectMap, "identity", k.Identity) + populate(objectMap, "keyIdentifier", k.KeyIdentifier) + populate(objectMap, "keyRotationEnabled", k.KeyRotationEnabled) + populateTimeRFC3339(objectMap, "lastKeyRotationTimestamp", k.LastKeyRotationTimestamp) + populate(objectMap, "versionedKeyIdentifier", k.VersionedKeyIdentifier) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CredentialSetUpdateProperties. -func (c *CredentialSetUpdateProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultProperties. +func (k *KeyVaultProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", k, err) } for key, val := range rawMsg { var err error switch key { - case "authCredentials": - err = unpopulate(val, "AuthCredentials", &c.AuthCredentials) + case "identity": + err = unpopulate(val, "Identity", &k.Identity) + delete(rawMsg, key) + case "keyIdentifier": + err = unpopulate(val, "KeyIdentifier", &k.KeyIdentifier) + delete(rawMsg, key) + case "keyRotationEnabled": + err = unpopulate(val, "KeyRotationEnabled", &k.KeyRotationEnabled) + delete(rawMsg, key) + case "lastKeyRotationTimestamp": + err = unpopulateTimeRFC3339(val, "LastKeyRotationTimestamp", &k.LastKeyRotationTimestamp) + delete(rawMsg, key) + case "versionedKeyIdentifier": + err = unpopulate(val, "VersionedKeyIdentifier", &k.VersionedKeyIdentifier) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", k, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Credentials. -func (c Credentials) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NetworkRuleSet. +func (n NetworkRuleSet) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "customRegistries", c.CustomRegistries) - populate(objectMap, "sourceRegistry", c.SourceRegistry) + populate(objectMap, "defaultAction", n.DefaultAction) + populate(objectMap, "ipRules", n.IPRules) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Credentials. -func (c *Credentials) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkRuleSet. +func (n *NetworkRuleSet) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "customRegistries": - err = unpopulate(val, "CustomRegistries", &c.CustomRegistries) + case "defaultAction": + err = unpopulate(val, "DefaultAction", &n.DefaultAction) delete(rawMsg, key) - case "sourceRegistry": - err = unpopulate(val, "SourceRegistry", &c.SourceRegistry) + case "ipRules": + err = unpopulate(val, "IPRules", &n.IPRules) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CustomRegistryCredentials. -func (c CustomRegistryCredentials) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationDefinition. +func (o OperationDefinition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "identity", c.Identity) - populate(objectMap, "password", c.Password) - populate(objectMap, "userName", c.UserName) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + populate(objectMap, "properties", o.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CustomRegistryCredentials. -func (c *CustomRegistryCredentials) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDefinition. +func (o *OperationDefinition) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "identity": - err = unpopulate(val, "Identity", &c.Identity) + case "display": + err = unpopulate(val, "Display", &o.Display) delete(rawMsg, key) - case "password": - err = unpopulate(val, "Password", &c.Password) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) delete(rawMsg, key) - case "userName": - err = unpopulate(val, "UserName", &c.UserName) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DockerBuildRequest. -func (d DockerBuildRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationDisplayDefinition. +func (o OperationDisplayDefinition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "agentConfiguration", d.AgentConfiguration) - populate(objectMap, "agentPoolName", d.AgentPoolName) - populate(objectMap, "arguments", d.Arguments) - populate(objectMap, "credentials", d.Credentials) - populate(objectMap, "dockerFilePath", d.DockerFilePath) - populate(objectMap, "imageNames", d.ImageNames) - populate(objectMap, "isArchiveEnabled", d.IsArchiveEnabled) - populate(objectMap, "isPushEnabled", d.IsPushEnabled) - populate(objectMap, "logTemplate", d.LogTemplate) - populate(objectMap, "noCache", d.NoCache) - populate(objectMap, "platform", d.Platform) - populate(objectMap, "sourceLocation", d.SourceLocation) - populate(objectMap, "target", d.Target) - populate(objectMap, "timeout", d.Timeout) - objectMap["type"] = "DockerBuildRequest" + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DockerBuildRequest. -func (d *DockerBuildRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplayDefinition. +func (o *OperationDisplayDefinition) 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) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "agentConfiguration": - err = unpopulate(val, "AgentConfiguration", &d.AgentConfiguration) - delete(rawMsg, key) - case "agentPoolName": - err = unpopulate(val, "AgentPoolName", &d.AgentPoolName) - delete(rawMsg, key) - case "arguments": - err = unpopulate(val, "Arguments", &d.Arguments) - delete(rawMsg, key) - case "credentials": - err = unpopulate(val, "Credentials", &d.Credentials) - delete(rawMsg, key) - case "dockerFilePath": - err = unpopulate(val, "DockerFilePath", &d.DockerFilePath) - delete(rawMsg, key) - case "imageNames": - err = unpopulate(val, "ImageNames", &d.ImageNames) - delete(rawMsg, key) - case "isArchiveEnabled": - err = unpopulate(val, "IsArchiveEnabled", &d.IsArchiveEnabled) - delete(rawMsg, key) - case "isPushEnabled": - err = unpopulate(val, "IsPushEnabled", &d.IsPushEnabled) - delete(rawMsg, key) - case "logTemplate": - err = unpopulate(val, "LogTemplate", &d.LogTemplate) - delete(rawMsg, key) - case "noCache": - err = unpopulate(val, "NoCache", &d.NoCache) - delete(rawMsg, key) - case "platform": - err = unpopulate(val, "Platform", &d.Platform) - delete(rawMsg, key) - case "sourceLocation": - err = unpopulate(val, "SourceLocation", &d.SourceLocation) + case "description": + err = unpopulate(val, "Description", &o.Description) delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &d.Target) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) delete(rawMsg, key) - case "timeout": - err = unpopulate(val, "Timeout", &d.Timeout) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DockerBuildStep. -func (d DockerBuildStep) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "arguments", d.Arguments) - populate(objectMap, "baseImageDependencies", d.BaseImageDependencies) - populate(objectMap, "contextAccessToken", d.ContextAccessToken) - populate(objectMap, "contextPath", d.ContextPath) - populate(objectMap, "dockerFilePath", d.DockerFilePath) - populate(objectMap, "imageNames", d.ImageNames) - populate(objectMap, "isPushEnabled", d.IsPushEnabled) - populate(objectMap, "noCache", d.NoCache) - populate(objectMap, "target", d.Target) - objectMap["type"] = StepTypeDocker + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DockerBuildStep. -func (d *DockerBuildStep) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "arguments": - err = unpopulate(val, "Arguments", &d.Arguments) - delete(rawMsg, key) - case "baseImageDependencies": - err = unpopulate(val, "BaseImageDependencies", &d.BaseImageDependencies) - delete(rawMsg, key) - case "contextAccessToken": - err = unpopulate(val, "ContextAccessToken", &d.ContextAccessToken) - delete(rawMsg, key) - case "contextPath": - err = unpopulate(val, "ContextPath", &d.ContextPath) - delete(rawMsg, key) - case "dockerFilePath": - err = unpopulate(val, "DockerFilePath", &d.DockerFilePath) - delete(rawMsg, key) - case "imageNames": - err = unpopulate(val, "ImageNames", &d.ImageNames) - delete(rawMsg, key) - case "isPushEnabled": - err = unpopulate(val, "IsPushEnabled", &d.IsPushEnabled) - delete(rawMsg, key) - case "noCache": - err = unpopulate(val, "NoCache", &d.NoCache) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &d.Target) + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) + case "value": + err = unpopulate(val, "Value", &o.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DockerBuildStepUpdateParameters. -func (d DockerBuildStepUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationLogSpecificationDefinition. +func (o OperationLogSpecificationDefinition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "arguments", d.Arguments) - populate(objectMap, "contextAccessToken", d.ContextAccessToken) - populate(objectMap, "contextPath", d.ContextPath) - populate(objectMap, "dockerFilePath", d.DockerFilePath) - populate(objectMap, "imageNames", d.ImageNames) - populate(objectMap, "isPushEnabled", d.IsPushEnabled) - populate(objectMap, "noCache", d.NoCache) - populate(objectMap, "target", d.Target) - objectMap["type"] = StepTypeDocker + populate(objectMap, "blobDuration", o.BlobDuration) + populate(objectMap, "displayName", o.DisplayName) + populate(objectMap, "name", o.Name) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DockerBuildStepUpdateParameters. -func (d *DockerBuildStepUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationLogSpecificationDefinition. +func (o *OperationLogSpecificationDefinition) 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) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "arguments": - err = unpopulate(val, "Arguments", &d.Arguments) - delete(rawMsg, key) - case "contextAccessToken": - err = unpopulate(val, "ContextAccessToken", &d.ContextAccessToken) - delete(rawMsg, key) - case "contextPath": - err = unpopulate(val, "ContextPath", &d.ContextPath) - delete(rawMsg, key) - case "dockerFilePath": - err = unpopulate(val, "DockerFilePath", &d.DockerFilePath) - delete(rawMsg, key) - case "imageNames": - err = unpopulate(val, "ImageNames", &d.ImageNames) - delete(rawMsg, key) - case "isPushEnabled": - err = unpopulate(val, "IsPushEnabled", &d.IsPushEnabled) - delete(rawMsg, key) - case "noCache": - err = unpopulate(val, "NoCache", &d.NoCache) + case "blobDuration": + err = unpopulate(val, "BlobDuration", &o.BlobDuration) delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &d.Target) + case "displayName": + err = unpopulate(val, "DisplayName", &o.DisplayName) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) + case "name": + err = unpopulate(val, "Name", &o.Name) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type EncodedTaskRunRequest. -func (e EncodedTaskRunRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationMetricSpecificationDefinition. +func (o OperationMetricSpecificationDefinition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "agentConfiguration", e.AgentConfiguration) - populate(objectMap, "agentPoolName", e.AgentPoolName) - populate(objectMap, "credentials", e.Credentials) - populate(objectMap, "encodedTaskContent", e.EncodedTaskContent) - populate(objectMap, "encodedValuesContent", e.EncodedValuesContent) - populate(objectMap, "isArchiveEnabled", e.IsArchiveEnabled) - populate(objectMap, "logTemplate", e.LogTemplate) - populate(objectMap, "platform", e.Platform) - populate(objectMap, "sourceLocation", e.SourceLocation) - populate(objectMap, "timeout", e.Timeout) - objectMap["type"] = "EncodedTaskRunRequest" - populate(objectMap, "values", e.Values) + populate(objectMap, "aggregationType", o.AggregationType) + populate(objectMap, "displayDescription", o.DisplayDescription) + populate(objectMap, "displayName", o.DisplayName) + populate(objectMap, "internalMetricName", o.InternalMetricName) + populate(objectMap, "name", o.Name) + populate(objectMap, "unit", o.Unit) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EncodedTaskRunRequest. -func (e *EncodedTaskRunRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationMetricSpecificationDefinition. +func (o *OperationMetricSpecificationDefinition) 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) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "agentConfiguration": - err = unpopulate(val, "AgentConfiguration", &e.AgentConfiguration) - delete(rawMsg, key) - case "agentPoolName": - err = unpopulate(val, "AgentPoolName", &e.AgentPoolName) - delete(rawMsg, key) - case "credentials": - err = unpopulate(val, "Credentials", &e.Credentials) - delete(rawMsg, key) - case "encodedTaskContent": - err = unpopulate(val, "EncodedTaskContent", &e.EncodedTaskContent) - delete(rawMsg, key) - case "encodedValuesContent": - err = unpopulate(val, "EncodedValuesContent", &e.EncodedValuesContent) - delete(rawMsg, key) - case "isArchiveEnabled": - err = unpopulate(val, "IsArchiveEnabled", &e.IsArchiveEnabled) - delete(rawMsg, key) - case "logTemplate": - err = unpopulate(val, "LogTemplate", &e.LogTemplate) + case "aggregationType": + err = unpopulate(val, "AggregationType", &o.AggregationType) delete(rawMsg, key) - case "platform": - err = unpopulate(val, "Platform", &e.Platform) + case "displayDescription": + err = unpopulate(val, "DisplayDescription", &o.DisplayDescription) delete(rawMsg, key) - case "sourceLocation": - err = unpopulate(val, "SourceLocation", &e.SourceLocation) + case "displayName": + err = unpopulate(val, "DisplayName", &o.DisplayName) delete(rawMsg, key) - case "timeout": - err = unpopulate(val, "Timeout", &e.Timeout) + case "internalMetricName": + err = unpopulate(val, "InternalMetricName", &o.InternalMetricName) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) + case "name": + err = unpopulate(val, "Name", &o.Name) delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &e.Values) + case "unit": + err = unpopulate(val, "Unit", &o.Unit) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type EncodedTaskStep. -func (e EncodedTaskStep) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationPropertiesDefinition. +func (o OperationPropertiesDefinition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "baseImageDependencies", e.BaseImageDependencies) - populate(objectMap, "contextAccessToken", e.ContextAccessToken) - populate(objectMap, "contextPath", e.ContextPath) - populate(objectMap, "encodedTaskContent", e.EncodedTaskContent) - populate(objectMap, "encodedValuesContent", e.EncodedValuesContent) - objectMap["type"] = StepTypeEncodedTask - populate(objectMap, "values", e.Values) + populate(objectMap, "serviceSpecification", o.ServiceSpecification) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EncodedTaskStep. -func (e *EncodedTaskStep) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationPropertiesDefinition. +func (o *OperationPropertiesDefinition) 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) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "baseImageDependencies": - err = unpopulate(val, "BaseImageDependencies", &e.BaseImageDependencies) - delete(rawMsg, key) - case "contextAccessToken": - err = unpopulate(val, "ContextAccessToken", &e.ContextAccessToken) - delete(rawMsg, key) - case "contextPath": - err = unpopulate(val, "ContextPath", &e.ContextPath) - delete(rawMsg, key) - case "encodedTaskContent": - err = unpopulate(val, "EncodedTaskContent", &e.EncodedTaskContent) - delete(rawMsg, key) - case "encodedValuesContent": - err = unpopulate(val, "EncodedValuesContent", &e.EncodedValuesContent) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) - delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &e.Values) + case "serviceSpecification": + err = unpopulate(val, "ServiceSpecification", &o.ServiceSpecification) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type EncodedTaskStepUpdateParameters. -func (e EncodedTaskStepUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationServiceSpecificationDefinition. +func (o OperationServiceSpecificationDefinition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "contextAccessToken", e.ContextAccessToken) - populate(objectMap, "contextPath", e.ContextPath) - populate(objectMap, "encodedTaskContent", e.EncodedTaskContent) - populate(objectMap, "encodedValuesContent", e.EncodedValuesContent) - objectMap["type"] = StepTypeEncodedTask - populate(objectMap, "values", e.Values) + populate(objectMap, "logSpecifications", o.LogSpecifications) + populate(objectMap, "metricSpecifications", o.MetricSpecifications) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EncodedTaskStepUpdateParameters. -func (e *EncodedTaskStepUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationServiceSpecificationDefinition. +func (o *OperationServiceSpecificationDefinition) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "contextAccessToken": - err = unpopulate(val, "ContextAccessToken", &e.ContextAccessToken) - delete(rawMsg, key) - case "contextPath": - err = unpopulate(val, "ContextPath", &e.ContextPath) - delete(rawMsg, key) - case "encodedTaskContent": - err = unpopulate(val, "EncodedTaskContent", &e.EncodedTaskContent) - delete(rawMsg, key) - case "encodedValuesContent": - err = unpopulate(val, "EncodedValuesContent", &e.EncodedValuesContent) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) + case "logSpecifications": + err = unpopulate(val, "LogSpecifications", &o.LogSpecifications) delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &e.Values) + case "metricSpecifications": + err = unpopulate(val, "MetricSpecifications", &o.MetricSpecifications) 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 EncryptionProperty. -func (e EncryptionProperty) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "keyVaultProperties", e.KeyVaultProperties) - populate(objectMap, "status", e.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionProperty. -func (e *EncryptionProperty) 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 "keyVaultProperties": - err = unpopulate(val, "KeyVaultProperties", &e.KeyVaultProperties) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &e.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. -func (e ErrorResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "error", e.Error) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. -func (e *ErrorResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorResponseBody. -func (e ErrorResponseBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "code", e.Code) - populate(objectMap, "details", e.Details) - populate(objectMap, "message", e.Message) - populate(objectMap, "target", e.Target) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseBody. -func (e *ErrorResponseBody) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "code": - err = unpopulate(val, "Code", &e.Code) - delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &e.Details) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &e.Target) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Event. -func (e Event) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "eventRequestMessage", e.EventRequestMessage) - populate(objectMap, "eventResponseMessage", e.EventResponseMessage) - populate(objectMap, "id", e.ID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Event. -func (e *Event) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "eventRequestMessage": - err = unpopulate(val, "EventRequestMessage", &e.EventRequestMessage) - delete(rawMsg, key) - case "eventResponseMessage": - err = unpopulate(val, "EventResponseMessage", &e.EventResponseMessage) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &e.ID) - 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 EventContent. -func (e EventContent) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "action", e.Action) - populate(objectMap, "actor", e.Actor) - populate(objectMap, "id", e.ID) - populate(objectMap, "request", e.Request) - populate(objectMap, "source", e.Source) - populate(objectMap, "target", e.Target) - populateTimeRFC3339(objectMap, "timestamp", e.Timestamp) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EventContent. -func (e *EventContent) UnmarshalJSON(data []byte) error { - 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 "action": - err = unpopulate(val, "Action", &e.Action) - delete(rawMsg, key) - case "actor": - err = unpopulate(val, "Actor", &e.Actor) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &e.ID) - delete(rawMsg, key) - case "request": - err = unpopulate(val, "Request", &e.Request) - delete(rawMsg, key) - case "source": - err = unpopulate(val, "Source", &e.Source) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &e.Target) - delete(rawMsg, key) - case "timestamp": - err = unpopulateTimeRFC3339(val, "Timestamp", &e.Timestamp) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EventInfo. -func (e EventInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", e.ID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EventInfo. -func (e *EventInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &e.ID) - 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 EventListResult. -func (e EventListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", e.NextLink) - populate(objectMap, "value", e.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EventListResult. -func (e *EventListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &e.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &e.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EventRequestMessage. -func (e EventRequestMessage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "content", e.Content) - populate(objectMap, "headers", e.Headers) - populate(objectMap, "method", e.Method) - populate(objectMap, "requestUri", e.RequestURI) - populate(objectMap, "version", e.Version) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EventRequestMessage. -func (e *EventRequestMessage) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "content": - err = unpopulate(val, "Content", &e.Content) - delete(rawMsg, key) - case "headers": - err = unpopulate(val, "Headers", &e.Headers) - delete(rawMsg, key) - case "method": - err = unpopulate(val, "Method", &e.Method) - delete(rawMsg, key) - case "requestUri": - err = unpopulate(val, "RequestURI", &e.RequestURI) - delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &e.Version) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EventResponseMessage. -func (e EventResponseMessage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "content", e.Content) - populate(objectMap, "headers", e.Headers) - populate(objectMap, "reasonPhrase", e.ReasonPhrase) - populate(objectMap, "statusCode", e.StatusCode) - populate(objectMap, "version", e.Version) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EventResponseMessage. -func (e *EventResponseMessage) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "content": - err = unpopulate(val, "Content", &e.Content) - delete(rawMsg, key) - case "headers": - err = unpopulate(val, "Headers", &e.Headers) - delete(rawMsg, key) - case "reasonPhrase": - err = unpopulate(val, "ReasonPhrase", &e.ReasonPhrase) - delete(rawMsg, key) - case "statusCode": - err = unpopulate(val, "StatusCode", &e.StatusCode) - delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &e.Version) - 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 ExportPipeline. -func (e ExportPipeline) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", e.ID) - populate(objectMap, "identity", e.Identity) - populate(objectMap, "location", e.Location) - populate(objectMap, "name", e.Name) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "systemData", e.SystemData) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ExportPipeline. -func (e *ExportPipeline) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &e.ID) - delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &e.Identity) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &e.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &e.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &e.SystemData) - delete(rawMsg, key) - case "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 ExportPipelineListResult. -func (e ExportPipelineListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", e.NextLink) - populate(objectMap, "value", e.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ExportPipelineListResult. -func (e *ExportPipelineListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &e.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &e.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ExportPipelineProperties. -func (e ExportPipelineProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "options", e.Options) - populate(objectMap, "provisioningState", e.ProvisioningState) - populate(objectMap, "target", e.Target) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ExportPipelineProperties. -func (e *ExportPipelineProperties) 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 "options": - err = unpopulate(val, "Options", &e.Options) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) - 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 ExportPipelineTargetProperties. -func (e ExportPipelineTargetProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "keyVaultUri", e.KeyVaultURI) - populate(objectMap, "type", e.Type) - populate(objectMap, "uri", e.URI) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ExportPipelineTargetProperties. -func (e *ExportPipelineTargetProperties) 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 "keyVaultUri": - err = unpopulate(val, "KeyVaultURI", &e.KeyVaultURI) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) - delete(rawMsg, key) - case "uri": - err = unpopulate(val, "URI", &e.URI) - 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 ExportPolicy. -func (e ExportPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "status", e.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ExportPolicy. -func (e *ExportPolicy) 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 "status": - err = unpopulate(val, "Status", &e.Status) - 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 FileTaskRunRequest. -func (f FileTaskRunRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "agentConfiguration", f.AgentConfiguration) - populate(objectMap, "agentPoolName", f.AgentPoolName) - populate(objectMap, "credentials", f.Credentials) - populate(objectMap, "isArchiveEnabled", f.IsArchiveEnabled) - populate(objectMap, "logTemplate", f.LogTemplate) - populate(objectMap, "platform", f.Platform) - populate(objectMap, "sourceLocation", f.SourceLocation) - populate(objectMap, "taskFilePath", f.TaskFilePath) - populate(objectMap, "timeout", f.Timeout) - objectMap["type"] = "FileTaskRunRequest" - populate(objectMap, "values", f.Values) - populate(objectMap, "valuesFilePath", f.ValuesFilePath) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FileTaskRunRequest. -func (f *FileTaskRunRequest) 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", f, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "agentConfiguration": - err = unpopulate(val, "AgentConfiguration", &f.AgentConfiguration) - delete(rawMsg, key) - case "agentPoolName": - err = unpopulate(val, "AgentPoolName", &f.AgentPoolName) - delete(rawMsg, key) - case "credentials": - err = unpopulate(val, "Credentials", &f.Credentials) - delete(rawMsg, key) - case "isArchiveEnabled": - err = unpopulate(val, "IsArchiveEnabled", &f.IsArchiveEnabled) - delete(rawMsg, key) - case "logTemplate": - err = unpopulate(val, "LogTemplate", &f.LogTemplate) - delete(rawMsg, key) - case "platform": - err = unpopulate(val, "Platform", &f.Platform) - delete(rawMsg, key) - case "sourceLocation": - err = unpopulate(val, "SourceLocation", &f.SourceLocation) - delete(rawMsg, key) - case "taskFilePath": - err = unpopulate(val, "TaskFilePath", &f.TaskFilePath) - delete(rawMsg, key) - case "timeout": - err = unpopulate(val, "Timeout", &f.Timeout) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &f.Type) - delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &f.Values) - delete(rawMsg, key) - case "valuesFilePath": - err = unpopulate(val, "ValuesFilePath", &f.ValuesFilePath) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type FileTaskStep. -func (f FileTaskStep) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "baseImageDependencies", f.BaseImageDependencies) - populate(objectMap, "contextAccessToken", f.ContextAccessToken) - populate(objectMap, "contextPath", f.ContextPath) - populate(objectMap, "taskFilePath", f.TaskFilePath) - objectMap["type"] = StepTypeFileTask - populate(objectMap, "values", f.Values) - populate(objectMap, "valuesFilePath", f.ValuesFilePath) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FileTaskStep. -func (f *FileTaskStep) 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", f, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "baseImageDependencies": - err = unpopulate(val, "BaseImageDependencies", &f.BaseImageDependencies) - delete(rawMsg, key) - case "contextAccessToken": - err = unpopulate(val, "ContextAccessToken", &f.ContextAccessToken) - delete(rawMsg, key) - case "contextPath": - err = unpopulate(val, "ContextPath", &f.ContextPath) - delete(rawMsg, key) - case "taskFilePath": - err = unpopulate(val, "TaskFilePath", &f.TaskFilePath) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &f.Type) - delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &f.Values) - delete(rawMsg, key) - case "valuesFilePath": - err = unpopulate(val, "ValuesFilePath", &f.ValuesFilePath) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type FileTaskStepUpdateParameters. -func (f FileTaskStepUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "contextAccessToken", f.ContextAccessToken) - populate(objectMap, "contextPath", f.ContextPath) - populate(objectMap, "taskFilePath", f.TaskFilePath) - objectMap["type"] = StepTypeFileTask - populate(objectMap, "values", f.Values) - populate(objectMap, "valuesFilePath", f.ValuesFilePath) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FileTaskStepUpdateParameters. -func (f *FileTaskStepUpdateParameters) 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", f, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "contextAccessToken": - err = unpopulate(val, "ContextAccessToken", &f.ContextAccessToken) - delete(rawMsg, key) - case "contextPath": - err = unpopulate(val, "ContextPath", &f.ContextPath) - delete(rawMsg, key) - case "taskFilePath": - err = unpopulate(val, "TaskFilePath", &f.TaskFilePath) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &f.Type) - delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &f.Values) - delete(rawMsg, key) - case "valuesFilePath": - err = unpopulate(val, "ValuesFilePath", &f.ValuesFilePath) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GenerateCredentialsParameters. -func (g GenerateCredentialsParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "expiry", g.Expiry) - populate(objectMap, "name", g.Name) - populate(objectMap, "tokenId", g.TokenID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GenerateCredentialsParameters. -func (g *GenerateCredentialsParameters) 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", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "expiry": - err = unpopulateTimeRFC3339(val, "Expiry", &g.Expiry) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &g.Name) - delete(rawMsg, key) - case "tokenId": - err = unpopulate(val, "TokenID", &g.TokenID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GenerateCredentialsResult. -func (g GenerateCredentialsResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "passwords", g.Passwords) - populate(objectMap, "username", g.Username) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GenerateCredentialsResult. -func (g *GenerateCredentialsResult) 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", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "passwords": - err = unpopulate(val, "Passwords", &g.Passwords) - delete(rawMsg, key) - case "username": - err = unpopulate(val, "Username", &g.Username) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IPRule. -func (i IPRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "action", i.Action) - populate(objectMap, "value", i.IPAddressOrRange) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IPRule. -func (i *IPRule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "action": - err = unpopulate(val, "Action", &i.Action) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "IPAddressOrRange", &i.IPAddressOrRange) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IdentityProperties. -func (i IdentityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "principalId", i.PrincipalID) - populate(objectMap, "tenantId", i.TenantID) - populate(objectMap, "type", i.Type) - populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IdentityProperties. -func (i *IdentityProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &i.PrincipalID) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &i.TenantID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) - delete(rawMsg, key) - case "userAssignedIdentities": - err = unpopulate(val, "UserAssignedIdentities", &i.UserAssignedIdentities) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ImageDescriptor. -func (i ImageDescriptor) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "digest", i.Digest) - populate(objectMap, "registry", i.Registry) - populate(objectMap, "repository", i.Repository) - populate(objectMap, "tag", i.Tag) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ImageDescriptor. -func (i *ImageDescriptor) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "digest": - err = unpopulate(val, "Digest", &i.Digest) - delete(rawMsg, key) - case "registry": - err = unpopulate(val, "Registry", &i.Registry) - delete(rawMsg, key) - case "repository": - err = unpopulate(val, "Repository", &i.Repository) - delete(rawMsg, key) - case "tag": - err = unpopulate(val, "Tag", &i.Tag) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ImageUpdateTrigger. -func (i ImageUpdateTrigger) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", i.ID) - populate(objectMap, "images", i.Images) - populateTimeRFC3339(objectMap, "timestamp", i.Timestamp) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ImageUpdateTrigger. -func (i *ImageUpdateTrigger) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &i.ID) - delete(rawMsg, key) - case "images": - err = unpopulate(val, "Images", &i.Images) - delete(rawMsg, key) - case "timestamp": - err = unpopulateTimeRFC3339(val, "Timestamp", &i.Timestamp) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ImportImageParameters. -func (i ImportImageParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "mode", i.Mode) - populate(objectMap, "source", i.Source) - populate(objectMap, "targetTags", i.TargetTags) - populate(objectMap, "untaggedTargetRepositories", i.UntaggedTargetRepositories) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ImportImageParameters. -func (i *ImportImageParameters) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "mode": - err = unpopulate(val, "Mode", &i.Mode) - delete(rawMsg, key) - case "source": - err = unpopulate(val, "Source", &i.Source) - delete(rawMsg, key) - case "targetTags": - err = unpopulate(val, "TargetTags", &i.TargetTags) - delete(rawMsg, key) - case "untaggedTargetRepositories": - err = unpopulate(val, "UntaggedTargetRepositories", &i.UntaggedTargetRepositories) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ImportPipeline. -func (i ImportPipeline) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", i.ID) - populate(objectMap, "identity", i.Identity) - populate(objectMap, "location", i.Location) - populate(objectMap, "name", i.Name) - populate(objectMap, "properties", i.Properties) - populate(objectMap, "systemData", i.SystemData) - populate(objectMap, "type", i.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ImportPipeline. -func (i *ImportPipeline) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &i.ID) - delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &i.Identity) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &i.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &i.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &i.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &i.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ImportPipelineListResult. -func (i ImportPipelineListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", i.NextLink) - populate(objectMap, "value", i.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ImportPipelineListResult. -func (i *ImportPipelineListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &i.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &i.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ImportPipelineProperties. -func (i ImportPipelineProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "options", i.Options) - populate(objectMap, "provisioningState", i.ProvisioningState) - populate(objectMap, "source", i.Source) - populate(objectMap, "trigger", i.Trigger) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ImportPipelineProperties. -func (i *ImportPipelineProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "options": - err = unpopulate(val, "Options", &i.Options) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &i.ProvisioningState) - delete(rawMsg, key) - case "source": - err = unpopulate(val, "Source", &i.Source) - delete(rawMsg, key) - case "trigger": - err = unpopulate(val, "Trigger", &i.Trigger) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ImportPipelineSourceProperties. -func (i ImportPipelineSourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "keyVaultUri", i.KeyVaultURI) - populate(objectMap, "type", i.Type) - populate(objectMap, "uri", i.URI) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ImportPipelineSourceProperties. -func (i *ImportPipelineSourceProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "keyVaultUri": - err = unpopulate(val, "KeyVaultURI", &i.KeyVaultURI) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) - delete(rawMsg, key) - case "uri": - err = unpopulate(val, "URI", &i.URI) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ImportSource. -func (i ImportSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "credentials", i.Credentials) - populate(objectMap, "registryUri", i.RegistryURI) - populate(objectMap, "resourceId", i.ResourceID) - populate(objectMap, "sourceImage", i.SourceImage) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ImportSource. -func (i *ImportSource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "credentials": - err = unpopulate(val, "Credentials", &i.Credentials) - delete(rawMsg, key) - case "registryUri": - err = unpopulate(val, "RegistryURI", &i.RegistryURI) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &i.ResourceID) - delete(rawMsg, key) - case "sourceImage": - err = unpopulate(val, "SourceImage", &i.SourceImage) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ImportSourceCredentials. -func (i ImportSourceCredentials) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "password", i.Password) - populate(objectMap, "username", i.Username) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ImportSourceCredentials. -func (i *ImportSourceCredentials) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "password": - err = unpopulate(val, "Password", &i.Password) - delete(rawMsg, key) - case "username": - err = unpopulate(val, "Username", &i.Username) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type InnerErrorDescription. -func (i InnerErrorDescription) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "code", i.Code) - populate(objectMap, "message", i.Message) - populate(objectMap, "target", i.Target) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type InnerErrorDescription. -func (i *InnerErrorDescription) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "code": - err = unpopulate(val, "Code", &i.Code) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &i.Message) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &i.Target) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type KeyVaultProperties. -func (k KeyVaultProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "identity", k.Identity) - populate(objectMap, "keyIdentifier", k.KeyIdentifier) - populate(objectMap, "keyRotationEnabled", k.KeyRotationEnabled) - populateTimeRFC3339(objectMap, "lastKeyRotationTimestamp", k.LastKeyRotationTimestamp) - populate(objectMap, "versionedKeyIdentifier", k.VersionedKeyIdentifier) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultProperties. -func (k *KeyVaultProperties) 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", k, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "identity": - err = unpopulate(val, "Identity", &k.Identity) - delete(rawMsg, key) - case "keyIdentifier": - err = unpopulate(val, "KeyIdentifier", &k.KeyIdentifier) - delete(rawMsg, key) - case "keyRotationEnabled": - err = unpopulate(val, "KeyRotationEnabled", &k.KeyRotationEnabled) - delete(rawMsg, key) - case "lastKeyRotationTimestamp": - err = unpopulateTimeRFC3339(val, "LastKeyRotationTimestamp", &k.LastKeyRotationTimestamp) - delete(rawMsg, key) - case "versionedKeyIdentifier": - err = unpopulate(val, "VersionedKeyIdentifier", &k.VersionedKeyIdentifier) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", k, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LoggingProperties. -func (l LoggingProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "auditLogStatus", l.AuditLogStatus) - populate(objectMap, "logLevel", l.LogLevel) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LoggingProperties. -func (l *LoggingProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "auditLogStatus": - err = unpopulate(val, "AuditLogStatus", &l.AuditLogStatus) - delete(rawMsg, key) - case "logLevel": - err = unpopulate(val, "LogLevel", &l.LogLevel) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LoginServerProperties. -func (l LoginServerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "host", l.Host) - populate(objectMap, "tls", l.TLS) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LoginServerProperties. -func (l *LoginServerProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "host": - err = unpopulate(val, "Host", &l.Host) - delete(rawMsg, key) - case "tls": - err = unpopulate(val, "TLS", &l.TLS) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NetworkRuleSet. -func (n NetworkRuleSet) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "defaultAction", n.DefaultAction) - populate(objectMap, "ipRules", n.IPRules) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkRuleSet. -func (n *NetworkRuleSet) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "defaultAction": - err = unpopulate(val, "DefaultAction", &n.DefaultAction) - delete(rawMsg, key) - case "ipRules": - err = unpopulate(val, "IPRules", &n.IPRules) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationDefinition. -func (o OperationDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "display", o.Display) - populate(objectMap, "isDataAction", o.IsDataAction) - populate(objectMap, "name", o.Name) - populate(objectMap, "origin", o.Origin) - populate(objectMap, "properties", o.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDefinition. -func (o *OperationDefinition) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "display": - err = unpopulate(val, "Display", &o.Display) - delete(rawMsg, key) - case "isDataAction": - err = unpopulate(val, "IsDataAction", &o.IsDataAction) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - case "origin": - err = unpopulate(val, "Origin", &o.Origin) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &o.Properties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationDisplayDefinition. -func (o OperationDisplayDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", o.Description) - populate(objectMap, "operation", o.Operation) - populate(objectMap, "provider", o.Provider) - populate(objectMap, "resource", o.Resource) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplayDefinition. -func (o *OperationDisplayDefinition) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &o.Description) - delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &o.Operation) - delete(rawMsg, key) - case "provider": - err = unpopulate(val, "Provider", &o.Provider) - delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &o.Resource) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationListResult. -func (o OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. -func (o *OperationListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &o.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &o.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationLogSpecificationDefinition. -func (o OperationLogSpecificationDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "blobDuration", o.BlobDuration) - populate(objectMap, "displayName", o.DisplayName) - populate(objectMap, "name", o.Name) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationLogSpecificationDefinition. -func (o *OperationLogSpecificationDefinition) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "blobDuration": - err = unpopulate(val, "BlobDuration", &o.BlobDuration) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &o.DisplayName) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationMetricSpecificationDefinition. -func (o OperationMetricSpecificationDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "aggregationType", o.AggregationType) - populate(objectMap, "displayDescription", o.DisplayDescription) - populate(objectMap, "displayName", o.DisplayName) - populate(objectMap, "internalMetricName", o.InternalMetricName) - populate(objectMap, "name", o.Name) - populate(objectMap, "unit", o.Unit) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationMetricSpecificationDefinition. -func (o *OperationMetricSpecificationDefinition) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "aggregationType": - err = unpopulate(val, "AggregationType", &o.AggregationType) - delete(rawMsg, key) - case "displayDescription": - err = unpopulate(val, "DisplayDescription", &o.DisplayDescription) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &o.DisplayName) - delete(rawMsg, key) - case "internalMetricName": - err = unpopulate(val, "InternalMetricName", &o.InternalMetricName) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - case "unit": - err = unpopulate(val, "Unit", &o.Unit) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationPropertiesDefinition. -func (o OperationPropertiesDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "serviceSpecification", o.ServiceSpecification) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationPropertiesDefinition. -func (o *OperationPropertiesDefinition) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "serviceSpecification": - err = unpopulate(val, "ServiceSpecification", &o.ServiceSpecification) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationServiceSpecificationDefinition. -func (o OperationServiceSpecificationDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "logSpecifications", o.LogSpecifications) - populate(objectMap, "metricSpecifications", o.MetricSpecifications) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationServiceSpecificationDefinition. -func (o *OperationServiceSpecificationDefinition) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "logSpecifications": - err = unpopulate(val, "LogSpecifications", &o.LogSpecifications) - delete(rawMsg, key) - case "metricSpecifications": - err = unpopulate(val, "MetricSpecifications", &o.MetricSpecifications) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OverrideTaskStepProperties. -func (o OverrideTaskStepProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "arguments", o.Arguments) - populate(objectMap, "contextPath", o.ContextPath) - populate(objectMap, "file", o.File) - populate(objectMap, "target", o.Target) - populate(objectMap, "updateTriggerToken", o.UpdateTriggerToken) - populate(objectMap, "values", o.Values) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OverrideTaskStepProperties. -func (o *OverrideTaskStepProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "arguments": - err = unpopulate(val, "Arguments", &o.Arguments) - delete(rawMsg, key) - case "contextPath": - err = unpopulate(val, "ContextPath", &o.ContextPath) - delete(rawMsg, key) - case "file": - err = unpopulate(val, "File", &o.File) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &o.Target) - delete(rawMsg, key) - case "updateTriggerToken": - err = unpopulate(val, "UpdateTriggerToken", &o.UpdateTriggerToken) - delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &o.Values) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PackageType. -func (p PackageType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "endpoint", p.Endpoint) - populate(objectMap, "name", p.Name) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PackageType. -func (p *PackageType) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endpoint": - err = unpopulate(val, "Endpoint", &p.Endpoint) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ParentProperties. -func (p ParentProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "syncProperties", p.SyncProperties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ParentProperties. -func (p *ParentProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "syncProperties": - err = unpopulate(val, "SyncProperties", &p.SyncProperties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PipelineRun. -func (p PipelineRun) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "systemData", p.SystemData) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineRun. -func (p *PipelineRun) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &p.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PipelineRunListResult. -func (p PipelineRunListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineRunListResult. -func (p *PipelineRunListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PipelineRunProperties. -func (p PipelineRunProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "forceUpdateTag", p.ForceUpdateTag) - populate(objectMap, "provisioningState", p.ProvisioningState) - populate(objectMap, "request", p.Request) - populate(objectMap, "response", p.Response) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineRunProperties. -func (p *PipelineRunProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "forceUpdateTag": - err = unpopulate(val, "ForceUpdateTag", &p.ForceUpdateTag) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) - delete(rawMsg, key) - case "request": - err = unpopulate(val, "Request", &p.Request) - delete(rawMsg, key) - case "response": - err = unpopulate(val, "Response", &p.Response) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PipelineRunRequest. -func (p PipelineRunRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "artifacts", p.Artifacts) - populate(objectMap, "catalogDigest", p.CatalogDigest) - populate(objectMap, "pipelineResourceId", p.PipelineResourceID) - populate(objectMap, "source", p.Source) - populate(objectMap, "target", p.Target) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineRunRequest. -func (p *PipelineRunRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "artifacts": - err = unpopulate(val, "Artifacts", &p.Artifacts) - delete(rawMsg, key) - case "catalogDigest": - err = unpopulate(val, "CatalogDigest", &p.CatalogDigest) - delete(rawMsg, key) - case "pipelineResourceId": - err = unpopulate(val, "PipelineResourceID", &p.PipelineResourceID) - delete(rawMsg, key) - case "source": - err = unpopulate(val, "Source", &p.Source) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &p.Target) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PipelineRunResponse. -func (p PipelineRunResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "catalogDigest", p.CatalogDigest) - populateTimeRFC3339(objectMap, "finishTime", p.FinishTime) - populate(objectMap, "importedArtifacts", p.ImportedArtifacts) - populate(objectMap, "pipelineRunErrorMessage", p.PipelineRunErrorMessage) - populate(objectMap, "progress", p.Progress) - populate(objectMap, "source", p.Source) - populateTimeRFC3339(objectMap, "startTime", p.StartTime) - populate(objectMap, "status", p.Status) - populate(objectMap, "target", p.Target) - populate(objectMap, "trigger", p.Trigger) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineRunResponse. -func (p *PipelineRunResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "catalogDigest": - err = unpopulate(val, "CatalogDigest", &p.CatalogDigest) - delete(rawMsg, key) - case "finishTime": - err = unpopulateTimeRFC3339(val, "FinishTime", &p.FinishTime) - delete(rawMsg, key) - case "importedArtifacts": - err = unpopulate(val, "ImportedArtifacts", &p.ImportedArtifacts) - delete(rawMsg, key) - case "pipelineRunErrorMessage": - err = unpopulate(val, "PipelineRunErrorMessage", &p.PipelineRunErrorMessage) - delete(rawMsg, key) - case "progress": - err = unpopulate(val, "Progress", &p.Progress) - delete(rawMsg, key) - case "source": - err = unpopulate(val, "Source", &p.Source) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, "StartTime", &p.StartTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &p.Status) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &p.Target) - delete(rawMsg, key) - case "trigger": - err = unpopulate(val, "Trigger", &p.Trigger) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PipelineRunSourceProperties. -func (p PipelineRunSourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", p.Name) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineRunSourceProperties. -func (p *PipelineRunSourceProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PipelineRunTargetProperties. -func (p PipelineRunTargetProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", p.Name) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineRunTargetProperties. -func (p *PipelineRunTargetProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PipelineSourceTriggerDescriptor. -func (p PipelineSourceTriggerDescriptor) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "timestamp", p.Timestamp) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineSourceTriggerDescriptor. -func (p *PipelineSourceTriggerDescriptor) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "timestamp": - err = unpopulateTimeRFC3339(val, "Timestamp", &p.Timestamp) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PipelineSourceTriggerProperties. -func (p PipelineSourceTriggerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "status", p.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineSourceTriggerProperties. -func (p *PipelineSourceTriggerProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "status": - err = unpopulate(val, "Status", &p.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PipelineTriggerDescriptor. -func (p PipelineTriggerDescriptor) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "sourceTrigger", p.SourceTrigger) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineTriggerDescriptor. -func (p *PipelineTriggerDescriptor) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "sourceTrigger": - err = unpopulate(val, "SourceTrigger", &p.SourceTrigger) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PipelineTriggerProperties. -func (p PipelineTriggerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "sourceTrigger", p.SourceTrigger) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PipelineTriggerProperties. -func (p *PipelineTriggerProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "sourceTrigger": - err = unpopulate(val, "SourceTrigger", &p.SourceTrigger) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PlatformProperties. -func (p PlatformProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "architecture", p.Architecture) - populate(objectMap, "os", p.OS) - populate(objectMap, "variant", p.Variant) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PlatformProperties. -func (p *PlatformProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "architecture": - err = unpopulate(val, "Architecture", &p.Architecture) - delete(rawMsg, key) - case "os": - err = unpopulate(val, "OS", &p.OS) - delete(rawMsg, key) - case "variant": - err = unpopulate(val, "Variant", &p.Variant) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PlatformUpdateParameters. -func (p PlatformUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "architecture", p.Architecture) - populate(objectMap, "os", p.OS) - populate(objectMap, "variant", p.Variant) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PlatformUpdateParameters. -func (p *PlatformUpdateParameters) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "architecture": - err = unpopulate(val, "Architecture", &p.Architecture) - delete(rawMsg, key) - case "os": - err = unpopulate(val, "OS", &p.OS) - delete(rawMsg, key) - case "variant": - err = unpopulate(val, "Variant", &p.Variant) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Policies. -func (p Policies) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "azureADAuthenticationAsArmPolicy", p.AzureADAuthenticationAsArmPolicy) - populate(objectMap, "exportPolicy", p.ExportPolicy) - populate(objectMap, "quarantinePolicy", p.QuarantinePolicy) - populate(objectMap, "retentionPolicy", p.RetentionPolicy) - populate(objectMap, "softDeletePolicy", p.SoftDeletePolicy) - populate(objectMap, "trustPolicy", p.TrustPolicy) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Policies. -func (p *Policies) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "azureADAuthenticationAsArmPolicy": - err = unpopulate(val, "AzureADAuthenticationAsArmPolicy", &p.AzureADAuthenticationAsArmPolicy) - delete(rawMsg, key) - case "exportPolicy": - err = unpopulate(val, "ExportPolicy", &p.ExportPolicy) - delete(rawMsg, key) - case "quarantinePolicy": - err = unpopulate(val, "QuarantinePolicy", &p.QuarantinePolicy) - delete(rawMsg, key) - case "retentionPolicy": - err = unpopulate(val, "RetentionPolicy", &p.RetentionPolicy) - delete(rawMsg, key) - case "softDeletePolicy": - err = unpopulate(val, "SoftDeletePolicy", &p.SoftDeletePolicy) - delete(rawMsg, key) - case "trustPolicy": - err = unpopulate(val, "TrustPolicy", &p.TrustPolicy) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpoint. -func (p PrivateEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpoint. -func (p *PrivateEndpoint) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. -func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "systemData", p.SystemData) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. -func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &p.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. -func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionListResult. -func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. -func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "privateEndpoint", p.PrivateEndpoint) - populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) - populate(objectMap, "provisioningState", p.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. -func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "privateEndpoint": - err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) - delete(rawMsg, key) - case "privateLinkServiceConnectionState": - err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. -func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. -func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. -func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceListResult. -func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. -func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "groupId", p.GroupID) - populate(objectMap, "requiredMembers", p.RequiredMembers) - populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. -func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "groupId": - err = unpopulate(val, "GroupID", &p.GroupID) - delete(rawMsg, key) - case "requiredMembers": - err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) - delete(rawMsg, key) - case "requiredZoneNames": - err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionState. -func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "actionsRequired", p.ActionsRequired) - populate(objectMap, "description", p.Description) - populate(objectMap, "status", p.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionState. -func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actionsRequired": - err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &p.Description) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &p.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ProgressProperties. -func (p ProgressProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "percentage", p.Percentage) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProgressProperties. -func (p *ProgressProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "percentage": - err = unpopulate(val, "Percentage", &p.Percentage) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ProxyResource. -func (p ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "systemData", p.SystemData) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. -func (p *ProxyResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &p.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type QuarantinePolicy. -func (q QuarantinePolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "status", q.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type QuarantinePolicy. -func (q *QuarantinePolicy) 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", q, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "status": - err = unpopulate(val, "Status", &q.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RegenerateCredentialParameters. -func (r RegenerateCredentialParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", r.Name) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RegenerateCredentialParameters. -func (r *RegenerateCredentialParameters) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Registry. -func (r Registry) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "identity", r.Identity) - populate(objectMap, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "sku", r.SKU) - populate(objectMap, "systemData", r.SystemData) - populate(objectMap, "tags", r.Tags) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Registry. -func (r *Registry) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &r.Identity) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &r.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "sku": - err = unpopulate(val, "SKU", &r.SKU) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &r.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RegistryListCredentialsResult. -func (r RegistryListCredentialsResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "passwords", r.Passwords) - populate(objectMap, "username", r.Username) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryListCredentialsResult. -func (r *RegistryListCredentialsResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "passwords": - err = unpopulate(val, "Passwords", &r.Passwords) - delete(rawMsg, key) - case "username": - err = unpopulate(val, "Username", &r.Username) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RegistryListResult. -func (r RegistryListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryListResult. -func (r *RegistryListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RegistryNameCheckRequest. -func (r RegistryNameCheckRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", r.Name) - objectMap["type"] = "Microsoft.ContainerRegistry/registries" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryNameCheckRequest. -func (r *RegistryNameCheckRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RegistryNameStatus. -func (r RegistryNameStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "message", r.Message) - populate(objectMap, "nameAvailable", r.NameAvailable) - populate(objectMap, "reason", r.Reason) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryNameStatus. -func (r *RegistryNameStatus) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "message": - err = unpopulate(val, "Message", &r.Message) - delete(rawMsg, key) - case "nameAvailable": - err = unpopulate(val, "NameAvailable", &r.NameAvailable) - delete(rawMsg, key) - case "reason": - err = unpopulate(val, "Reason", &r.Reason) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RegistryPassword. -func (r RegistryPassword) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", r.Name) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryPassword. -func (r *RegistryPassword) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RegistryProperties. -func (r RegistryProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "adminUserEnabled", r.AdminUserEnabled) - populate(objectMap, "anonymousPullEnabled", r.AnonymousPullEnabled) - populateTimeRFC3339(objectMap, "creationDate", r.CreationDate) - populate(objectMap, "dataEndpointEnabled", r.DataEndpointEnabled) - populate(objectMap, "dataEndpointHostNames", r.DataEndpointHostNames) - populate(objectMap, "encryption", r.Encryption) - populate(objectMap, "loginServer", r.LoginServer) - populate(objectMap, "networkRuleBypassOptions", r.NetworkRuleBypassOptions) - populate(objectMap, "networkRuleSet", r.NetworkRuleSet) - populate(objectMap, "policies", r.Policies) - populate(objectMap, "privateEndpointConnections", r.PrivateEndpointConnections) - populate(objectMap, "provisioningState", r.ProvisioningState) - populate(objectMap, "publicNetworkAccess", r.PublicNetworkAccess) - populate(objectMap, "status", r.Status) - populate(objectMap, "zoneRedundancy", r.ZoneRedundancy) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryProperties. -func (r *RegistryProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "adminUserEnabled": - err = unpopulate(val, "AdminUserEnabled", &r.AdminUserEnabled) - delete(rawMsg, key) - case "anonymousPullEnabled": - err = unpopulate(val, "AnonymousPullEnabled", &r.AnonymousPullEnabled) - delete(rawMsg, key) - case "creationDate": - err = unpopulateTimeRFC3339(val, "CreationDate", &r.CreationDate) - delete(rawMsg, key) - case "dataEndpointEnabled": - err = unpopulate(val, "DataEndpointEnabled", &r.DataEndpointEnabled) - delete(rawMsg, key) - case "dataEndpointHostNames": - err = unpopulate(val, "DataEndpointHostNames", &r.DataEndpointHostNames) - delete(rawMsg, key) - case "encryption": - err = unpopulate(val, "Encryption", &r.Encryption) - delete(rawMsg, key) - case "loginServer": - err = unpopulate(val, "LoginServer", &r.LoginServer) - delete(rawMsg, key) - case "networkRuleBypassOptions": - err = unpopulate(val, "NetworkRuleBypassOptions", &r.NetworkRuleBypassOptions) - delete(rawMsg, key) - case "networkRuleSet": - err = unpopulate(val, "NetworkRuleSet", &r.NetworkRuleSet) - delete(rawMsg, key) - case "policies": - err = unpopulate(val, "Policies", &r.Policies) - delete(rawMsg, key) - case "privateEndpointConnections": - err = unpopulate(val, "PrivateEndpointConnections", &r.PrivateEndpointConnections) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) - delete(rawMsg, key) - case "publicNetworkAccess": - err = unpopulate(val, "PublicNetworkAccess", &r.PublicNetworkAccess) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) - delete(rawMsg, key) - case "zoneRedundancy": - err = unpopulate(val, "ZoneRedundancy", &r.ZoneRedundancy) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RegistryPropertiesUpdateParameters. -func (r RegistryPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "adminUserEnabled", r.AdminUserEnabled) - populate(objectMap, "anonymousPullEnabled", r.AnonymousPullEnabled) - populate(objectMap, "dataEndpointEnabled", r.DataEndpointEnabled) - populate(objectMap, "encryption", r.Encryption) - populate(objectMap, "networkRuleBypassOptions", r.NetworkRuleBypassOptions) - populate(objectMap, "networkRuleSet", r.NetworkRuleSet) - populate(objectMap, "policies", r.Policies) - populate(objectMap, "publicNetworkAccess", r.PublicNetworkAccess) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryPropertiesUpdateParameters. -func (r *RegistryPropertiesUpdateParameters) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "adminUserEnabled": - err = unpopulate(val, "AdminUserEnabled", &r.AdminUserEnabled) - delete(rawMsg, key) - case "anonymousPullEnabled": - err = unpopulate(val, "AnonymousPullEnabled", &r.AnonymousPullEnabled) - delete(rawMsg, key) - case "dataEndpointEnabled": - err = unpopulate(val, "DataEndpointEnabled", &r.DataEndpointEnabled) - delete(rawMsg, key) - case "encryption": - err = unpopulate(val, "Encryption", &r.Encryption) - delete(rawMsg, key) - case "networkRuleBypassOptions": - err = unpopulate(val, "NetworkRuleBypassOptions", &r.NetworkRuleBypassOptions) - delete(rawMsg, key) - case "networkRuleSet": - err = unpopulate(val, "NetworkRuleSet", &r.NetworkRuleSet) - delete(rawMsg, key) - case "policies": - err = unpopulate(val, "Policies", &r.Policies) - delete(rawMsg, key) - case "publicNetworkAccess": - err = unpopulate(val, "PublicNetworkAccess", &r.PublicNetworkAccess) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RegistryUpdateParameters. -func (r RegistryUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "identity", r.Identity) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "sku", r.SKU) - populate(objectMap, "tags", r.Tags) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryUpdateParameters. -func (r *RegistryUpdateParameters) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "identity": - err = unpopulate(val, "Identity", &r.Identity) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "sku": - err = unpopulate(val, "SKU", &r.SKU) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RegistryUsage. -func (r RegistryUsage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "currentValue", r.CurrentValue) - populate(objectMap, "limit", r.Limit) - populate(objectMap, "name", r.Name) - populate(objectMap, "unit", r.Unit) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryUsage. -func (r *RegistryUsage) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "currentValue": - err = unpopulate(val, "CurrentValue", &r.CurrentValue) - delete(rawMsg, key) - case "limit": - err = unpopulate(val, "Limit", &r.Limit) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "unit": - err = unpopulate(val, "Unit", &r.Unit) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RegistryUsageListResult. -func (r RegistryUsageListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryUsageListResult. -func (r *RegistryUsageListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &r.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Replication. -func (r Replication) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "systemData", r.SystemData) - populate(objectMap, "tags", r.Tags) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Replication. -func (r *Replication) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &r.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &r.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ReplicationListResult. -func (r ReplicationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationListResult. -func (r *ReplicationListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ReplicationProperties. -func (r ReplicationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "provisioningState", r.ProvisioningState) - populate(objectMap, "regionEndpointEnabled", r.RegionEndpointEnabled) - populate(objectMap, "status", r.Status) - populate(objectMap, "zoneRedundancy", r.ZoneRedundancy) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationProperties. -func (r *ReplicationProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) - delete(rawMsg, key) - case "regionEndpointEnabled": - err = unpopulate(val, "RegionEndpointEnabled", &r.RegionEndpointEnabled) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) - delete(rawMsg, key) - case "zoneRedundancy": - err = unpopulate(val, "ZoneRedundancy", &r.ZoneRedundancy) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ReplicationUpdateParameters. -func (r ReplicationUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "tags", r.Tags) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationUpdateParameters. -func (r *ReplicationUpdateParameters) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ReplicationUpdateParametersProperties. -func (r ReplicationUpdateParametersProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "regionEndpointEnabled", r.RegionEndpointEnabled) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationUpdateParametersProperties. -func (r *ReplicationUpdateParametersProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "regionEndpointEnabled": - err = unpopulate(val, "RegionEndpointEnabled", &r.RegionEndpointEnabled) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Request. -func (r Request) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "addr", r.Addr) - populate(objectMap, "host", r.Host) - populate(objectMap, "id", r.ID) - populate(objectMap, "method", r.Method) - populate(objectMap, "useragent", r.Useragent) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Request. -func (r *Request) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "addr": - err = unpopulate(val, "Addr", &r.Addr) - delete(rawMsg, key) - case "host": - err = unpopulate(val, "Host", &r.Host) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "method": - err = unpopulate(val, "Method", &r.Method) - delete(rawMsg, key) - case "useragent": - err = unpopulate(val, "Useragent", &r.Useragent) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "systemData", r.SystemData) - populate(objectMap, "tags", r.Tags) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. -func (r *Resource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &r.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &r.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RetentionPolicy. -func (r RetentionPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "days", r.Days) - populateTimeRFC3339(objectMap, "lastUpdatedTime", r.LastUpdatedTime) - populate(objectMap, "status", r.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RetentionPolicy. -func (r *RetentionPolicy) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "days": - err = unpopulate(val, "Days", &r.Days) - delete(rawMsg, key) - case "lastUpdatedTime": - err = unpopulateTimeRFC3339(val, "LastUpdatedTime", &r.LastUpdatedTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Run. -func (r Run) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "systemData", r.SystemData) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Run. -func (r *Run) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &r.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RunFilter. -func (r RunFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "agentPoolName", r.AgentPoolName) - populateTimeRFC3339(objectMap, "createTime", r.CreateTime) - populateTimeRFC3339(objectMap, "finishTime", r.FinishTime) - populate(objectMap, "isArchiveEnabled", r.IsArchiveEnabled) - populate(objectMap, "outputImageManifests", r.OutputImageManifests) - populate(objectMap, "runId", r.RunID) - populate(objectMap, "runType", r.RunType) - populate(objectMap, "status", r.Status) - populate(objectMap, "taskName", r.TaskName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RunFilter. -func (r *RunFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "agentPoolName": - err = unpopulate(val, "AgentPoolName", &r.AgentPoolName) - delete(rawMsg, key) - case "createTime": - err = unpopulateTimeRFC3339(val, "CreateTime", &r.CreateTime) - delete(rawMsg, key) - case "finishTime": - err = unpopulateTimeRFC3339(val, "FinishTime", &r.FinishTime) - delete(rawMsg, key) - case "isArchiveEnabled": - err = unpopulate(val, "IsArchiveEnabled", &r.IsArchiveEnabled) - delete(rawMsg, key) - case "outputImageManifests": - err = unpopulate(val, "OutputImageManifests", &r.OutputImageManifests) - delete(rawMsg, key) - case "runId": - err = unpopulate(val, "RunID", &r.RunID) - delete(rawMsg, key) - case "runType": - err = unpopulate(val, "RunType", &r.RunType) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) - delete(rawMsg, key) - case "taskName": - err = unpopulate(val, "TaskName", &r.TaskName) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RunGetLogResult. -func (r RunGetLogResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "logArtifactLink", r.LogArtifactLink) - populate(objectMap, "logLink", r.LogLink) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RunGetLogResult. -func (r *RunGetLogResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "logArtifactLink": - err = unpopulate(val, "LogArtifactLink", &r.LogArtifactLink) - delete(rawMsg, key) - case "logLink": - err = unpopulate(val, "LogLink", &r.LogLink) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RunListResult. -func (r RunListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RunListResult. -func (r *RunListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RunProperties. -func (r RunProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PackageType. +func (p PackageType) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "agentConfiguration", r.AgentConfiguration) - populate(objectMap, "agentPoolName", r.AgentPoolName) - populateTimeRFC3339(objectMap, "createTime", r.CreateTime) - populate(objectMap, "customRegistries", r.CustomRegistries) - populateTimeRFC3339(objectMap, "finishTime", r.FinishTime) - populate(objectMap, "imageUpdateTrigger", r.ImageUpdateTrigger) - populate(objectMap, "isArchiveEnabled", r.IsArchiveEnabled) - populateTimeRFC3339(objectMap, "lastUpdatedTime", r.LastUpdatedTime) - populate(objectMap, "logArtifact", r.LogArtifact) - populate(objectMap, "outputImages", r.OutputImages) - populate(objectMap, "platform", r.Platform) - populate(objectMap, "provisioningState", r.ProvisioningState) - populate(objectMap, "runErrorMessage", r.RunErrorMessage) - populate(objectMap, "runId", r.RunID) - populate(objectMap, "runType", r.RunType) - populate(objectMap, "sourceRegistryAuth", r.SourceRegistryAuth) - populate(objectMap, "sourceTrigger", r.SourceTrigger) - populateTimeRFC3339(objectMap, "startTime", r.StartTime) - populate(objectMap, "status", r.Status) - populate(objectMap, "task", r.Task) - populate(objectMap, "timerTrigger", r.TimerTrigger) - populate(objectMap, "updateTriggerToken", r.UpdateTriggerToken) + populate(objectMap, "endpoint", p.Endpoint) + populate(objectMap, "name", p.Name) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RunProperties. -func (r *RunProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PackageType. +func (p *PackageType) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "agentConfiguration": - err = unpopulate(val, "AgentConfiguration", &r.AgentConfiguration) - delete(rawMsg, key) - case "agentPoolName": - err = unpopulate(val, "AgentPoolName", &r.AgentPoolName) - delete(rawMsg, key) - case "createTime": - err = unpopulateTimeRFC3339(val, "CreateTime", &r.CreateTime) - delete(rawMsg, key) - case "customRegistries": - err = unpopulate(val, "CustomRegistries", &r.CustomRegistries) - delete(rawMsg, key) - case "finishTime": - err = unpopulateTimeRFC3339(val, "FinishTime", &r.FinishTime) - delete(rawMsg, key) - case "imageUpdateTrigger": - err = unpopulate(val, "ImageUpdateTrigger", &r.ImageUpdateTrigger) - delete(rawMsg, key) - case "isArchiveEnabled": - err = unpopulate(val, "IsArchiveEnabled", &r.IsArchiveEnabled) - delete(rawMsg, key) - case "lastUpdatedTime": - err = unpopulateTimeRFC3339(val, "LastUpdatedTime", &r.LastUpdatedTime) - delete(rawMsg, key) - case "logArtifact": - err = unpopulate(val, "LogArtifact", &r.LogArtifact) - delete(rawMsg, key) - case "outputImages": - err = unpopulate(val, "OutputImages", &r.OutputImages) - delete(rawMsg, key) - case "platform": - err = unpopulate(val, "Platform", &r.Platform) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) - delete(rawMsg, key) - case "runErrorMessage": - err = unpopulate(val, "RunErrorMessage", &r.RunErrorMessage) - delete(rawMsg, key) - case "runId": - err = unpopulate(val, "RunID", &r.RunID) - delete(rawMsg, key) - case "runType": - err = unpopulate(val, "RunType", &r.RunType) - delete(rawMsg, key) - case "sourceRegistryAuth": - err = unpopulate(val, "SourceRegistryAuth", &r.SourceRegistryAuth) - delete(rawMsg, key) - case "sourceTrigger": - err = unpopulate(val, "SourceTrigger", &r.SourceTrigger) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, "StartTime", &r.StartTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) - delete(rawMsg, key) - case "task": - err = unpopulate(val, "Task", &r.Task) - delete(rawMsg, key) - case "timerTrigger": - err = unpopulate(val, "TimerTrigger", &r.TimerTrigger) + case "endpoint": + err = unpopulate(val, "Endpoint", &p.Endpoint) delete(rawMsg, key) - case "updateTriggerToken": - err = unpopulate(val, "UpdateTriggerToken", &r.UpdateTriggerToken) + case "name": + err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RunRequest. -func (r RunRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Policies. +func (p Policies) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "agentPoolName", r.AgentPoolName) - populate(objectMap, "isArchiveEnabled", r.IsArchiveEnabled) - populate(objectMap, "logTemplate", r.LogTemplate) - objectMap["type"] = r.Type + populate(objectMap, "exportPolicy", p.ExportPolicy) + populate(objectMap, "quarantinePolicy", p.QuarantinePolicy) + populate(objectMap, "retentionPolicy", p.RetentionPolicy) + populate(objectMap, "trustPolicy", p.TrustPolicy) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RunRequest. -func (r *RunRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Policies. +func (p *Policies) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "agentPoolName": - err = unpopulate(val, "AgentPoolName", &r.AgentPoolName) - delete(rawMsg, key) - case "isArchiveEnabled": - err = unpopulate(val, "IsArchiveEnabled", &r.IsArchiveEnabled) + case "exportPolicy": + err = unpopulate(val, "ExportPolicy", &p.ExportPolicy) delete(rawMsg, key) - case "logTemplate": - err = unpopulate(val, "LogTemplate", &r.LogTemplate) + case "quarantinePolicy": + err = unpopulate(val, "QuarantinePolicy", &p.QuarantinePolicy) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "retentionPolicy": + err = unpopulate(val, "RetentionPolicy", &p.RetentionPolicy) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RunUpdateParameters. -func (r RunUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "isArchiveEnabled", r.IsArchiveEnabled) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RunUpdateParameters. -func (r *RunUpdateParameters) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "isArchiveEnabled": - err = unpopulate(val, "IsArchiveEnabled", &r.IsArchiveEnabled) + case "trustPolicy": + err = unpopulate(val, "TrustPolicy", &p.TrustPolicy) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SKU. -func (s SKU) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpoint. +func (p PrivateEndpoint) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", s.Name) - populate(objectMap, "tier", s.Tier) + populate(objectMap, "id", p.ID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SKU. -func (s *SKU) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpoint. +func (p *PrivateEndpoint) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "tier": - err = unpopulate(val, "Tier", &s.Tier) + case "id": + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ScopeMap. -func (s ScopeMap) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. +func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "systemData", s.SystemData) - populate(objectMap, "type", s.Type) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ScopeMap. -func (s *ScopeMap) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. +func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &s.ID) + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &s.Name) + err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &s.Properties) + err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) case "systemData": - err = unpopulate(val, "SystemData", &s.SystemData) + err = unpopulate(val, "SystemData", &p.SystemData) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &s.Type) + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ScopeMapListResult. -func (s ScopeMapListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. +func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ScopeMapListResult. -func (s *ScopeMapListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionListResult. +func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) + err = unpopulate(val, "NextLink", &p.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &s.Value) + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ScopeMapProperties. -func (s ScopeMapProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. +func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "actions", s.Actions) - populateTimeRFC3339(objectMap, "creationDate", s.CreationDate) - populate(objectMap, "description", s.Description) - populate(objectMap, "provisioningState", s.ProvisioningState) - populate(objectMap, "type", s.Type) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", p.ProvisioningState) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ScopeMapProperties. -func (s *ScopeMapProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. +func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "actions": - err = unpopulate(val, "Actions", &s.Actions) - delete(rawMsg, key) - case "creationDate": - err = unpopulateTimeRFC3339(val, "CreationDate", &s.CreationDate) + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &s.Description) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) delete(rawMsg, key) case "provisioningState": - err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ScopeMapPropertiesUpdateParameters. -func (s ScopeMapPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. +func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "actions", s.Actions) - populate(objectMap, "description", s.Description) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ScopeMapPropertiesUpdateParameters. -func (s *ScopeMapPropertiesUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. +func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "actions": - err = unpopulate(val, "Actions", &s.Actions) + case "id": + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &s.Description) + case "name": + err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScopeMapUpdateParameters. -func (s ScopeMapUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "properties", s.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScopeMapUpdateParameters. -func (s *ScopeMapUpdateParameters) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { case "properties": - err = unpopulate(val, "Properties", &s.Properties) + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SecretObject. -func (s SecretObject) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. +func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "type", s.Type) - populate(objectMap, "value", s.Value) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SecretObject. -func (s *SecretObject) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceListResult. +func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "type": - err = unpopulate(val, "Type", &s.Type) + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &s.Value) + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SetValue. -func (s SetValue) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "isSecret", s.IsSecret) - populate(objectMap, "name", s.Name) - populate(objectMap, "value", s.Value) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "requiredMembers", p.RequiredMembers) + populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SetValue. -func (s *SetValue) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. +func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "isSecret": - err = unpopulate(val, "IsSecret", &s.IsSecret) + case "groupId": + err = unpopulate(val, "GroupID", &p.GroupID) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) + case "requiredMembers": + err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) + case "requiredZoneNames": + err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SoftDeletePolicy. -func (s SoftDeletePolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionState. +func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "lastUpdatedTime", s.LastUpdatedTime) - populate(objectMap, "retentionDays", s.RetentionDays) - populate(objectMap, "status", s.Status) + populate(objectMap, "actionsRequired", p.ActionsRequired) + populate(objectMap, "description", p.Description) + populate(objectMap, "status", p.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SoftDeletePolicy. -func (s *SoftDeletePolicy) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionState. +func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "lastUpdatedTime": - err = unpopulateTimeRFC3339(val, "LastUpdatedTime", &s.LastUpdatedTime) + case "actionsRequired": + err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) delete(rawMsg, key) - case "retentionDays": - err = unpopulate(val, "RetentionDays", &s.RetentionDays) + case "description": + err = unpopulate(val, "Description", &p.Description) delete(rawMsg, key) case "status": - err = unpopulate(val, "Status", &s.Status) + err = unpopulate(val, "Status", &p.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Source. -func (s Source) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProxyResource. +func (p ProxyResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "addr", s.Addr) - populate(objectMap, "instanceID", s.InstanceID) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Source. -func (s *Source) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. +func (p *ProxyResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "addr": - err = unpopulate(val, "Addr", &s.Addr) + case "id": + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) - case "instanceID": - err = unpopulate(val, "InstanceID", &s.InstanceID) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SourceProperties. -func (s SourceProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type QuarantinePolicy. +func (q QuarantinePolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "branch", s.Branch) - populate(objectMap, "repositoryUrl", s.RepositoryURL) - populate(objectMap, "sourceControlAuthProperties", s.SourceControlAuthProperties) - populate(objectMap, "sourceControlType", s.SourceControlType) + populate(objectMap, "status", q.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SourceProperties. -func (s *SourceProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type QuarantinePolicy. +func (q *QuarantinePolicy) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", q, err) } for key, val := range rawMsg { var err error switch key { - case "branch": - err = unpopulate(val, "Branch", &s.Branch) - delete(rawMsg, key) - case "repositoryUrl": - err = unpopulate(val, "RepositoryURL", &s.RepositoryURL) - delete(rawMsg, key) - case "sourceControlAuthProperties": - err = unpopulate(val, "SourceControlAuthProperties", &s.SourceControlAuthProperties) - delete(rawMsg, key) - case "sourceControlType": - err = unpopulate(val, "SourceControlType", &s.SourceControlType) + case "status": + err = unpopulate(val, "Status", &q.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", q, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SourceRegistryCredentials. -func (s SourceRegistryCredentials) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RegenerateCredentialParameters. +func (r RegenerateCredentialParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "loginMode", s.LoginMode) + populate(objectMap, "name", r.Name) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SourceRegistryCredentials. -func (s *SourceRegistryCredentials) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RegenerateCredentialParameters. +func (r *RegenerateCredentialParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "loginMode": - err = unpopulate(val, "LoginMode", &s.LoginMode) + case "name": + err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SourceTrigger. -func (s SourceTrigger) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Registry. +func (r Registry) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", s.Name) - populate(objectMap, "sourceRepository", s.SourceRepository) - populate(objectMap, "sourceTriggerEvents", s.SourceTriggerEvents) - populate(objectMap, "status", s.Status) + populate(objectMap, "id", r.ID) + populate(objectMap, "identity", r.Identity) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "sku", r.SKU) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SourceTrigger. -func (s *SourceTrigger) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Registry. +func (r *Registry) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &r.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &s.Name) + err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) - case "sourceRepository": - err = unpopulate(val, "SourceRepository", &s.SourceRepository) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) delete(rawMsg, key) - case "sourceTriggerEvents": - err = unpopulate(val, "SourceTriggerEvents", &s.SourceTriggerEvents) + case "sku": + err = unpopulate(val, "SKU", &r.SKU) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &s.Status) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SourceTriggerDescriptor. -func (s SourceTriggerDescriptor) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RegistryListCredentialsResult. +func (r RegistryListCredentialsResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "branchName", s.BranchName) - populate(objectMap, "commitId", s.CommitID) - populate(objectMap, "eventType", s.EventType) - populate(objectMap, "id", s.ID) - populate(objectMap, "providerType", s.ProviderType) - populate(objectMap, "pullRequestId", s.PullRequestID) - populate(objectMap, "repositoryUrl", s.RepositoryURL) + populate(objectMap, "passwords", r.Passwords) + populate(objectMap, "username", r.Username) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SourceTriggerDescriptor. -func (s *SourceTriggerDescriptor) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryListCredentialsResult. +func (r *RegistryListCredentialsResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "branchName": - err = unpopulate(val, "BranchName", &s.BranchName) - delete(rawMsg, key) - case "commitId": - err = unpopulate(val, "CommitID", &s.CommitID) - delete(rawMsg, key) - case "eventType": - err = unpopulate(val, "EventType", &s.EventType) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "providerType": - err = unpopulate(val, "ProviderType", &s.ProviderType) - delete(rawMsg, key) - case "pullRequestId": - err = unpopulate(val, "PullRequestID", &s.PullRequestID) + case "passwords": + err = unpopulate(val, "Passwords", &r.Passwords) delete(rawMsg, key) - case "repositoryUrl": - err = unpopulate(val, "RepositoryURL", &s.RepositoryURL) + case "username": + err = unpopulate(val, "Username", &r.Username) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SourceTriggerUpdateParameters. -func (s SourceTriggerUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RegistryListResult. +func (r RegistryListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", s.Name) - populate(objectMap, "sourceRepository", s.SourceRepository) - populate(objectMap, "sourceTriggerEvents", s.SourceTriggerEvents) - populate(objectMap, "status", s.Status) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SourceTriggerUpdateParameters. -func (s *SourceTriggerUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryListResult. +func (r *RegistryListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "sourceRepository": - err = unpopulate(val, "SourceRepository", &s.SourceRepository) - delete(rawMsg, key) - case "sourceTriggerEvents": - err = unpopulate(val, "SourceTriggerEvents", &s.SourceTriggerEvents) + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &s.Status) + case "value": + err = unpopulate(val, "Value", &r.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SourceUpdateParameters. -func (s SourceUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RegistryNameCheckRequest. +func (r RegistryNameCheckRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "branch", s.Branch) - populate(objectMap, "repositoryUrl", s.RepositoryURL) - populate(objectMap, "sourceControlAuthProperties", s.SourceControlAuthProperties) - populate(objectMap, "sourceControlType", s.SourceControlType) + populate(objectMap, "name", r.Name) + objectMap["type"] = "Microsoft.ContainerRegistry/registries" return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SourceUpdateParameters. -func (s *SourceUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryNameCheckRequest. +func (r *RegistryNameCheckRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "branch": - err = unpopulate(val, "Branch", &s.Branch) - delete(rawMsg, key) - case "repositoryUrl": - err = unpopulate(val, "RepositoryURL", &s.RepositoryURL) - delete(rawMsg, key) - case "sourceControlAuthProperties": - err = unpopulate(val, "SourceControlAuthProperties", &s.SourceControlAuthProperties) + case "name": + err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) - case "sourceControlType": - err = unpopulate(val, "SourceControlType", &s.SourceControlType) + case "type": + err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SourceUploadDefinition. -func (s SourceUploadDefinition) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RegistryNameStatus. +func (r RegistryNameStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "relativePath", s.RelativePath) - populate(objectMap, "uploadUrl", s.UploadURL) + populate(objectMap, "message", r.Message) + populate(objectMap, "nameAvailable", r.NameAvailable) + populate(objectMap, "reason", r.Reason) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SourceUploadDefinition. -func (s *SourceUploadDefinition) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryNameStatus. +func (r *RegistryNameStatus) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "relativePath": - err = unpopulate(val, "RelativePath", &s.RelativePath) + case "message": + err = unpopulate(val, "Message", &r.Message) delete(rawMsg, key) - case "uploadUrl": - err = unpopulate(val, "UploadURL", &s.UploadURL) + case "nameAvailable": + err = unpopulate(val, "NameAvailable", &r.NameAvailable) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &r.Reason) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Status. -func (s Status) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RegistryPassword. +func (r RegistryPassword) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "displayStatus", s.DisplayStatus) - populate(objectMap, "message", s.Message) - populateTimeRFC3339(objectMap, "timestamp", s.Timestamp) + populate(objectMap, "name", r.Name) + populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Status. -func (s *Status) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryPassword. +func (r *RegistryPassword) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error - switch key { - case "displayStatus": - err = unpopulate(val, "DisplayStatus", &s.DisplayStatus) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &s.Message) + switch key { + case "name": + err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) - case "timestamp": - err = unpopulateTimeRFC3339(val, "Timestamp", &s.Timestamp) + case "value": + err = unpopulate(val, "Value", &r.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StatusDetailProperties. -func (s StatusDetailProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RegistryProperties. +func (r RegistryProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "code", s.Code) - populate(objectMap, "correlationId", s.CorrelationID) - populate(objectMap, "description", s.Description) - populateTimeRFC3339(objectMap, "timestamp", s.Timestamp) - populate(objectMap, "type", s.Type) + populate(objectMap, "adminUserEnabled", r.AdminUserEnabled) + populateTimeRFC3339(objectMap, "creationDate", r.CreationDate) + populate(objectMap, "dataEndpointEnabled", r.DataEndpointEnabled) + populate(objectMap, "dataEndpointHostNames", r.DataEndpointHostNames) + populate(objectMap, "encryption", r.Encryption) + populate(objectMap, "loginServer", r.LoginServer) + populate(objectMap, "networkRuleBypassOptions", r.NetworkRuleBypassOptions) + populate(objectMap, "networkRuleSet", r.NetworkRuleSet) + populate(objectMap, "policies", r.Policies) + populate(objectMap, "privateEndpointConnections", r.PrivateEndpointConnections) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "publicNetworkAccess", r.PublicNetworkAccess) + populate(objectMap, "status", r.Status) + populate(objectMap, "zoneRedundancy", r.ZoneRedundancy) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StatusDetailProperties. -func (s *StatusDetailProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryProperties. +func (r *RegistryProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "code": - err = unpopulate(val, "Code", &s.Code) + case "adminUserEnabled": + err = unpopulate(val, "AdminUserEnabled", &r.AdminUserEnabled) delete(rawMsg, key) - case "correlationId": - err = unpopulate(val, "CorrelationID", &s.CorrelationID) + case "creationDate": + err = unpopulateTimeRFC3339(val, "CreationDate", &r.CreationDate) delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &s.Description) + case "dataEndpointEnabled": + err = unpopulate(val, "DataEndpointEnabled", &r.DataEndpointEnabled) delete(rawMsg, key) - case "timestamp": - err = unpopulateTimeRFC3339(val, "Timestamp", &s.Timestamp) + case "dataEndpointHostNames": + err = unpopulate(val, "DataEndpointHostNames", &r.DataEndpointHostNames) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) + case "encryption": + err = unpopulate(val, "Encryption", &r.Encryption) + delete(rawMsg, key) + case "loginServer": + err = unpopulate(val, "LoginServer", &r.LoginServer) + delete(rawMsg, key) + case "networkRuleBypassOptions": + err = unpopulate(val, "NetworkRuleBypassOptions", &r.NetworkRuleBypassOptions) + delete(rawMsg, key) + case "networkRuleSet": + err = unpopulate(val, "NetworkRuleSet", &r.NetworkRuleSet) + delete(rawMsg, key) + case "policies": + err = unpopulate(val, "Policies", &r.Policies) + delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &r.PrivateEndpointConnections) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &r.PublicNetworkAccess) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + delete(rawMsg, key) + case "zoneRedundancy": + err = unpopulate(val, "ZoneRedundancy", &r.ZoneRedundancy) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StorageAccountProperties. -func (s StorageAccountProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RegistryPropertiesUpdateParameters. +func (r RegistryPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) + populate(objectMap, "adminUserEnabled", r.AdminUserEnabled) + populate(objectMap, "dataEndpointEnabled", r.DataEndpointEnabled) + populate(objectMap, "encryption", r.Encryption) + populate(objectMap, "networkRuleBypassOptions", r.NetworkRuleBypassOptions) + populate(objectMap, "networkRuleSet", r.NetworkRuleSet) + populate(objectMap, "policies", r.Policies) + populate(objectMap, "publicNetworkAccess", r.PublicNetworkAccess) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageAccountProperties. -func (s *StorageAccountProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryPropertiesUpdateParameters. +func (r *RegistryPropertiesUpdateParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) + case "adminUserEnabled": + err = unpopulate(val, "AdminUserEnabled", &r.AdminUserEnabled) + delete(rawMsg, key) + case "dataEndpointEnabled": + err = unpopulate(val, "DataEndpointEnabled", &r.DataEndpointEnabled) + delete(rawMsg, key) + case "encryption": + err = unpopulate(val, "Encryption", &r.Encryption) + delete(rawMsg, key) + case "networkRuleBypassOptions": + err = unpopulate(val, "NetworkRuleBypassOptions", &r.NetworkRuleBypassOptions) + delete(rawMsg, key) + case "networkRuleSet": + err = unpopulate(val, "NetworkRuleSet", &r.NetworkRuleSet) + delete(rawMsg, key) + case "policies": + err = unpopulate(val, "Policies", &r.Policies) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &r.PublicNetworkAccess) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SyncProperties. -func (s SyncProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RegistryUpdateParameters. +func (r RegistryUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "gatewayEndpoint", s.GatewayEndpoint) - populateTimeRFC3339(objectMap, "lastSyncTime", s.LastSyncTime) - populate(objectMap, "messageTtl", s.MessageTTL) - populate(objectMap, "schedule", s.Schedule) - populate(objectMap, "syncWindow", s.SyncWindow) - populate(objectMap, "tokenId", s.TokenID) + populate(objectMap, "identity", r.Identity) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "sku", r.SKU) + populate(objectMap, "tags", r.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SyncProperties. -func (s *SyncProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryUpdateParameters. +func (r *RegistryUpdateParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "gatewayEndpoint": - err = unpopulate(val, "GatewayEndpoint", &s.GatewayEndpoint) - delete(rawMsg, key) - case "lastSyncTime": - err = unpopulateTimeRFC3339(val, "LastSyncTime", &s.LastSyncTime) - delete(rawMsg, key) - case "messageTtl": - err = unpopulate(val, "MessageTTL", &s.MessageTTL) + case "identity": + err = unpopulate(val, "Identity", &r.Identity) delete(rawMsg, key) - case "schedule": - err = unpopulate(val, "Schedule", &s.Schedule) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) delete(rawMsg, key) - case "syncWindow": - err = unpopulate(val, "SyncWindow", &s.SyncWindow) + case "sku": + err = unpopulate(val, "SKU", &r.SKU) delete(rawMsg, key) - case "tokenId": - err = unpopulate(val, "TokenID", &s.TokenID) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SyncUpdateProperties. -func (s SyncUpdateProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RegistryUsage. +func (r RegistryUsage) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "messageTtl", s.MessageTTL) - populate(objectMap, "schedule", s.Schedule) - populate(objectMap, "syncWindow", s.SyncWindow) + populate(objectMap, "currentValue", r.CurrentValue) + populate(objectMap, "limit", r.Limit) + populate(objectMap, "name", r.Name) + populate(objectMap, "unit", r.Unit) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SyncUpdateProperties. -func (s *SyncUpdateProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryUsage. +func (r *RegistryUsage) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "messageTtl": - err = unpopulate(val, "MessageTTL", &s.MessageTTL) + case "currentValue": + err = unpopulate(val, "CurrentValue", &r.CurrentValue) + delete(rawMsg, key) + case "limit": + err = unpopulate(val, "Limit", &r.Limit) delete(rawMsg, key) - case "schedule": - err = unpopulate(val, "Schedule", &s.Schedule) + case "name": + err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) - case "syncWindow": - err = unpopulate(val, "SyncWindow", &s.SyncWindow) + case "unit": + err = unpopulate(val, "Unit", &r.Unit) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RegistryUsageListResult. +func (r RegistryUsageListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) - populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. -func (s *SystemData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryUsageListResult. +func (r *RegistryUsageListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + case "value": + err = unpopulate(val, "Value", &r.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TLSCertificateProperties. -func (t TLSCertificateProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Replication. +func (r Replication) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "location", t.Location) - populate(objectMap, "type", t.Type) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TLSCertificateProperties. -func (t *TLSCertificateProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Replication. +func (r *Replication) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) case "location": - err = unpopulate(val, "Location", &t.Location) + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &t.Type) + err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TLSProperties. -func (t TLSProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ReplicationListResult. +func (r ReplicationListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "certificate", t.Certificate) - populate(objectMap, "status", t.Status) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TLSProperties. -func (t *TLSProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationListResult. +func (r *ReplicationListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "certificate": - err = unpopulate(val, "Certificate", &t.Certificate) + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &t.Status) + case "value": + err = unpopulate(val, "Value", &r.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Target. -func (t Target) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ReplicationProperties. +func (r ReplicationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "digest", t.Digest) - populate(objectMap, "length", t.Length) - populate(objectMap, "mediaType", t.MediaType) - populate(objectMap, "name", t.Name) - populate(objectMap, "repository", t.Repository) - populate(objectMap, "size", t.Size) - populate(objectMap, "tag", t.Tag) - populate(objectMap, "url", t.URL) - populate(objectMap, "version", t.Version) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "regionEndpointEnabled", r.RegionEndpointEnabled) + populate(objectMap, "status", r.Status) + populate(objectMap, "zoneRedundancy", r.ZoneRedundancy) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Target. -func (t *Target) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationProperties. +func (r *ReplicationProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "digest": - err = unpopulate(val, "Digest", &t.Digest) - delete(rawMsg, key) - case "length": - err = unpopulate(val, "Length", &t.Length) - delete(rawMsg, key) - case "mediaType": - err = unpopulate(val, "MediaType", &t.MediaType) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) - delete(rawMsg, key) - case "repository": - err = unpopulate(val, "Repository", &t.Repository) - delete(rawMsg, key) - case "size": - err = unpopulate(val, "Size", &t.Size) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) delete(rawMsg, key) - case "tag": - err = unpopulate(val, "Tag", &t.Tag) + case "regionEndpointEnabled": + err = unpopulate(val, "RegionEndpointEnabled", &r.RegionEndpointEnabled) delete(rawMsg, key) - case "url": - err = unpopulate(val, "URL", &t.URL) + case "status": + err = unpopulate(val, "Status", &r.Status) delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &t.Version) + case "zoneRedundancy": + err = unpopulate(val, "ZoneRedundancy", &r.ZoneRedundancy) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Task. -func (t Task) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ReplicationUpdateParameters. +func (r ReplicationUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", t.ID) - populate(objectMap, "identity", t.Identity) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "properties", t.Properties) - populate(objectMap, "systemData", t.SystemData) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "tags", r.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Task. -func (t *Task) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationUpdateParameters. +func (r *ReplicationUpdateParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &t.ID) - delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &t.Identity) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &t.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) - delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &t.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &t.SystemData) + err = unpopulate(val, "Properties", &r.Properties) delete(rawMsg, key) case "tags": - err = unpopulate(val, "Tags", &t.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) + err = unpopulate(val, "Tags", &r.Tags) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TaskListResult. -func (t TaskListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ReplicationUpdateParametersProperties. +func (r ReplicationUpdateParametersProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", t.NextLink) - populate(objectMap, "value", t.Value) + populate(objectMap, "regionEndpointEnabled", r.RegionEndpointEnabled) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TaskListResult. -func (t *TaskListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationUpdateParametersProperties. +func (r *ReplicationUpdateParametersProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &t.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &t.Value) + case "regionEndpointEnabled": + err = unpopulate(val, "RegionEndpointEnabled", &r.RegionEndpointEnabled) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TaskProperties. -func (t TaskProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Request. +func (r Request) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "agentConfiguration", t.AgentConfiguration) - populate(objectMap, "agentPoolName", t.AgentPoolName) - populateTimeRFC3339(objectMap, "creationDate", t.CreationDate) - populate(objectMap, "credentials", t.Credentials) - populate(objectMap, "isSystemTask", t.IsSystemTask) - populate(objectMap, "logTemplate", t.LogTemplate) - populate(objectMap, "platform", t.Platform) - populate(objectMap, "provisioningState", t.ProvisioningState) - populate(objectMap, "status", t.Status) - populate(objectMap, "step", t.Step) - populate(objectMap, "timeout", t.Timeout) - populate(objectMap, "trigger", t.Trigger) + populate(objectMap, "addr", r.Addr) + populate(objectMap, "host", r.Host) + populate(objectMap, "id", r.ID) + populate(objectMap, "method", r.Method) + populate(objectMap, "useragent", r.Useragent) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TaskProperties. -func (t *TaskProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Request. +func (r *Request) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "agentConfiguration": - err = unpopulate(val, "AgentConfiguration", &t.AgentConfiguration) - delete(rawMsg, key) - case "agentPoolName": - err = unpopulate(val, "AgentPoolName", &t.AgentPoolName) - delete(rawMsg, key) - case "creationDate": - err = unpopulateTimeRFC3339(val, "CreationDate", &t.CreationDate) - delete(rawMsg, key) - case "credentials": - err = unpopulate(val, "Credentials", &t.Credentials) - delete(rawMsg, key) - case "isSystemTask": - err = unpopulate(val, "IsSystemTask", &t.IsSystemTask) - delete(rawMsg, key) - case "logTemplate": - err = unpopulate(val, "LogTemplate", &t.LogTemplate) - delete(rawMsg, key) - case "platform": - err = unpopulate(val, "Platform", &t.Platform) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &t.ProvisioningState) + case "addr": + err = unpopulate(val, "Addr", &r.Addr) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &t.Status) + case "host": + err = unpopulate(val, "Host", &r.Host) delete(rawMsg, key) - case "step": - t.Step, err = unmarshalTaskStepPropertiesClassification(val) + case "id": + err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) - case "timeout": - err = unpopulate(val, "Timeout", &t.Timeout) + case "method": + err = unpopulate(val, "Method", &r.Method) delete(rawMsg, key) - case "trigger": - err = unpopulate(val, "Trigger", &t.Trigger) + case "useragent": + err = unpopulate(val, "Useragent", &r.Useragent) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TaskPropertiesUpdateParameters. -func (t TaskPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "agentConfiguration", t.AgentConfiguration) - populate(objectMap, "agentPoolName", t.AgentPoolName) - populate(objectMap, "credentials", t.Credentials) - populate(objectMap, "logTemplate", t.LogTemplate) - populate(objectMap, "platform", t.Platform) - populate(objectMap, "status", t.Status) - populate(objectMap, "step", t.Step) - populate(objectMap, "timeout", t.Timeout) - populate(objectMap, "trigger", t.Trigger) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TaskPropertiesUpdateParameters. -func (t *TaskPropertiesUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. +func (r *Resource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "agentConfiguration": - err = unpopulate(val, "AgentConfiguration", &t.AgentConfiguration) - delete(rawMsg, key) - case "agentPoolName": - err = unpopulate(val, "AgentPoolName", &t.AgentPoolName) - delete(rawMsg, key) - case "credentials": - err = unpopulate(val, "Credentials", &t.Credentials) - delete(rawMsg, key) - case "logTemplate": - err = unpopulate(val, "LogTemplate", &t.LogTemplate) + case "id": + err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) - case "platform": - err = unpopulate(val, "Platform", &t.Platform) + case "location": + err = unpopulate(val, "Location", &r.Location) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &t.Status) + case "name": + err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) - case "step": - t.Step, err = unmarshalTaskStepUpdateParametersClassification(val) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) delete(rawMsg, key) - case "timeout": - err = unpopulate(val, "Timeout", &t.Timeout) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) delete(rawMsg, key) - case "trigger": - err = unpopulate(val, "Trigger", &t.Trigger) + case "type": + err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TaskRun. -func (t TaskRun) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RetentionPolicy. +func (r RetentionPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", t.ID) - populate(objectMap, "identity", t.Identity) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "properties", t.Properties) - populate(objectMap, "systemData", t.SystemData) - populate(objectMap, "type", t.Type) + populate(objectMap, "days", r.Days) + populateTimeRFC3339(objectMap, "lastUpdatedTime", r.LastUpdatedTime) + populate(objectMap, "status", r.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TaskRun. -func (t *TaskRun) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RetentionPolicy. +func (r *RetentionPolicy) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &t.ID) - delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &t.Identity) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &t.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &t.Properties) + case "days": + err = unpopulate(val, "Days", &r.Days) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &t.SystemData) + case "lastUpdatedTime": + err = unpopulateTimeRFC3339(val, "LastUpdatedTime", &r.LastUpdatedTime) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) + case "status": + err = unpopulate(val, "Status", &r.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TaskRunListResult. -func (t TaskRunListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SKU. +func (s SKU) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", t.NextLink) - populate(objectMap, "value", t.Value) + populate(objectMap, "name", s.Name) + populate(objectMap, "tier", s.Tier) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TaskRunListResult. -func (t *TaskRunListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SKU. +func (s *SKU) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &t.NextLink) + case "name": + err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &t.Value) + case "tier": + err = unpopulate(val, "Tier", &s.Tier) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TaskRunProperties. -func (t TaskRunProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ScopeMap. +func (s ScopeMap) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "forceUpdateTag", t.ForceUpdateTag) - populate(objectMap, "provisioningState", t.ProvisioningState) - populate(objectMap, "runRequest", t.RunRequest) - populate(objectMap, "runResult", t.RunResult) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TaskRunProperties. -func (t *TaskRunProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ScopeMap. +func (s *ScopeMap) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "forceUpdateTag": - err = unpopulate(val, "ForceUpdateTag", &t.ForceUpdateTag) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &t.ProvisioningState) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) - case "runRequest": - t.RunRequest, err = unmarshalRunRequestClassification(val) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) delete(rawMsg, key) - case "runResult": - err = unpopulate(val, "RunResult", &t.RunResult) + case "type": + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TaskRunPropertiesUpdateParameters. -func (t TaskRunPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ScopeMapListResult. +func (s ScopeMapListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "forceUpdateTag", t.ForceUpdateTag) - populate(objectMap, "runRequest", t.RunRequest) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TaskRunPropertiesUpdateParameters. -func (t *TaskRunPropertiesUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ScopeMapListResult. +func (s *ScopeMapListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "forceUpdateTag": - err = unpopulate(val, "ForceUpdateTag", &t.ForceUpdateTag) + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) delete(rawMsg, key) - case "runRequest": - t.RunRequest, err = unmarshalRunRequestClassification(val) + case "value": + err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TaskRunRequest. -func (t TaskRunRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ScopeMapProperties. +func (s ScopeMapProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "agentPoolName", t.AgentPoolName) - populate(objectMap, "isArchiveEnabled", t.IsArchiveEnabled) - populate(objectMap, "logTemplate", t.LogTemplate) - populate(objectMap, "overrideTaskStepProperties", t.OverrideTaskStepProperties) - populate(objectMap, "taskId", t.TaskID) - objectMap["type"] = "TaskRunRequest" + populate(objectMap, "actions", s.Actions) + populateTimeRFC3339(objectMap, "creationDate", s.CreationDate) + populate(objectMap, "description", s.Description) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TaskRunRequest. -func (t *TaskRunRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ScopeMapProperties. +func (s *ScopeMapProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "agentPoolName": - err = unpopulate(val, "AgentPoolName", &t.AgentPoolName) - delete(rawMsg, key) - case "isArchiveEnabled": - err = unpopulate(val, "IsArchiveEnabled", &t.IsArchiveEnabled) + case "actions": + err = unpopulate(val, "Actions", &s.Actions) delete(rawMsg, key) - case "logTemplate": - err = unpopulate(val, "LogTemplate", &t.LogTemplate) + case "creationDate": + err = unpopulateTimeRFC3339(val, "CreationDate", &s.CreationDate) delete(rawMsg, key) - case "overrideTaskStepProperties": - err = unpopulate(val, "OverrideTaskStepProperties", &t.OverrideTaskStepProperties) + case "description": + err = unpopulate(val, "Description", &s.Description) delete(rawMsg, key) - case "taskId": - err = unpopulate(val, "TaskID", &t.TaskID) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &t.Type) + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TaskRunUpdateParameters. -func (t TaskRunUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ScopeMapPropertiesUpdateParameters. +func (s ScopeMapPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "identity", t.Identity) - populate(objectMap, "location", t.Location) - populate(objectMap, "properties", t.Properties) - populate(objectMap, "tags", t.Tags) + populate(objectMap, "actions", s.Actions) + populate(objectMap, "description", s.Description) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TaskRunUpdateParameters. -func (t *TaskRunUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ScopeMapPropertiesUpdateParameters. +func (s *ScopeMapPropertiesUpdateParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "identity": - err = unpopulate(val, "Identity", &t.Identity) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &t.Location) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &t.Properties) + case "actions": + err = unpopulate(val, "Actions", &s.Actions) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &t.Tags) + case "description": + err = unpopulate(val, "Description", &s.Description) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TaskStepProperties. -func (t TaskStepProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ScopeMapUpdateParameters. +func (s ScopeMapUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "baseImageDependencies", t.BaseImageDependencies) - populate(objectMap, "contextAccessToken", t.ContextAccessToken) - populate(objectMap, "contextPath", t.ContextPath) - objectMap["type"] = t.Type + populate(objectMap, "properties", s.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TaskStepProperties. -func (t *TaskStepProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ScopeMapUpdateParameters. +func (s *ScopeMapUpdateParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "baseImageDependencies": - err = unpopulate(val, "BaseImageDependencies", &t.BaseImageDependencies) - delete(rawMsg, key) - case "contextAccessToken": - err = unpopulate(val, "ContextAccessToken", &t.ContextAccessToken) - delete(rawMsg, key) - case "contextPath": - err = unpopulate(val, "ContextPath", &t.ContextPath) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TaskStepUpdateParameters. -func (t TaskStepUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Source. +func (s Source) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "contextAccessToken", t.ContextAccessToken) - populate(objectMap, "contextPath", t.ContextPath) - objectMap["type"] = t.Type + populate(objectMap, "addr", s.Addr) + populate(objectMap, "instanceID", s.InstanceID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TaskStepUpdateParameters. -func (t *TaskStepUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Source. +func (s *Source) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "contextAccessToken": - err = unpopulate(val, "ContextAccessToken", &t.ContextAccessToken) - delete(rawMsg, key) - case "contextPath": - err = unpopulate(val, "ContextPath", &t.ContextPath) + case "addr": + err = unpopulate(val, "Addr", &s.Addr) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) + case "instanceID": + err = unpopulate(val, "InstanceID", &s.InstanceID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TaskUpdateParameters. -func (t TaskUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Status. +func (s Status) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "identity", t.Identity) - populate(objectMap, "properties", t.Properties) - populate(objectMap, "tags", t.Tags) + populate(objectMap, "displayStatus", s.DisplayStatus) + populate(objectMap, "message", s.Message) + populateTimeRFC3339(objectMap, "timestamp", s.Timestamp) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TaskUpdateParameters. -func (t *TaskUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Status. +func (s *Status) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "identity": - err = unpopulate(val, "Identity", &t.Identity) + case "displayStatus": + err = unpopulate(val, "DisplayStatus", &s.DisplayStatus) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &t.Properties) + case "message": + err = unpopulate(val, "Message", &s.Message) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &t.Tags) + case "timestamp": + err = unpopulateTimeRFC3339(val, "Timestamp", &s.Timestamp) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TimerTrigger. -func (t TimerTrigger) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StorageAccountProperties. +func (s StorageAccountProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", t.Name) - populate(objectMap, "schedule", t.Schedule) - populate(objectMap, "status", t.Status) + populate(objectMap, "id", s.ID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TimerTrigger. -func (t *TimerTrigger) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageAccountProperties. +func (s *StorageAccountProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &t.Name) - delete(rawMsg, key) - case "schedule": - err = unpopulate(val, "Schedule", &t.Schedule) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &t.Status) + case "id": + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TimerTriggerDescriptor. -func (t TimerTriggerDescriptor) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "scheduleOccurrence", t.ScheduleOccurrence) - populate(objectMap, "timerTriggerName", t.TimerTriggerName) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TimerTriggerDescriptor. -func (t *TimerTriggerDescriptor) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "scheduleOccurrence": - err = unpopulate(val, "ScheduleOccurrence", &t.ScheduleOccurrence) + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) delete(rawMsg, key) - case "timerTriggerName": - err = unpopulate(val, "TimerTriggerName", &t.TimerTriggerName) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TimerTriggerUpdateParameters. -func (t TimerTriggerUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Target. +func (t Target) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "digest", t.Digest) + populate(objectMap, "length", t.Length) + populate(objectMap, "mediaType", t.MediaType) populate(objectMap, "name", t.Name) - populate(objectMap, "schedule", t.Schedule) - populate(objectMap, "status", t.Status) + populate(objectMap, "repository", t.Repository) + populate(objectMap, "size", t.Size) + populate(objectMap, "tag", t.Tag) + populate(objectMap, "url", t.URL) + populate(objectMap, "version", t.Version) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TimerTriggerUpdateParameters. -func (t *TimerTriggerUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Target. +func (t *Target) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -7012,14 +3051,32 @@ func (t *TimerTriggerUpdateParameters) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "digest": + err = unpopulate(val, "Digest", &t.Digest) + delete(rawMsg, key) + case "length": + err = unpopulate(val, "Length", &t.Length) + delete(rawMsg, key) + case "mediaType": + err = unpopulate(val, "MediaType", &t.MediaType) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &t.Name) delete(rawMsg, key) - case "schedule": - err = unpopulate(val, "Schedule", &t.Schedule) + case "repository": + err = unpopulate(val, "Repository", &t.Repository) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &t.Status) + case "size": + err = unpopulate(val, "Size", &t.Size) + delete(rawMsg, key) + case "tag": + err = unpopulate(val, "Tag", &t.Tag) + delete(rawMsg, key) + case "url": + err = unpopulate(val, "URL", &t.URL) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &t.Version) delete(rawMsg, key) } if err != nil { @@ -7317,76 +3374,6 @@ func (t *TokenUpdateProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TriggerProperties. -func (t TriggerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "baseImageTrigger", t.BaseImageTrigger) - populate(objectMap, "sourceTriggers", t.SourceTriggers) - populate(objectMap, "timerTriggers", t.TimerTriggers) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TriggerProperties. -func (t *TriggerProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "baseImageTrigger": - err = unpopulate(val, "BaseImageTrigger", &t.BaseImageTrigger) - delete(rawMsg, key) - case "sourceTriggers": - err = unpopulate(val, "SourceTriggers", &t.SourceTriggers) - delete(rawMsg, key) - case "timerTriggers": - err = unpopulate(val, "TimerTriggers", &t.TimerTriggers) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TriggerUpdateParameters. -func (t TriggerUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "baseImageTrigger", t.BaseImageTrigger) - populate(objectMap, "sourceTriggers", t.SourceTriggers) - populate(objectMap, "timerTriggers", t.TimerTriggers) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TriggerUpdateParameters. -func (t *TriggerUpdateParameters) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "baseImageTrigger": - err = unpopulate(val, "BaseImageTrigger", &t.BaseImageTrigger) - delete(rawMsg, key) - case "sourceTriggers": - err = unpopulate(val, "SourceTriggers", &t.SourceTriggers) - delete(rawMsg, key) - case "timerTriggers": - err = unpopulate(val, "TimerTriggers", &t.TimerTriggers) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type TrustPolicy. func (t TrustPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/operations_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/operations_client.go index cfb61b3985e1..c4678791fc15 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/operations_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/operations_client.go @@ -39,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available Azure Container Registry REST API operations. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -79,7 +79,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/operations_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/operations_client_example_test.go 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/pipelineruns_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/pipelineruns_client.go deleted file mode 100644 index 142b438a75bc..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/pipelineruns_client.go +++ /dev/null @@ -1,334 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcontainerregistry - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// PipelineRunsClient contains the methods for the PipelineRuns group. -// Don't use this type directly, use NewPipelineRunsClient() instead. -type PipelineRunsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewPipelineRunsClient creates a new instance of PipelineRunsClient with the specified values. -// - subscriptionID - The ID of the target subscription. The value must be an UUID. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewPipelineRunsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PipelineRunsClient, error) { - cl, err := arm.NewClient(moduleName+".PipelineRunsClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &PipelineRunsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginCreate - Creates a pipeline run for a container registry with the specified parameters -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - registryName - The name of the container registry. -// - pipelineRunName - The name of the pipeline run. -// - pipelineRunCreateParameters - The parameters for creating a pipeline run. -// - options - PipelineRunsClientBeginCreateOptions contains the optional parameters for the PipelineRunsClient.BeginCreate -// method. -func (client *PipelineRunsClient) BeginCreate(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, pipelineRunCreateParameters PipelineRun, options *PipelineRunsClientBeginCreateOptions) (*runtime.Poller[PipelineRunsClientCreateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, registryName, pipelineRunName, pipelineRunCreateParameters, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PipelineRunsClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken[PipelineRunsClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Create - Creates a pipeline run for a container registry with the specified parameters -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -func (client *PipelineRunsClient) create(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, pipelineRunCreateParameters PipelineRun, options *PipelineRunsClientBeginCreateOptions) (*http.Response, error) { - var err error - const operationName = "PipelineRunsClient.BeginCreate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, pipelineRunName, pipelineRunCreateParameters, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// createCreateRequest creates the Create request. -func (client *PipelineRunsClient) createCreateRequest(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, pipelineRunCreateParameters PipelineRun, options *PipelineRunsClientBeginCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}" - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - if pipelineRunName == "" { - return nil, errors.New("parameter pipelineRunName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{pipelineRunName}", url.PathEscape(pipelineRunName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, pipelineRunCreateParameters); err != nil { - return nil, err - } - return req, nil -} - -// BeginDelete - Deletes a pipeline run from a container registry. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - registryName - The name of the container registry. -// - pipelineRunName - The name of the pipeline run. -// - options - PipelineRunsClientBeginDeleteOptions contains the optional parameters for the PipelineRunsClient.BeginDelete -// method. -func (client *PipelineRunsClient) BeginDelete(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, options *PipelineRunsClientBeginDeleteOptions) (*runtime.Poller[PipelineRunsClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, registryName, pipelineRunName, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PipelineRunsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken[PipelineRunsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Delete - Deletes a pipeline run from a container registry. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -func (client *PipelineRunsClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, options *PipelineRunsClientBeginDeleteOptions) (*http.Response, error) { - var err error - const operationName = "PipelineRunsClient.BeginDelete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, pipelineRunName, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *PipelineRunsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, options *PipelineRunsClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}" - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - if pipelineRunName == "" { - return nil, errors.New("parameter pipelineRunName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{pipelineRunName}", url.PathEscape(pipelineRunName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Gets the detailed information for a given pipeline run. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-01-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - registryName - The name of the container registry. -// - pipelineRunName - The name of the pipeline run. -// - options - PipelineRunsClientGetOptions contains the optional parameters for the PipelineRunsClient.Get method. -func (client *PipelineRunsClient) Get(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, options *PipelineRunsClientGetOptions) (PipelineRunsClientGetResponse, error) { - var err error - const operationName = "PipelineRunsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, pipelineRunName, options) - if err != nil { - return PipelineRunsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PipelineRunsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PipelineRunsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *PipelineRunsClient) getCreateRequest(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, options *PipelineRunsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}" - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - if pipelineRunName == "" { - return nil, errors.New("parameter pipelineRunName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{pipelineRunName}", url.PathEscape(pipelineRunName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *PipelineRunsClient) getHandleResponse(resp *http.Response) (PipelineRunsClientGetResponse, error) { - result := PipelineRunsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PipelineRun); err != nil { - return PipelineRunsClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Lists all the pipeline runs for the specified container registry. -// -// Generated from API version 2023-01-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - registryName - The name of the container registry. -// - options - PipelineRunsClientListOptions contains the optional parameters for the PipelineRunsClient.NewListPager method. -func (client *PipelineRunsClient) NewListPager(resourceGroupName string, registryName string, options *PipelineRunsClientListOptions) *runtime.Pager[PipelineRunsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[PipelineRunsClientListResponse]{ - More: func(page PipelineRunsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *PipelineRunsClientListResponse) (PipelineRunsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PipelineRunsClient.NewListPager") - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, resourceGroupName, registryName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return PipelineRunsClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PipelineRunsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PipelineRunsClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *PipelineRunsClient) listCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *PipelineRunsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/pipelineRuns" - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *PipelineRunsClient) listHandleResponse(resp *http.Response) (PipelineRunsClientListResponse, error) { - result := PipelineRunsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PipelineRunListResult); err != nil { - return PipelineRunsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/pipelineruns_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/pipelineruns_client_example_test.go deleted file mode 100644 index 8c93423998cc..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/pipelineruns_client_example_test.go +++ /dev/null @@ -1,296 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcontainerregistry_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/PipelineRunList.json -func ExamplePipelineRunsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPipelineRunsClient().NewListPager("myResourceGroup", "myRegistry", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PipelineRunListResult = armcontainerregistry.PipelineRunListResult{ - // Value: []*armcontainerregistry.PipelineRun{ - // { - // Name: to.Ptr("myPipelineRun"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/pipelineRuns"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/pipelineRuns/myPipelineRun"), - // Properties: &armcontainerregistry.PipelineRunProperties{ - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Response: &armcontainerregistry.PipelineRunResponse{ - // CatalogDigest: to.Ptr("sha256@"), - // Progress: &armcontainerregistry.ProgressProperties{ - // Percentage: to.Ptr("20"), - // }, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-04T17:23:21.9261521+00:00"); return t}()), - // Status: to.Ptr("Running"), - // Target: &armcontainerregistry.ExportPipelineTargetProperties{ - // Type: to.Ptr("AzureStorageBlob"), - // KeyVaultURI: to.Ptr("https://myvault.vault.azure.net/secrets/acrexportsas"), - // URI: to.Ptr("https://accountname.blob.core.windows.net/containername/myblob.tar.gz"), - // }, - // }, - // Request: &armcontainerregistry.PipelineRunRequest{ - // Artifacts: []*string{ - // to.Ptr("sourceRepository/hello-world"), - // to.Ptr("sourceRepository2@sha256:00000000000000000000000000000000000")}, - // PipelineResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/exportPipelines/myExportPipeline"), - // }, - // }, - // }, - // { - // Name: to.Ptr("myPipelineRun"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/pipelineRuns"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/pipelineRuns/myPipelineRun"), - // Properties: &armcontainerregistry.PipelineRunProperties{ - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Response: &armcontainerregistry.PipelineRunResponse{ - // CatalogDigest: to.Ptr("sha256@"), - // ImportedArtifacts: []*string{ - // to.Ptr("sourceRepository/hello-world"), - // to.Ptr("sourceRepository2@sha256:00000000000000000000000000000000000")}, - // Progress: &armcontainerregistry.ProgressProperties{ - // Percentage: to.Ptr("100"), - // }, - // Source: &armcontainerregistry.ImportPipelineSourceProperties{ - // Type: to.Ptr(armcontainerregistry.PipelineSourceType("AzureStorageBlob")), - // KeyVaultURI: to.Ptr("https://myvault.vault.azure.net/secrets/acrimportsas"), - // URI: to.Ptr("https://accountname.blob.core.windows.net/containername/myblob.tar.gz"), - // }, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-03T17:23:21.9261521+00:00"); return t}()), - // Status: to.Ptr("Succeeded"), - // }, - // Request: &armcontainerregistry.PipelineRunRequest{ - // PipelineResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/importPipelines/myImportPipeline"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/PipelineRunGet.json -func ExamplePipelineRunsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPipelineRunsClient().Get(ctx, "myResourceGroup", "myRegistry", "myPipelineRun", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PipelineRun = armcontainerregistry.PipelineRun{ - // Name: to.Ptr("myPipelineRun"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/pipelineRuns"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/pipelineRuns/myPipelineRun"), - // Properties: &armcontainerregistry.PipelineRunProperties{ - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Response: &armcontainerregistry.PipelineRunResponse{ - // CatalogDigest: to.Ptr("sha256@"), - // Progress: &armcontainerregistry.ProgressProperties{ - // Percentage: to.Ptr("20"), - // }, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-04T17:23:21.9261521+00:00"); return t}()), - // Status: to.Ptr("Running"), - // Target: &armcontainerregistry.ExportPipelineTargetProperties{ - // Type: to.Ptr("AzureStorageBlob"), - // KeyVaultURI: to.Ptr("https://myvault.vault.azure.net/secrets/acrexportsas"), - // URI: to.Ptr("https://accountname.blob.core.windows.net/containername/myblob.tar.gz"), - // }, - // }, - // Request: &armcontainerregistry.PipelineRunRequest{ - // Artifacts: []*string{ - // to.Ptr("sourceRepository/hello-world"), - // to.Ptr("sourceRepository2@sha256:00000000000000000000000000000000000")}, - // PipelineResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/exportPipelines/myExportPipeline"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/PipelineRunCreate_Export.json -func ExamplePipelineRunsClient_BeginCreate_pipelineRunCreateExport() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPipelineRunsClient().BeginCreate(ctx, "myResourceGroup", "myRegistry", "myPipelineRun", armcontainerregistry.PipelineRun{ - Properties: &armcontainerregistry.PipelineRunProperties{ - Request: &armcontainerregistry.PipelineRunRequest{ - Artifacts: []*string{ - to.Ptr("sourceRepository/hello-world"), - to.Ptr("sourceRepository2@sha256:00000000000000000000000000000000000")}, - PipelineResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/exportPipelines/myExportPipeline"), - Target: &armcontainerregistry.PipelineRunTargetProperties{ - Name: to.Ptr("myblob.tar.gz"), - Type: to.Ptr(armcontainerregistry.PipelineRunTargetTypeAzureStorageBlob), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PipelineRun = armcontainerregistry.PipelineRun{ - // Name: to.Ptr("myPipelineRun"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/pipelineRuns"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/pipelineRuns/myPipelineRun"), - // Properties: &armcontainerregistry.PipelineRunProperties{ - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Response: &armcontainerregistry.PipelineRunResponse{ - // CatalogDigest: to.Ptr("sha256@"), - // Progress: &armcontainerregistry.ProgressProperties{ - // Percentage: to.Ptr("20"), - // }, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-04T17:23:21.9261521+00:00"); return t}()), - // Status: to.Ptr("Running"), - // Target: &armcontainerregistry.ExportPipelineTargetProperties{ - // Type: to.Ptr("AzureStorageBlob"), - // KeyVaultURI: to.Ptr("https://myvault.vault.azure.net/secrets/acrexportsas"), - // URI: to.Ptr("https://accountname.blob.core.windows.net/containername/myblob.tar.gz"), - // }, - // }, - // Request: &armcontainerregistry.PipelineRunRequest{ - // Artifacts: []*string{ - // to.Ptr("sourceRepository/hello-world"), - // to.Ptr("sourceRepository2@sha256:00000000000000000000000000000000000")}, - // PipelineResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/exportPipelines/myExportPipeline"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/PipelineRunCreate_Import.json -func ExamplePipelineRunsClient_BeginCreate_pipelineRunCreateImport() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPipelineRunsClient().BeginCreate(ctx, "myResourceGroup", "myRegistry", "myPipelineRun", armcontainerregistry.PipelineRun{ - Properties: &armcontainerregistry.PipelineRunProperties{ - ForceUpdateTag: to.Ptr("2020-03-04T17:23:21.9261521+00:00"), - Request: &armcontainerregistry.PipelineRunRequest{ - CatalogDigest: to.Ptr("sha256@"), - PipelineResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/importPipelines/myImportPipeline"), - Source: &armcontainerregistry.PipelineRunSourceProperties{ - Name: to.Ptr("myblob.tar.gz"), - Type: to.Ptr(armcontainerregistry.PipelineRunSourceTypeAzureStorageBlob), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PipelineRun = armcontainerregistry.PipelineRun{ - // Name: to.Ptr("myPipelineRun"), - // Type: to.Ptr("Microsoft.ContainerRegistry/registries/pipelineRuns"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/pipelineRuns/myPipelineRun"), - // Properties: &armcontainerregistry.PipelineRunProperties{ - // ProvisioningState: to.Ptr(armcontainerregistry.ProvisioningStateSucceeded), - // Response: &armcontainerregistry.PipelineRunResponse{ - // CatalogDigest: to.Ptr("sha256@"), - // ImportedArtifacts: []*string{ - // to.Ptr("sourceRepository/hello-world"), - // to.Ptr("sourceRepository2@sha256:00000000000000000000000000000000000")}, - // Progress: &armcontainerregistry.ProgressProperties{ - // Percentage: to.Ptr("100"), - // }, - // Source: &armcontainerregistry.ImportPipelineSourceProperties{ - // Type: to.Ptr(armcontainerregistry.PipelineSourceType("AzureStorageBlob")), - // KeyVaultURI: to.Ptr("https://myvault.vault.azure.net/secrets/acrimportsas"), - // URI: to.Ptr("https://accountname.blob.core.windows.net/containername/myblob.tar.gz"), - // }, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-03-04T17:23:21.9261521+00:00"); return t}()), - // Status: to.Ptr("Succeeded"), - // }, - // Request: &armcontainerregistry.PipelineRunRequest{ - // PipelineResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/importPipelines/myImportPipeline"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/PipelineRunDelete.json -func ExamplePipelineRunsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPipelineRunsClient().BeginDelete(ctx, "myResourceGroup", "myRegistry", "myPipelineRun", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/polymorphic_helpers.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/polymorphic_helpers.go deleted file mode 100644 index bdd88e76de0f..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/polymorphic_helpers.go +++ /dev/null @@ -1,88 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcontainerregistry - -import "encoding/json" - -func unmarshalRunRequestClassification(rawMsg json.RawMessage) (RunRequestClassification, error) { - if rawMsg == nil { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b RunRequestClassification - switch m["type"] { - case "DockerBuildRequest": - b = &DockerBuildRequest{} - case "EncodedTaskRunRequest": - b = &EncodedTaskRunRequest{} - case "FileTaskRunRequest": - b = &FileTaskRunRequest{} - case "TaskRunRequest": - b = &TaskRunRequest{} - default: - b = &RunRequest{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalTaskStepPropertiesClassification(rawMsg json.RawMessage) (TaskStepPropertiesClassification, error) { - if rawMsg == nil { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b TaskStepPropertiesClassification - switch m["type"] { - case string(StepTypeDocker): - b = &DockerBuildStep{} - case string(StepTypeEncodedTask): - b = &EncodedTaskStep{} - case string(StepTypeFileTask): - b = &FileTaskStep{} - default: - b = &TaskStepProperties{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalTaskStepUpdateParametersClassification(rawMsg json.RawMessage) (TaskStepUpdateParametersClassification, error) { - if rawMsg == nil { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b TaskStepUpdateParametersClassification - switch m["type"] { - case string(StepTypeDocker): - b = &DockerBuildStepUpdateParameters{} - case string(StepTypeEncodedTask): - b = &EncodedTaskStepUpdateParameters{} - case string(StepTypeFileTask): - b = &FileTaskStepUpdateParameters{} - default: - b = &TaskStepUpdateParameters{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_client.go index f1cd21dc359a..8104965436f8 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_client.go @@ -46,7 +46,7 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // BeginCreateOrUpdate - Update the state of specified private endpoint connection associated with the container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - privateEndpointConnectionName - The name of the private endpoint connection. @@ -71,7 +71,7 @@ func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context. // CreateOrUpdate - Update the state of specified private endpoint connection associated with the container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginCreateOrUpdate" @@ -114,7 +114,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, privateEndpointConnection); err != nil { @@ -126,7 +126,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx // BeginDelete - Deletes the specified private endpoint connection associated with the container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - privateEndpointConnectionName - The name of the private endpoint connection. @@ -150,7 +150,7 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Deletes the specified private endpoint connection associated with the container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginDelete" @@ -193,7 +193,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -201,7 +201,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Get the specified private endpoint connection associated with the container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - privateEndpointConnectionName - The name of the private endpoint connection. @@ -250,7 +250,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -267,7 +267,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // NewListPager - List all private endpoint connections in a container registry. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - options - PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager @@ -319,7 +319,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/privateendpointconnections_client_example_test.go 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..ebf39c997217 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/registries_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/registries_client.go @@ -47,7 +47,7 @@ func NewRegistriesClient(subscriptionID string, credential azcore.TokenCredentia // characters, be globally unique, and between 5 and 50 characters in length. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - registryNameCheckRequest - The object containing information for the availability request. // - options - RegistriesClientCheckNameAvailabilityOptions contains the optional parameters for the RegistriesClient.CheckNameAvailability // method. @@ -82,7 +82,7 @@ func (client *RegistriesClient) checkNameAvailabilityCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, registryNameCheckRequest); err != nil { @@ -103,7 +103,7 @@ func (client *RegistriesClient) checkNameAvailabilityHandleResponse(resp *http.R // BeginCreate - Creates a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - registry - The parameters for creating a container registry. @@ -126,7 +126,7 @@ func (client *RegistriesClient) BeginCreate(ctx context.Context, resourceGroupNa // Create - Creates a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *RegistriesClient) create(ctx context.Context, resourceGroupName string, registryName string, registry Registry, options *RegistriesClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "RegistriesClient.BeginCreate" @@ -165,7 +165,7 @@ func (client *RegistriesClient) createCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, registry); err != nil { @@ -177,7 +177,7 @@ func (client *RegistriesClient) createCreateRequest(ctx context.Context, resourc // BeginDelete - Deletes a container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - options - RegistriesClientBeginDeleteOptions contains the optional parameters for the RegistriesClient.BeginDelete method. @@ -199,7 +199,7 @@ func (client *RegistriesClient) BeginDelete(ctx context.Context, resourceGroupNa // Delete - Deletes a container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *RegistriesClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, options *RegistriesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "RegistriesClient.BeginDelete" @@ -238,7 +238,7 @@ func (client *RegistriesClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -246,7 +246,7 @@ func (client *RegistriesClient) deleteCreateRequest(ctx context.Context, resourc // BeginGenerateCredentials - Generate keys for a token of a specified container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - generateCredentialsParameters - The parameters for generating credentials. @@ -270,7 +270,7 @@ func (client *RegistriesClient) BeginGenerateCredentials(ctx context.Context, re // GenerateCredentials - Generate keys for a token of a specified container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *RegistriesClient) generateCredentials(ctx context.Context, resourceGroupName string, registryName string, generateCredentialsParameters GenerateCredentialsParameters, options *RegistriesClientBeginGenerateCredentialsOptions) (*http.Response, error) { var err error const operationName = "RegistriesClient.BeginGenerateCredentials" @@ -309,7 +309,7 @@ func (client *RegistriesClient) generateCredentialsCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, generateCredentialsParameters); err != nil { @@ -321,7 +321,7 @@ func (client *RegistriesClient) generateCredentialsCreateRequest(ctx context.Con // Get - Gets the properties of the specified container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - options - RegistriesClientGetOptions contains the optional parameters for the RegistriesClient.Get method. @@ -364,7 +364,7 @@ func (client *RegistriesClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -379,72 +379,10 @@ func (client *RegistriesClient) getHandleResponse(resp *http.Response) (Registri return result, nil } -// GetBuildSourceUploadURL - Get the upload location for the user to be able to upload the source. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -// - resourceGroupName - The name of the resource group to which the container registry belongs. -// - registryName - The name of the container registry. -// - options - RegistriesClientGetBuildSourceUploadURLOptions contains the optional parameters for the RegistriesClient.GetBuildSourceUploadURL -// method. -func (client *RegistriesClient) GetBuildSourceUploadURL(ctx context.Context, resourceGroupName string, registryName string, options *RegistriesClientGetBuildSourceUploadURLOptions) (RegistriesClientGetBuildSourceUploadURLResponse, error) { - var err error - const operationName = "RegistriesClient.GetBuildSourceUploadURL" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getBuildSourceUploadURLCreateRequest(ctx, resourceGroupName, registryName, options) - if err != nil { - return RegistriesClientGetBuildSourceUploadURLResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RegistriesClientGetBuildSourceUploadURLResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return RegistriesClientGetBuildSourceUploadURLResponse{}, err - } - resp, err := client.getBuildSourceUploadURLHandleResponse(httpResp) - return resp, err -} - -// getBuildSourceUploadURLCreateRequest creates the GetBuildSourceUploadURL request. -func (client *RegistriesClient) getBuildSourceUploadURLCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *RegistriesClientGetBuildSourceUploadURLOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listBuildSourceUploadUrl" - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getBuildSourceUploadURLHandleResponse handles the GetBuildSourceUploadURL response. -func (client *RegistriesClient) getBuildSourceUploadURLHandleResponse(resp *http.Response) (RegistriesClientGetBuildSourceUploadURLResponse, error) { - result := RegistriesClientGetBuildSourceUploadURLResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SourceUploadDefinition); err != nil { - return RegistriesClientGetBuildSourceUploadURLResponse{}, err - } - return result, nil -} - // GetPrivateLinkResource - Gets a private link resource by a specified group name for a container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - groupName - The name of the private link resource. @@ -493,7 +431,7 @@ func (client *RegistriesClient) getPrivateLinkResourceCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -511,7 +449,7 @@ func (client *RegistriesClient) getPrivateLinkResourceHandleResponse(resp *http. // BeginImportImage - Copies an image to this container registry from the specified container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - parameters - The parameters specifying the image to copy and the source container registry. @@ -535,7 +473,7 @@ func (client *RegistriesClient) BeginImportImage(ctx context.Context, resourceGr // ImportImage - Copies an image to this container registry from the specified container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *RegistriesClient) importImage(ctx context.Context, resourceGroupName string, registryName string, parameters ImportImageParameters, options *RegistriesClientBeginImportImageOptions) (*http.Response, error) { var err error const operationName = "RegistriesClient.BeginImportImage" @@ -574,7 +512,7 @@ func (client *RegistriesClient) importImageCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err @@ -584,7 +522,7 @@ func (client *RegistriesClient) importImageCreateRequest(ctx context.Context, re // NewListPager - Lists all the container registries under the specified subscription. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - options - RegistriesClientListOptions contains the optional parameters for the RegistriesClient.NewListPager method. func (client *RegistriesClient) NewListPager(options *RegistriesClientListOptions) *runtime.Pager[RegistriesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[RegistriesClientListResponse]{ @@ -625,7 +563,7 @@ func (client *RegistriesClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -642,7 +580,7 @@ func (client *RegistriesClient) listHandleResponse(resp *http.Response) (Registr // NewListByResourceGroupPager - Lists all the container registries under the specified resource group. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - RegistriesClientListByResourceGroupOptions contains the optional parameters for the RegistriesClient.NewListByResourceGroupPager // method. @@ -689,7 +627,7 @@ func (client *RegistriesClient) listByResourceGroupCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -707,7 +645,7 @@ func (client *RegistriesClient) listByResourceGroupHandleResponse(resp *http.Res // ListCredentials - Lists the login credentials for the specified container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - options - RegistriesClientListCredentialsOptions contains the optional parameters for the RegistriesClient.ListCredentials @@ -751,7 +689,7 @@ func (client *RegistriesClient) listCredentialsCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -768,7 +706,7 @@ func (client *RegistriesClient) listCredentialsHandleResponse(resp *http.Respons // NewListPrivateLinkResourcesPager - Lists the private link resources for a container registry. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - options - RegistriesClientListPrivateLinkResourcesOptions contains the optional parameters for the RegistriesClient.NewListPrivateLinkResourcesPager @@ -820,7 +758,7 @@ func (client *RegistriesClient) listPrivateLinkResourcesCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -838,7 +776,7 @@ func (client *RegistriesClient) listPrivateLinkResourcesHandleResponse(resp *htt // ListUsages - Gets the quota usages for the specified container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - options - RegistriesClientListUsagesOptions contains the optional parameters for the RegistriesClient.ListUsages method. @@ -881,7 +819,7 @@ func (client *RegistriesClient) listUsagesCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -899,7 +837,7 @@ func (client *RegistriesClient) listUsagesHandleResponse(resp *http.Response) (R // RegenerateCredential - Regenerates one of the login credentials for the specified container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - regenerateCredentialParameters - Specifies name of the password which should be regenerated -- password or password2. @@ -944,7 +882,7 @@ func (client *RegistriesClient) regenerateCredentialCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, regenerateCredentialParameters); err != nil { @@ -962,83 +900,10 @@ func (client *RegistriesClient) regenerateCredentialHandleResponse(resp *http.Re return result, nil } -// BeginScheduleRun - Schedules a new run based on the request parameters and add it to the run queue. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -// - resourceGroupName - The name of the resource group to which the container registry belongs. -// - registryName - The name of the container registry. -// - runRequest - The parameters of a run that needs to scheduled. -// - options - RegistriesClientBeginScheduleRunOptions contains the optional parameters for the RegistriesClient.BeginScheduleRun -// method. -func (client *RegistriesClient) BeginScheduleRun(ctx context.Context, resourceGroupName string, registryName string, runRequest RunRequestClassification, options *RegistriesClientBeginScheduleRunOptions) (*runtime.Poller[RegistriesClientScheduleRunResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.scheduleRun(ctx, resourceGroupName, registryName, runRequest, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller[RegistriesClientScheduleRunResponse](resp, client.internal.Pipeline(), nil) - return poller, err - } else { - return runtime.NewPollerFromResumeToken[RegistriesClientScheduleRunResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// ScheduleRun - Schedules a new run based on the request parameters and add it to the run queue. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -func (client *RegistriesClient) scheduleRun(ctx context.Context, resourceGroupName string, registryName string, runRequest RunRequestClassification, options *RegistriesClientBeginScheduleRunOptions) (*http.Response, error) { - var err error - const operationName = "RegistriesClient.BeginScheduleRun" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.scheduleRunCreateRequest(ctx, resourceGroupName, registryName, runRequest, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// scheduleRunCreateRequest creates the ScheduleRun request. -func (client *RegistriesClient) scheduleRunCreateRequest(ctx context.Context, resourceGroupName string, registryName string, runRequest RunRequestClassification, options *RegistriesClientBeginScheduleRunOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scheduleRun" - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, runRequest); err != nil { - return nil, err - } - return req, nil -} - // BeginUpdate - Updates a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - registryUpdateParameters - The parameters for updating a container registry. @@ -1061,7 +926,7 @@ func (client *RegistriesClient) BeginUpdate(ctx context.Context, resourceGroupNa // Update - Updates a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *RegistriesClient) update(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters, options *RegistriesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "RegistriesClient.BeginUpdate" @@ -1100,7 +965,7 @@ func (client *RegistriesClient) updateCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, registryUpdateParameters); err != nil { diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/registries_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/registries_client_example_test.go 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..d2ea869ac7cb 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client.go @@ -46,7 +46,7 @@ func NewReplicationsClient(subscriptionID string, credential azcore.TokenCredent // BeginCreate - Creates a replication for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - replicationName - The name of the replication. @@ -71,7 +71,7 @@ func (client *ReplicationsClient) BeginCreate(ctx context.Context, resourceGroup // Create - Creates a replication for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *ReplicationsClient) create(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replication Replication, options *ReplicationsClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "ReplicationsClient.BeginCreate" @@ -114,7 +114,7 @@ func (client *ReplicationsClient) createCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, replication); err != nil { @@ -126,7 +126,7 @@ func (client *ReplicationsClient) createCreateRequest(ctx context.Context, resou // BeginDelete - Deletes a replication from a container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - replicationName - The name of the replication. @@ -150,7 +150,7 @@ func (client *ReplicationsClient) BeginDelete(ctx context.Context, resourceGroup // Delete - Deletes a replication from a container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *ReplicationsClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, replicationName string, options *ReplicationsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ReplicationsClient.BeginDelete" @@ -193,7 +193,7 @@ func (client *ReplicationsClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -201,7 +201,7 @@ func (client *ReplicationsClient) deleteCreateRequest(ctx context.Context, resou // Get - Gets the properties of the specified replication. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - replicationName - The name of the replication. @@ -249,7 +249,7 @@ func (client *ReplicationsClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -266,7 +266,7 @@ func (client *ReplicationsClient) getHandleResponse(resp *http.Response) (Replic // NewListPager - Lists all the replications for the specified container registry. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - options - ReplicationsClientListOptions contains the optional parameters for the ReplicationsClient.NewListPager method. @@ -317,7 +317,7 @@ func (client *ReplicationsClient) listCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -335,7 +335,7 @@ func (client *ReplicationsClient) listHandleResponse(resp *http.Response) (Repli // BeginUpdate - Updates a replication for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - replicationName - The name of the replication. @@ -360,7 +360,7 @@ func (client *ReplicationsClient) BeginUpdate(ctx context.Context, resourceGroup // Update - Updates a replication for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *ReplicationsClient) update(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters ReplicationUpdateParameters, options *ReplicationsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "ReplicationsClient.BeginUpdate" @@ -403,7 +403,7 @@ func (client *ReplicationsClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, replicationUpdateParameters); err != nil { diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/replications_client_example_test.go 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 1bf3628fa197..aa15a864c7d0 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/response_types.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/response_types.go @@ -8,36 +8,6 @@ package armcontainerregistry -// AgentPoolsClientCreateResponse contains the response from method AgentPoolsClient.BeginCreate. -type AgentPoolsClientCreateResponse struct { - AgentPool -} - -// AgentPoolsClientDeleteResponse contains the response from method AgentPoolsClient.BeginDelete. -type AgentPoolsClientDeleteResponse struct { - // placeholder for future response values -} - -// AgentPoolsClientGetQueueStatusResponse contains the response from method AgentPoolsClient.GetQueueStatus. -type AgentPoolsClientGetQueueStatusResponse struct { - AgentPoolQueueStatus -} - -// AgentPoolsClientGetResponse contains the response from method AgentPoolsClient.Get. -type AgentPoolsClientGetResponse struct { - AgentPool -} - -// AgentPoolsClientListResponse contains the response from method AgentPoolsClient.NewListPager. -type AgentPoolsClientListResponse struct { - AgentPoolListResult -} - -// AgentPoolsClientUpdateResponse contains the response from method AgentPoolsClient.BeginUpdate. -type AgentPoolsClientUpdateResponse struct { - AgentPool -} - // CacheRulesClientCreateResponse contains the response from method CacheRulesClient.BeginCreate. type CacheRulesClientCreateResponse struct { CacheRule @@ -63,36 +33,6 @@ type CacheRulesClientUpdateResponse struct { CacheRule } -// ConnectedRegistriesClientCreateResponse contains the response from method ConnectedRegistriesClient.BeginCreate. -type ConnectedRegistriesClientCreateResponse struct { - ConnectedRegistry -} - -// ConnectedRegistriesClientDeactivateResponse contains the response from method ConnectedRegistriesClient.BeginDeactivate. -type ConnectedRegistriesClientDeactivateResponse struct { - // placeholder for future response values -} - -// ConnectedRegistriesClientDeleteResponse contains the response from method ConnectedRegistriesClient.BeginDelete. -type ConnectedRegistriesClientDeleteResponse struct { - // placeholder for future response values -} - -// ConnectedRegistriesClientGetResponse contains the response from method ConnectedRegistriesClient.Get. -type ConnectedRegistriesClientGetResponse struct { - ConnectedRegistry -} - -// ConnectedRegistriesClientListResponse contains the response from method ConnectedRegistriesClient.NewListPager. -type ConnectedRegistriesClientListResponse struct { - ConnectedRegistryListResult -} - -// ConnectedRegistriesClientUpdateResponse contains the response from method ConnectedRegistriesClient.BeginUpdate. -type ConnectedRegistriesClientUpdateResponse struct { - ConnectedRegistry -} - // CredentialSetsClientCreateResponse contains the response from method CredentialSetsClient.BeginCreate. type CredentialSetsClientCreateResponse struct { CredentialSet @@ -118,71 +58,11 @@ type CredentialSetsClientUpdateResponse struct { CredentialSet } -// ExportPipelinesClientCreateResponse contains the response from method ExportPipelinesClient.BeginCreate. -type ExportPipelinesClientCreateResponse struct { - ExportPipeline -} - -// ExportPipelinesClientDeleteResponse contains the response from method ExportPipelinesClient.BeginDelete. -type ExportPipelinesClientDeleteResponse struct { - // placeholder for future response values -} - -// ExportPipelinesClientGetResponse contains the response from method ExportPipelinesClient.Get. -type ExportPipelinesClientGetResponse struct { - ExportPipeline -} - -// ExportPipelinesClientListResponse contains the response from method ExportPipelinesClient.NewListPager. -type ExportPipelinesClientListResponse struct { - ExportPipelineListResult -} - -// ImportPipelinesClientCreateResponse contains the response from method ImportPipelinesClient.BeginCreate. -type ImportPipelinesClientCreateResponse struct { - ImportPipeline -} - -// ImportPipelinesClientDeleteResponse contains the response from method ImportPipelinesClient.BeginDelete. -type ImportPipelinesClientDeleteResponse struct { - // placeholder for future response values -} - -// ImportPipelinesClientGetResponse contains the response from method ImportPipelinesClient.Get. -type ImportPipelinesClientGetResponse struct { - ImportPipeline -} - -// ImportPipelinesClientListResponse contains the response from method ImportPipelinesClient.NewListPager. -type ImportPipelinesClientListResponse struct { - ImportPipelineListResult -} - // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { OperationListResult } -// PipelineRunsClientCreateResponse contains the response from method PipelineRunsClient.BeginCreate. -type PipelineRunsClientCreateResponse struct { - PipelineRun -} - -// PipelineRunsClientDeleteResponse contains the response from method PipelineRunsClient.BeginDelete. -type PipelineRunsClientDeleteResponse struct { - // placeholder for future response values -} - -// PipelineRunsClientGetResponse contains the response from method PipelineRunsClient.Get. -type PipelineRunsClientGetResponse struct { - PipelineRun -} - -// PipelineRunsClientListResponse contains the response from method PipelineRunsClient.NewListPager. -type PipelineRunsClientListResponse struct { - PipelineRunListResult -} - // PrivateEndpointConnectionsClientCreateOrUpdateResponse contains the response from method PrivateEndpointConnectionsClient.BeginCreateOrUpdate. type PrivateEndpointConnectionsClientCreateOrUpdateResponse struct { PrivateEndpointConnection @@ -223,11 +103,6 @@ type RegistriesClientGenerateCredentialsResponse struct { GenerateCredentialsResult } -// RegistriesClientGetBuildSourceUploadURLResponse contains the response from method RegistriesClient.GetBuildSourceUploadURL. -type RegistriesClientGetBuildSourceUploadURLResponse struct { - SourceUploadDefinition -} - // RegistriesClientGetPrivateLinkResourceResponse contains the response from method RegistriesClient.GetPrivateLinkResource. type RegistriesClientGetPrivateLinkResourceResponse struct { PrivateLinkResource @@ -273,11 +148,6 @@ type RegistriesClientRegenerateCredentialResponse struct { RegistryListCredentialsResult } -// RegistriesClientScheduleRunResponse contains the response from method RegistriesClient.BeginScheduleRun. -type RegistriesClientScheduleRunResponse struct { - Run -} - // RegistriesClientUpdateResponse contains the response from method RegistriesClient.BeginUpdate. type RegistriesClientUpdateResponse struct { Registry @@ -308,31 +178,6 @@ type ReplicationsClientUpdateResponse struct { Replication } -// RunsClientCancelResponse contains the response from method RunsClient.BeginCancel. -type RunsClientCancelResponse struct { - // placeholder for future response values -} - -// RunsClientGetLogSasURLResponse contains the response from method RunsClient.GetLogSasURL. -type RunsClientGetLogSasURLResponse struct { - RunGetLogResult -} - -// RunsClientGetResponse contains the response from method RunsClient.Get. -type RunsClientGetResponse struct { - Run -} - -// RunsClientListResponse contains the response from method RunsClient.NewListPager. -type RunsClientListResponse struct { - RunListResult -} - -// RunsClientUpdateResponse contains the response from method RunsClient.BeginUpdate. -type RunsClientUpdateResponse struct { - Run -} - // ScopeMapsClientCreateResponse contains the response from method ScopeMapsClient.BeginCreate. type ScopeMapsClientCreateResponse struct { ScopeMap @@ -358,66 +203,6 @@ type ScopeMapsClientUpdateResponse struct { ScopeMap } -// TaskRunsClientCreateResponse contains the response from method TaskRunsClient.BeginCreate. -type TaskRunsClientCreateResponse struct { - TaskRun -} - -// TaskRunsClientDeleteResponse contains the response from method TaskRunsClient.BeginDelete. -type TaskRunsClientDeleteResponse struct { - // placeholder for future response values -} - -// TaskRunsClientGetDetailsResponse contains the response from method TaskRunsClient.GetDetails. -type TaskRunsClientGetDetailsResponse struct { - TaskRun -} - -// TaskRunsClientGetResponse contains the response from method TaskRunsClient.Get. -type TaskRunsClientGetResponse struct { - TaskRun -} - -// TaskRunsClientListResponse contains the response from method TaskRunsClient.NewListPager. -type TaskRunsClientListResponse struct { - TaskRunListResult -} - -// TaskRunsClientUpdateResponse contains the response from method TaskRunsClient.BeginUpdate. -type TaskRunsClientUpdateResponse struct { - TaskRun -} - -// TasksClientCreateResponse contains the response from method TasksClient.BeginCreate. -type TasksClientCreateResponse struct { - Task -} - -// TasksClientDeleteResponse contains the response from method TasksClient.BeginDelete. -type TasksClientDeleteResponse struct { - // placeholder for future response values -} - -// TasksClientGetDetailsResponse contains the response from method TasksClient.GetDetails. -type TasksClientGetDetailsResponse struct { - Task -} - -// TasksClientGetResponse contains the response from method TasksClient.Get. -type TasksClientGetResponse struct { - Task -} - -// TasksClientListResponse contains the response from method TasksClient.NewListPager. -type TasksClientListResponse struct { - TaskListResult -} - -// TasksClientUpdateResponse contains the response from method TasksClient.BeginUpdate. -type TasksClientUpdateResponse struct { - Task -} - // TokensClientCreateResponse contains the response from method TokensClient.BeginCreate. type TokensClientCreateResponse struct { Token diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/runs_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/runs_client.go deleted file mode 100644 index cd296b6de12c..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/runs_client.go +++ /dev/null @@ -1,401 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armcontainerregistry - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strconv" - "strings" -) - -// RunsClient contains the methods for the Runs group. -// Don't use this type directly, use NewRunsClient() instead. -type RunsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewRunsClient creates a new instance of RunsClient 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 NewRunsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RunsClient, error) { - cl, err := arm.NewClient(moduleName+".RunsClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &RunsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginCancel - Cancel an existing run. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -// - resourceGroupName - The name of the resource group to which the container registry belongs. -// - registryName - The name of the container registry. -// - runID - The run ID. -// - options - RunsClientBeginCancelOptions contains the optional parameters for the RunsClient.BeginCancel method. -func (client *RunsClient) BeginCancel(ctx context.Context, resourceGroupName string, registryName string, runID string, options *RunsClientBeginCancelOptions) (*runtime.Poller[RunsClientCancelResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.cancel(ctx, resourceGroupName, registryName, runID, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller[RunsClientCancelResponse](resp, client.internal.Pipeline(), nil) - return poller, err - } else { - return runtime.NewPollerFromResumeToken[RunsClientCancelResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Cancel - Cancel an existing run. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -func (client *RunsClient) cancel(ctx context.Context, resourceGroupName string, registryName string, runID string, options *RunsClientBeginCancelOptions) (*http.Response, error) { - var err error - const operationName = "RunsClient.BeginCancel" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.cancelCreateRequest(ctx, resourceGroupName, registryName, runID, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// cancelCreateRequest creates the Cancel request. -func (client *RunsClient) cancelCreateRequest(ctx context.Context, resourceGroupName string, registryName string, runID string, options *RunsClientBeginCancelOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/cancel" - 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 runID == "" { - return nil, errors.New("parameter runID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{runId}", url.PathEscape(runID)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Gets the detailed information for a given run. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -// - resourceGroupName - The name of the resource group to which the container registry belongs. -// - registryName - The name of the container registry. -// - runID - The run ID. -// - options - RunsClientGetOptions contains the optional parameters for the RunsClient.Get method. -func (client *RunsClient) Get(ctx context.Context, resourceGroupName string, registryName string, runID string, options *RunsClientGetOptions) (RunsClientGetResponse, error) { - var err error - const operationName = "RunsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, runID, options) - if err != nil { - return RunsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RunsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return RunsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *RunsClient) getCreateRequest(ctx context.Context, resourceGroupName string, registryName string, runID string, options *RunsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}" - 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 runID == "" { - return nil, errors.New("parameter runID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{runId}", url.PathEscape(runID)) - 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", "2019-06-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 *RunsClient) getHandleResponse(resp *http.Response) (RunsClientGetResponse, error) { - result := RunsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Run); err != nil { - return RunsClientGetResponse{}, err - } - return result, nil -} - -// GetLogSasURL - Gets a link to download the run logs. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -// - resourceGroupName - The name of the resource group to which the container registry belongs. -// - registryName - The name of the container registry. -// - runID - The run ID. -// - options - RunsClientGetLogSasURLOptions contains the optional parameters for the RunsClient.GetLogSasURL method. -func (client *RunsClient) GetLogSasURL(ctx context.Context, resourceGroupName string, registryName string, runID string, options *RunsClientGetLogSasURLOptions) (RunsClientGetLogSasURLResponse, error) { - var err error - const operationName = "RunsClient.GetLogSasURL" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getLogSasURLCreateRequest(ctx, resourceGroupName, registryName, runID, options) - if err != nil { - return RunsClientGetLogSasURLResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RunsClientGetLogSasURLResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return RunsClientGetLogSasURLResponse{}, err - } - resp, err := client.getLogSasURLHandleResponse(httpResp) - return resp, err -} - -// getLogSasURLCreateRequest creates the GetLogSasURL request. -func (client *RunsClient) getLogSasURLCreateRequest(ctx context.Context, resourceGroupName string, registryName string, runID string, options *RunsClientGetLogSasURLOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/listLogSasUrl" - 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 runID == "" { - return nil, errors.New("parameter runID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{runId}", url.PathEscape(runID)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getLogSasURLHandleResponse handles the GetLogSasURL response. -func (client *RunsClient) getLogSasURLHandleResponse(resp *http.Response) (RunsClientGetLogSasURLResponse, error) { - result := RunsClientGetLogSasURLResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RunGetLogResult); err != nil { - return RunsClientGetLogSasURLResponse{}, err - } - return result, nil -} - -// NewListPager - Gets all the runs for a registry. -// -// Generated from API version 2019-06-01-preview -// - resourceGroupName - The name of the resource group to which the container registry belongs. -// - registryName - The name of the container registry. -// - options - RunsClientListOptions contains the optional parameters for the RunsClient.NewListPager method. -func (client *RunsClient) NewListPager(resourceGroupName string, registryName string, options *RunsClientListOptions) *runtime.Pager[RunsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[RunsClientListResponse]{ - More: func(page RunsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *RunsClientListResponse) (RunsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RunsClient.NewListPager") - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, resourceGroupName, registryName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return RunsClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RunsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RunsClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *RunsClient) listCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *RunsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs" - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-06-01-preview") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.Top != nil { - reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *RunsClient) listHandleResponse(resp *http.Response) (RunsClientListResponse, error) { - result := RunsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RunListResult); err != nil { - return RunsClientListResponse{}, err - } - return result, nil -} - -// BeginUpdate - Patch the run properties. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -// - resourceGroupName - The name of the resource group to which the container registry belongs. -// - registryName - The name of the container registry. -// - runID - The run ID. -// - runUpdateParameters - The run update properties. -// - options - RunsClientBeginUpdateOptions contains the optional parameters for the RunsClient.BeginUpdate method. -func (client *RunsClient) BeginUpdate(ctx context.Context, resourceGroupName string, registryName string, runID string, runUpdateParameters RunUpdateParameters, options *RunsClientBeginUpdateOptions) (*runtime.Poller[RunsClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, registryName, runID, runUpdateParameters, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller[RunsClientUpdateResponse](resp, client.internal.Pipeline(), nil) - return poller, err - } else { - return runtime.NewPollerFromResumeToken[RunsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Update - Patch the run properties. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -func (client *RunsClient) update(ctx context.Context, resourceGroupName string, registryName string, runID string, runUpdateParameters RunUpdateParameters, options *RunsClientBeginUpdateOptions) (*http.Response, error) { - var err error - const operationName = "RunsClient.BeginUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, runID, runUpdateParameters, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// updateCreateRequest creates the Update request. -func (client *RunsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, registryName string, runID string, runUpdateParameters RunUpdateParameters, options *RunsClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}" - 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 runID == "" { - return nil, errors.New("parameter runID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{runId}", url.PathEscape(runID)) - 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", "2019-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, runUpdateParameters); err != nil { - return nil, err - } - return req, nil -} 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..9ab3d6cf1faf 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_client.go @@ -46,7 +46,7 @@ func NewScopeMapsClient(subscriptionID string, credential azcore.TokenCredential // BeginCreate - Creates a scope map for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - scopeMapName - The name of the scope map. @@ -70,7 +70,7 @@ func (client *ScopeMapsClient) BeginCreate(ctx context.Context, resourceGroupNam // Create - Creates a scope map for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *ScopeMapsClient) create(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapCreateParameters ScopeMap, options *ScopeMapsClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "ScopeMapsClient.BeginCreate" @@ -113,7 +113,7 @@ func (client *ScopeMapsClient) createCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, scopeMapCreateParameters); err != nil { @@ -125,7 +125,7 @@ func (client *ScopeMapsClient) createCreateRequest(ctx context.Context, resource // BeginDelete - Deletes a scope map from a container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - scopeMapName - The name of the scope map. @@ -148,7 +148,7 @@ func (client *ScopeMapsClient) BeginDelete(ctx context.Context, resourceGroupNam // Delete - Deletes a scope map from a container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *ScopeMapsClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, options *ScopeMapsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ScopeMapsClient.BeginDelete" @@ -191,7 +191,7 @@ func (client *ScopeMapsClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -200,7 +200,7 @@ func (client *ScopeMapsClient) deleteCreateRequest(ctx context.Context, resource // Get - Gets the properties of the specified scope map. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - scopeMapName - The name of the scope map. @@ -248,7 +248,7 @@ func (client *ScopeMapsClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -265,7 +265,7 @@ func (client *ScopeMapsClient) getHandleResponse(resp *http.Response) (ScopeMaps // NewListPager - Lists all the scope maps for the specified container registry. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - options - ScopeMapsClientListOptions contains the optional parameters for the ScopeMapsClient.NewListPager method. @@ -316,7 +316,7 @@ func (client *ScopeMapsClient) listCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -334,7 +334,7 @@ func (client *ScopeMapsClient) listHandleResponse(resp *http.Response) (ScopeMap // BeginUpdate - Updates a scope map with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - scopeMapName - The name of the scope map. @@ -358,7 +358,7 @@ func (client *ScopeMapsClient) BeginUpdate(ctx context.Context, resourceGroupNam // Update - Updates a scope map with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *ScopeMapsClient) update(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapUpdateParameters ScopeMapUpdateParameters, options *ScopeMapsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "ScopeMapsClient.BeginUpdate" @@ -401,7 +401,7 @@ func (client *ScopeMapsClient) updateCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, scopeMapUpdateParameters); err != nil { diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/scopemaps_client_example_test.go 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.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/taskruns_client.go deleted file mode 100644 index 966cff5c5ae8..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/taskruns_client.go +++ /dev/null @@ -1,471 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package 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" -) - -// TaskRunsClient contains the methods for the TaskRuns group. -// Don't use this type directly, use NewTaskRunsClient() instead. -type TaskRunsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewTaskRunsClient creates a new instance of TaskRunsClient 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 NewTaskRunsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TaskRunsClient, error) { - cl, err := arm.NewClient(moduleName+".TaskRunsClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &TaskRunsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginCreate - Creates a task run for a container registry with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -// - resourceGroupName - The name of the resource group to which the container registry belongs. -// - registryName - The name of the container registry. -// - taskRunName - The name of the task run. -// - taskRun - The parameters of a run that needs to scheduled. -// - options - TaskRunsClientBeginCreateOptions contains the optional parameters for the TaskRunsClient.BeginCreate method. -func (client *TaskRunsClient) BeginCreate(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, taskRun TaskRun, options *TaskRunsClientBeginCreateOptions) (*runtime.Poller[TaskRunsClientCreateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, registryName, taskRunName, taskRun, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller[TaskRunsClientCreateResponse](resp, client.internal.Pipeline(), nil) - return poller, err - } else { - return runtime.NewPollerFromResumeToken[TaskRunsClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Create - Creates a task run for a container registry with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -func (client *TaskRunsClient) create(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, taskRun TaskRun, options *TaskRunsClientBeginCreateOptions) (*http.Response, error) { - var err error - const operationName = "TaskRunsClient.BeginCreate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, taskRunName, taskRun, options) - if err != nil { - return nil, err - } - 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 *TaskRunsClient) createCreateRequest(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, taskRun TaskRun, options *TaskRunsClientBeginCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}" - 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 taskRunName == "" { - return nil, errors.New("parameter taskRunName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{taskRunName}", url.PathEscape(taskRunName)) - 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", "2019-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, taskRun); err != nil { - return nil, err - } - return req, nil -} - -// BeginDelete - Deletes a specified task run resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -// - resourceGroupName - The name of the resource group to which the container registry belongs. -// - registryName - The name of the container registry. -// - taskRunName - The name of the task run. -// - options - TaskRunsClientBeginDeleteOptions contains the optional parameters for the TaskRunsClient.BeginDelete method. -func (client *TaskRunsClient) BeginDelete(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, options *TaskRunsClientBeginDeleteOptions) (*runtime.Poller[TaskRunsClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, registryName, taskRunName, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller[TaskRunsClientDeleteResponse](resp, client.internal.Pipeline(), nil) - return poller, err - } else { - return runtime.NewPollerFromResumeToken[TaskRunsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Delete - Deletes a specified task run resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -func (client *TaskRunsClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, options *TaskRunsClientBeginDeleteOptions) (*http.Response, error) { - var err error - const operationName = "TaskRunsClient.BeginDelete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, taskRunName, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *TaskRunsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, options *TaskRunsClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}" - 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 taskRunName == "" { - return nil, errors.New("parameter taskRunName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{taskRunName}", url.PathEscape(taskRunName)) - 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", "2019-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Gets the detailed information for a given task run. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -// - resourceGroupName - The name of the resource group to which the container registry belongs. -// - registryName - The name of the container registry. -// - taskRunName - The name of the task run. -// - options - TaskRunsClientGetOptions contains the optional parameters for the TaskRunsClient.Get method. -func (client *TaskRunsClient) Get(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, options *TaskRunsClientGetOptions) (TaskRunsClientGetResponse, error) { - var err error - const operationName = "TaskRunsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, taskRunName, options) - if err != nil { - return TaskRunsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return TaskRunsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return TaskRunsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *TaskRunsClient) getCreateRequest(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, options *TaskRunsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}" - 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 taskRunName == "" { - return nil, errors.New("parameter taskRunName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{taskRunName}", url.PathEscape(taskRunName)) - 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", "2019-06-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 *TaskRunsClient) getHandleResponse(resp *http.Response) (TaskRunsClientGetResponse, error) { - result := TaskRunsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.TaskRun); err != nil { - return TaskRunsClientGetResponse{}, err - } - return result, nil -} - -// GetDetails - Gets the detailed information for a given task run that includes all secrets. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -// - resourceGroupName - The name of the resource group to which the container registry belongs. -// - registryName - The name of the container registry. -// - taskRunName - The name of the task run. -// - options - TaskRunsClientGetDetailsOptions contains the optional parameters for the TaskRunsClient.GetDetails method. -func (client *TaskRunsClient) GetDetails(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, options *TaskRunsClientGetDetailsOptions) (TaskRunsClientGetDetailsResponse, error) { - var err error - const operationName = "TaskRunsClient.GetDetails" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getDetailsCreateRequest(ctx, resourceGroupName, registryName, taskRunName, options) - if err != nil { - return TaskRunsClientGetDetailsResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return TaskRunsClientGetDetailsResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return TaskRunsClientGetDetailsResponse{}, err - } - resp, err := client.getDetailsHandleResponse(httpResp) - return resp, err -} - -// getDetailsCreateRequest creates the GetDetails request. -func (client *TaskRunsClient) getDetailsCreateRequest(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, options *TaskRunsClientGetDetailsOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}/listDetails" - 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 taskRunName == "" { - return nil, errors.New("parameter taskRunName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{taskRunName}", url.PathEscape(taskRunName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getDetailsHandleResponse handles the GetDetails response. -func (client *TaskRunsClient) getDetailsHandleResponse(resp *http.Response) (TaskRunsClientGetDetailsResponse, error) { - result := TaskRunsClientGetDetailsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.TaskRun); err != nil { - return TaskRunsClientGetDetailsResponse{}, err - } - return result, nil -} - -// NewListPager - Lists all the task runs for a specified container registry. -// -// Generated from API version 2019-06-01-preview -// - resourceGroupName - The name of the resource group to which the container registry belongs. -// - registryName - The name of the container registry. -// - options - TaskRunsClientListOptions contains the optional parameters for the TaskRunsClient.NewListPager method. -func (client *TaskRunsClient) NewListPager(resourceGroupName string, registryName string, options *TaskRunsClientListOptions) *runtime.Pager[TaskRunsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[TaskRunsClientListResponse]{ - More: func(page TaskRunsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *TaskRunsClientListResponse) (TaskRunsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TaskRunsClient.NewListPager") - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, resourceGroupName, registryName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return TaskRunsClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return TaskRunsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TaskRunsClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *TaskRunsClient) listCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *TaskRunsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns" - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-06-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 *TaskRunsClient) listHandleResponse(resp *http.Response) (TaskRunsClientListResponse, error) { - result := TaskRunsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.TaskRunListResult); err != nil { - return TaskRunsClientListResponse{}, err - } - return result, nil -} - -// BeginUpdate - Updates a task run with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -// - resourceGroupName - The name of the resource group to which the container registry belongs. -// - registryName - The name of the container registry. -// - taskRunName - The name of the task run. -// - updateParameters - The parameters for updating a task run. -// - options - TaskRunsClientBeginUpdateOptions contains the optional parameters for the TaskRunsClient.BeginUpdate method. -func (client *TaskRunsClient) BeginUpdate(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, updateParameters TaskRunUpdateParameters, options *TaskRunsClientBeginUpdateOptions) (*runtime.Poller[TaskRunsClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, registryName, taskRunName, updateParameters, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller[TaskRunsClientUpdateResponse](resp, client.internal.Pipeline(), nil) - return poller, err - } else { - return runtime.NewPollerFromResumeToken[TaskRunsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Update - Updates a task run with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -func (client *TaskRunsClient) update(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, updateParameters TaskRunUpdateParameters, options *TaskRunsClientBeginUpdateOptions) (*http.Response, error) { - var err error - const operationName = "TaskRunsClient.BeginUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, taskRunName, updateParameters, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// updateCreateRequest creates the Update request. -func (client *TaskRunsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, updateParameters TaskRunUpdateParameters, options *TaskRunsClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}" - 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 taskRunName == "" { - return nil, errors.New("parameter taskRunName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{taskRunName}", url.PathEscape(taskRunName)) - 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", "2019-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, updateParameters); err != nil { - return nil, err - } - return req, nil -} 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.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/tasks_client.go deleted file mode 100644 index 9071032e40ae..000000000000 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/tasks_client.go +++ /dev/null @@ -1,471 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package 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" -) - -// TasksClient contains the methods for the Tasks group. -// Don't use this type directly, use NewTasksClient() instead. -type TasksClient struct { - internal *arm.Client - subscriptionID string -} - -// NewTasksClient creates a new instance of TasksClient 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 NewTasksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TasksClient, error) { - cl, err := arm.NewClient(moduleName+".TasksClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &TasksClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginCreate - Creates a task for a container registry with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -// - resourceGroupName - The name of the resource group to which the container registry belongs. -// - registryName - The name of the container registry. -// - taskName - The name of the container registry task. -// - taskCreateParameters - The parameters for creating a task. -// - options - TasksClientBeginCreateOptions contains the optional parameters for the TasksClient.BeginCreate method. -func (client *TasksClient) BeginCreate(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskCreateParameters Task, options *TasksClientBeginCreateOptions) (*runtime.Poller[TasksClientCreateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, registryName, taskName, taskCreateParameters, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller[TasksClientCreateResponse](resp, client.internal.Pipeline(), nil) - return poller, err - } else { - return runtime.NewPollerFromResumeToken[TasksClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Create - Creates a task for a container registry with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -func (client *TasksClient) create(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskCreateParameters Task, options *TasksClientBeginCreateOptions) (*http.Response, error) { - var err error - const operationName = "TasksClient.BeginCreate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, registryName, taskName, taskCreateParameters, options) - if err != nil { - return nil, err - } - 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 *TasksClient) createCreateRequest(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskCreateParameters Task, options *TasksClientBeginCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}" - 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 taskName == "" { - return nil, errors.New("parameter taskName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{taskName}", url.PathEscape(taskName)) - 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", "2019-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, taskCreateParameters); err != nil { - return nil, err - } - return req, nil -} - -// BeginDelete - Deletes a specified task. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -// - resourceGroupName - The name of the resource group to which the container registry belongs. -// - registryName - The name of the container registry. -// - taskName - The name of the container registry task. -// - options - TasksClientBeginDeleteOptions contains the optional parameters for the TasksClient.BeginDelete method. -func (client *TasksClient) BeginDelete(ctx context.Context, resourceGroupName string, registryName string, taskName string, options *TasksClientBeginDeleteOptions) (*runtime.Poller[TasksClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, registryName, taskName, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller[TasksClientDeleteResponse](resp, client.internal.Pipeline(), nil) - return poller, err - } else { - return runtime.NewPollerFromResumeToken[TasksClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Delete - Deletes a specified task. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -func (client *TasksClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, taskName string, options *TasksClientBeginDeleteOptions) (*http.Response, error) { - var err error - const operationName = "TasksClient.BeginDelete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, registryName, taskName, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *TasksClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, registryName string, taskName string, options *TasksClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}" - 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 taskName == "" { - return nil, errors.New("parameter taskName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{taskName}", url.PathEscape(taskName)) - 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", "2019-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get the properties of a specified task. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -// - resourceGroupName - The name of the resource group to which the container registry belongs. -// - registryName - The name of the container registry. -// - taskName - The name of the container registry task. -// - options - TasksClientGetOptions contains the optional parameters for the TasksClient.Get method. -func (client *TasksClient) Get(ctx context.Context, resourceGroupName string, registryName string, taskName string, options *TasksClientGetOptions) (TasksClientGetResponse, error) { - var err error - const operationName = "TasksClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, registryName, taskName, options) - if err != nil { - return TasksClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return TasksClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return TasksClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *TasksClient) getCreateRequest(ctx context.Context, resourceGroupName string, registryName string, taskName string, options *TasksClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}" - 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 taskName == "" { - return nil, errors.New("parameter taskName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{taskName}", url.PathEscape(taskName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-06-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 *TasksClient) getHandleResponse(resp *http.Response) (TasksClientGetResponse, error) { - result := TasksClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Task); err != nil { - return TasksClientGetResponse{}, err - } - return result, nil -} - -// GetDetails - Returns a task with extended information that includes all secrets. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -// - resourceGroupName - The name of the resource group to which the container registry belongs. -// - registryName - The name of the container registry. -// - taskName - The name of the container registry task. -// - options - TasksClientGetDetailsOptions contains the optional parameters for the TasksClient.GetDetails method. -func (client *TasksClient) GetDetails(ctx context.Context, resourceGroupName string, registryName string, taskName string, options *TasksClientGetDetailsOptions) (TasksClientGetDetailsResponse, error) { - var err error - const operationName = "TasksClient.GetDetails" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getDetailsCreateRequest(ctx, resourceGroupName, registryName, taskName, options) - if err != nil { - return TasksClientGetDetailsResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return TasksClientGetDetailsResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return TasksClientGetDetailsResponse{}, err - } - resp, err := client.getDetailsHandleResponse(httpResp) - return resp, err -} - -// getDetailsCreateRequest creates the GetDetails request. -func (client *TasksClient) getDetailsCreateRequest(ctx context.Context, resourceGroupName string, registryName string, taskName string, options *TasksClientGetDetailsOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}/listDetails" - 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 taskName == "" { - return nil, errors.New("parameter taskName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{taskName}", url.PathEscape(taskName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getDetailsHandleResponse handles the GetDetails response. -func (client *TasksClient) getDetailsHandleResponse(resp *http.Response) (TasksClientGetDetailsResponse, error) { - result := TasksClientGetDetailsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Task); err != nil { - return TasksClientGetDetailsResponse{}, err - } - return result, nil -} - -// NewListPager - Lists all the tasks for a specified container registry. -// -// Generated from API version 2019-06-01-preview -// - resourceGroupName - The name of the resource group to which the container registry belongs. -// - registryName - The name of the container registry. -// - options - TasksClientListOptions contains the optional parameters for the TasksClient.NewListPager method. -func (client *TasksClient) NewListPager(resourceGroupName string, registryName string, options *TasksClientListOptions) *runtime.Pager[TasksClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[TasksClientListResponse]{ - More: func(page TasksClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *TasksClientListResponse) (TasksClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TasksClient.NewListPager") - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, resourceGroupName, registryName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return TasksClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return TasksClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TasksClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *TasksClient) listCreateRequest(ctx context.Context, resourceGroupName string, registryName string, options *TasksClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks" - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if registryName == "" { - return nil, errors.New("parameter registryName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{registryName}", url.PathEscape(registryName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-06-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 *TasksClient) listHandleResponse(resp *http.Response) (TasksClientListResponse, error) { - result := TasksClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.TaskListResult); err != nil { - return TasksClientListResponse{}, err - } - return result, nil -} - -// BeginUpdate - Updates a task with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -// - resourceGroupName - The name of the resource group to which the container registry belongs. -// - registryName - The name of the container registry. -// - taskName - The name of the container registry task. -// - taskUpdateParameters - The parameters for updating a task. -// - options - TasksClientBeginUpdateOptions contains the optional parameters for the TasksClient.BeginUpdate method. -func (client *TasksClient) BeginUpdate(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskUpdateParameters TaskUpdateParameters, options *TasksClientBeginUpdateOptions) (*runtime.Poller[TasksClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, registryName, taskName, taskUpdateParameters, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller[TasksClientUpdateResponse](resp, client.internal.Pipeline(), nil) - return poller, err - } else { - return runtime.NewPollerFromResumeToken[TasksClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) - } -} - -// Update - Updates a task with the specified parameters. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2019-06-01-preview -func (client *TasksClient) update(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskUpdateParameters TaskUpdateParameters, options *TasksClientBeginUpdateOptions) (*http.Response, error) { - var err error - const operationName = "TasksClient.BeginUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceGroupName, registryName, taskName, taskUpdateParameters, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// updateCreateRequest creates the Update request. -func (client *TasksClient) updateCreateRequest(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskUpdateParameters TaskUpdateParameters, options *TasksClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}" - 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 taskName == "" { - return nil, errors.New("parameter taskName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{taskName}", url.PathEscape(taskName)) - 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", "2019-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, taskUpdateParameters); err != nil { - return nil, err - } - return req, nil -} 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..2ea54d84d433 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_client.go @@ -46,7 +46,7 @@ func NewTokensClient(subscriptionID string, credential azcore.TokenCredential, o // BeginCreate - Creates a token for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - tokenName - The name of the token. @@ -70,7 +70,7 @@ func (client *TokensClient) BeginCreate(ctx context.Context, resourceGroupName s // Create - Creates a token for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *TokensClient) create(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenCreateParameters Token, options *TokensClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "TokensClient.BeginCreate" @@ -113,7 +113,7 @@ func (client *TokensClient) createCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, tokenCreateParameters); err != nil { @@ -125,7 +125,7 @@ func (client *TokensClient) createCreateRequest(ctx context.Context, resourceGro // BeginDelete - Deletes a token from a container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - tokenName - The name of the token. @@ -148,7 +148,7 @@ func (client *TokensClient) BeginDelete(ctx context.Context, resourceGroupName s // Delete - Deletes a token from a container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *TokensClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, tokenName string, options *TokensClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "TokensClient.BeginDelete" @@ -191,7 +191,7 @@ func (client *TokensClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -200,7 +200,7 @@ func (client *TokensClient) deleteCreateRequest(ctx context.Context, resourceGro // Get - Gets the properties of the specified token. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - tokenName - The name of the token. @@ -248,7 +248,7 @@ func (client *TokensClient) getCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -265,7 +265,7 @@ func (client *TokensClient) getHandleResponse(resp *http.Response) (TokensClient // NewListPager - Lists all the tokens for the specified container registry. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - options - TokensClientListOptions contains the optional parameters for the TokensClient.NewListPager method. @@ -316,7 +316,7 @@ func (client *TokensClient) listCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -334,7 +334,7 @@ func (client *TokensClient) listHandleResponse(resp *http.Response) (TokensClien // BeginUpdate - Updates a token with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - tokenName - The name of the token. @@ -358,7 +358,7 @@ func (client *TokensClient) BeginUpdate(ctx context.Context, resourceGroupName s // Update - Updates a token with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *TokensClient) update(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenUpdateParameters TokenUpdateParameters, options *TokensClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "TokensClient.BeginUpdate" @@ -401,7 +401,7 @@ func (client *TokensClient) updateCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, tokenUpdateParameters); err != nil { diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/tokens_client_example_test.go 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..796dbfe3a63e 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client.go @@ -46,7 +46,7 @@ func NewWebhooksClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreate - Creates a webhook for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - webhookName - The name of the webhook. @@ -70,7 +70,7 @@ func (client *WebhooksClient) BeginCreate(ctx context.Context, resourceGroupName // Create - Creates a webhook for a container registry with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *WebhooksClient) create(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookCreateParameters WebhookCreateParameters, options *WebhooksClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "WebhooksClient.BeginCreate" @@ -113,7 +113,7 @@ func (client *WebhooksClient) createCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, webhookCreateParameters); err != nil { @@ -125,7 +125,7 @@ func (client *WebhooksClient) createCreateRequest(ctx context.Context, resourceG // BeginDelete - Deletes a webhook from a container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - webhookName - The name of the webhook. @@ -148,7 +148,7 @@ func (client *WebhooksClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Deletes a webhook from a container registry. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *WebhooksClient) deleteOperation(ctx context.Context, resourceGroupName string, registryName string, webhookName string, options *WebhooksClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "WebhooksClient.BeginDelete" @@ -191,7 +191,7 @@ func (client *WebhooksClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -199,7 +199,7 @@ func (client *WebhooksClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Gets the properties of the specified webhook. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - webhookName - The name of the webhook. @@ -247,7 +247,7 @@ func (client *WebhooksClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -265,7 +265,7 @@ func (client *WebhooksClient) getHandleResponse(resp *http.Response) (WebhooksCl // GetCallbackConfig - Gets the configuration of service URI and custom headers for the webhook. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - webhookName - The name of the webhook. @@ -314,7 +314,7 @@ func (client *WebhooksClient) getCallbackConfigCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -331,7 +331,7 @@ func (client *WebhooksClient) getCallbackConfigHandleResponse(resp *http.Respons // NewListPager - Lists all the webhooks for the specified container registry. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - options - WebhooksClientListOptions contains the optional parameters for the WebhooksClient.NewListPager method. @@ -382,7 +382,7 @@ func (client *WebhooksClient) listCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -399,7 +399,7 @@ func (client *WebhooksClient) listHandleResponse(resp *http.Response) (WebhooksC // NewListEventsPager - Lists recent events for the specified webhook. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - webhookName - The name of the webhook. @@ -455,7 +455,7 @@ func (client *WebhooksClient) listEventsCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -473,7 +473,7 @@ func (client *WebhooksClient) listEventsHandleResponse(resp *http.Response) (Web // Ping - Triggers a ping event to be sent to the webhook. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - webhookName - The name of the webhook. @@ -521,7 +521,7 @@ func (client *WebhooksClient) pingCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -539,7 +539,7 @@ func (client *WebhooksClient) pingHandleResponse(resp *http.Response) (WebhooksC // BeginUpdate - Updates a webhook with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - registryName - The name of the container registry. // - webhookName - The name of the webhook. @@ -563,7 +563,7 @@ func (client *WebhooksClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Updates a webhook with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01-preview +// Generated from API version 2023-07-01 func (client *WebhooksClient) update(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookUpdateParameters WebhookUpdateParameters, options *WebhooksClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "WebhooksClient.BeginUpdate" @@ -606,7 +606,7 @@ func (client *WebhooksClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01-preview") + reqQP.Set("api-version", "2023-07-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, webhookUpdateParameters); err != nil { diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client_example_test.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/webhooks_client_example_test.go 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"), - // } -}