diff --git a/profiles/preview/containerregistry/mgmt/containerregistry/containerregistryapi/models.go b/profiles/preview/containerregistry/mgmt/containerregistry/containerregistryapi/models.go index 976f96f6266c..1d33365b1341 100644 --- a/profiles/preview/containerregistry/mgmt/containerregistry/containerregistryapi/models.go +++ b/profiles/preview/containerregistry/mgmt/containerregistry/containerregistryapi/models.go @@ -25,5 +25,7 @@ type OperationsClientAPI = original.OperationsClientAPI type RegistriesClientAPI = original.RegistriesClientAPI type ReplicationsClientAPI = original.ReplicationsClientAPI type RunsClientAPI = original.RunsClientAPI +type ScopeMapsClientAPI = original.ScopeMapsClientAPI type TasksClientAPI = original.TasksClientAPI +type TokensClientAPI = original.TokensClientAPI type WebhooksClientAPI = original.WebhooksClientAPI diff --git a/profiles/preview/containerregistry/mgmt/containerregistry/models.go b/profiles/preview/containerregistry/mgmt/containerregistry/models.go index dbe09e21f9ce..5a12c618137f 100644 --- a/profiles/preview/containerregistry/mgmt/containerregistry/models.go +++ b/profiles/preview/containerregistry/mgmt/containerregistry/models.go @@ -189,6 +189,13 @@ const ( Pullrequest SourceTriggerEvent = original.Pullrequest ) +type Status = original.Status + +const ( + StatusDisabled Status = original.StatusDisabled + StatusEnabled Status = original.StatusEnabled +) + type TaskStatus = original.TaskStatus const ( @@ -196,6 +203,20 @@ const ( TaskStatusEnabled TaskStatus = original.TaskStatusEnabled ) +type TokenCertificateName = original.TokenCertificateName + +const ( + Certificate1 TokenCertificateName = original.Certificate1 + Certificate2 TokenCertificateName = original.Certificate2 +) + +type TokenPasswordName = original.TokenPasswordName + +const ( + TokenPasswordNamePassword1 TokenPasswordName = original.TokenPasswordNamePassword1 + TokenPasswordNamePassword2 TokenPasswordName = original.TokenPasswordNamePassword2 +) + type TokenType = original.TokenType const ( @@ -247,8 +268,8 @@ const ( type UpdateTriggerPayloadType = original.UpdateTriggerPayloadType const ( - Default UpdateTriggerPayloadType = original.Default - Token UpdateTriggerPayloadType = original.Token + UpdateTriggerPayloadTypeDefault UpdateTriggerPayloadType = original.UpdateTriggerPayloadTypeDefault + UpdateTriggerPayloadTypeToken UpdateTriggerPayloadType = original.UpdateTriggerPayloadTypeToken ) type Variant = original.Variant @@ -308,6 +329,8 @@ type EventResponseMessage = original.EventResponseMessage type FileTaskRunRequest = original.FileTaskRunRequest type FileTaskStep = original.FileTaskStep type FileTaskStepUpdateParameters = original.FileTaskStepUpdateParameters +type GenerateCredentialsParameters = original.GenerateCredentialsParameters +type GenerateCredentialsResult = original.GenerateCredentialsResult type IPRule = original.IPRule type IdentityProperties = original.IdentityProperties type ImageDescriptor = original.ImageDescriptor @@ -335,6 +358,7 @@ type RegenerateCredentialParameters = original.RegenerateCredentialParameters type RegistriesClient = original.RegistriesClient type RegistriesCreateFuture = original.RegistriesCreateFuture type RegistriesDeleteFuture = original.RegistriesDeleteFuture +type RegistriesGenerateCredentialsFuture = original.RegistriesGenerateCredentialsFuture type RegistriesImportImageFuture = original.RegistriesImportImageFuture type RegistriesScheduleRunFuture = original.RegistriesScheduleRunFuture type RegistriesUpdateFuture = original.RegistriesUpdateFuture @@ -376,6 +400,17 @@ type RunUpdateParameters = original.RunUpdateParameters type RunsCancelFuture = original.RunsCancelFuture type RunsClient = original.RunsClient type RunsUpdateFuture = original.RunsUpdateFuture +type ScopeMap = original.ScopeMap +type ScopeMapListResult = original.ScopeMapListResult +type ScopeMapListResultIterator = original.ScopeMapListResultIterator +type ScopeMapListResultPage = original.ScopeMapListResultPage +type ScopeMapProperties = original.ScopeMapProperties +type ScopeMapPropertiesUpdateParameters = original.ScopeMapPropertiesUpdateParameters +type ScopeMapUpdateParameters = original.ScopeMapUpdateParameters +type ScopeMapsClient = original.ScopeMapsClient +type ScopeMapsCreateFuture = original.ScopeMapsCreateFuture +type ScopeMapsDeleteFuture = original.ScopeMapsDeleteFuture +type ScopeMapsUpdateFuture = original.ScopeMapsUpdateFuture type SecretObject = original.SecretObject type SetValue = original.SetValue type Sku = original.Sku @@ -387,7 +422,7 @@ type SourceTriggerDescriptor = original.SourceTriggerDescriptor type SourceTriggerUpdateParameters = original.SourceTriggerUpdateParameters type SourceUpdateParameters = original.SourceUpdateParameters type SourceUploadDefinition = original.SourceUploadDefinition -type Status = original.Status +type Status1 = original.Status1 type StorageAccountProperties = original.StorageAccountProperties type Target = original.Target type Task = original.Task @@ -407,6 +442,20 @@ type TasksUpdateFuture = original.TasksUpdateFuture type TimerTrigger = original.TimerTrigger type TimerTriggerDescriptor = original.TimerTriggerDescriptor type TimerTriggerUpdateParameters = original.TimerTriggerUpdateParameters +type Token = original.Token +type TokenCertificate = original.TokenCertificate +type TokenCredentialsProperties = original.TokenCredentialsProperties +type TokenListResult = original.TokenListResult +type TokenListResultIterator = original.TokenListResultIterator +type TokenListResultPage = original.TokenListResultPage +type TokenPassword = original.TokenPassword +type TokenProperties = original.TokenProperties +type TokenUpdateParameters = original.TokenUpdateParameters +type TokenUpdateProperties = original.TokenUpdateProperties +type TokensClient = original.TokensClient +type TokensCreateFuture = original.TokensCreateFuture +type TokensDeleteFuture = original.TokensDeleteFuture +type TokensUpdateFuture = original.TokensUpdateFuture type TriggerProperties = original.TriggerProperties type TriggerUpdateParameters = original.TriggerUpdateParameters type TrustPolicy = original.TrustPolicy @@ -483,6 +532,18 @@ func NewRunsClient(subscriptionID string) RunsClient { func NewRunsClientWithBaseURI(baseURI string, subscriptionID string) RunsClient { return original.NewRunsClientWithBaseURI(baseURI, subscriptionID) } +func NewScopeMapListResultIterator(page ScopeMapListResultPage) ScopeMapListResultIterator { + return original.NewScopeMapListResultIterator(page) +} +func NewScopeMapListResultPage(getNextPage func(context.Context, ScopeMapListResult) (ScopeMapListResult, error)) ScopeMapListResultPage { + return original.NewScopeMapListResultPage(getNextPage) +} +func NewScopeMapsClient(subscriptionID string) ScopeMapsClient { + return original.NewScopeMapsClient(subscriptionID) +} +func NewScopeMapsClientWithBaseURI(baseURI string, subscriptionID string) ScopeMapsClient { + return original.NewScopeMapsClientWithBaseURI(baseURI, subscriptionID) +} func NewTaskListResultIterator(page TaskListResultPage) TaskListResultIterator { return original.NewTaskListResultIterator(page) } @@ -495,6 +556,18 @@ func NewTasksClient(subscriptionID string) TasksClient { func NewTasksClientWithBaseURI(baseURI string, subscriptionID string) TasksClient { return original.NewTasksClientWithBaseURI(baseURI, subscriptionID) } +func NewTokenListResultIterator(page TokenListResultPage) TokenListResultIterator { + return original.NewTokenListResultIterator(page) +} +func NewTokenListResultPage(getNextPage func(context.Context, TokenListResult) (TokenListResult, error)) TokenListResultPage { + return original.NewTokenListResultPage(getNextPage) +} +func NewTokensClient(subscriptionID string) TokensClient { + return original.NewTokensClient(subscriptionID) +} +func NewTokensClientWithBaseURI(baseURI string, subscriptionID string) TokensClient { + return original.NewTokensClientWithBaseURI(baseURI, subscriptionID) +} func NewWebhookListResultIterator(page WebhookListResultPage) WebhookListResultIterator { return original.NewWebhookListResultIterator(page) } @@ -570,9 +643,18 @@ func PossibleSourceRegistryLoginModeValues() []SourceRegistryLoginMode { func PossibleSourceTriggerEventValues() []SourceTriggerEvent { return original.PossibleSourceTriggerEventValues() } +func PossibleStatusValues() []Status { + return original.PossibleStatusValues() +} func PossibleTaskStatusValues() []TaskStatus { return original.PossibleTaskStatusValues() } +func PossibleTokenCertificateNameValues() []TokenCertificateName { + return original.PossibleTokenCertificateNameValues() +} +func PossibleTokenPasswordNameValues() []TokenPasswordName { + return original.PossibleTokenPasswordNameValues() +} func PossibleTokenTypeValues() []TokenType { return original.PossibleTokenTypeValues() } diff --git a/services/containerregistry/mgmt/2019-05-01/containerregistry/models.go b/services/containerregistry/mgmt/2019-05-01/containerregistry/models.go index 8ab53a369144..cf551f2a5e17 100644 --- a/services/containerregistry/mgmt/2019-05-01/containerregistry/models.go +++ b/services/containerregistry/mgmt/2019-05-01/containerregistry/models.go @@ -2024,7 +2024,7 @@ type OperationPropertiesDefinition struct { ServiceSpecification *OperationServiceSpecificationDefinition `json:"serviceSpecification,omitempty"` } -// OperationServiceSpecificationDefinition the definition of Azure Monitoring metrics list. +// OperationServiceSpecificationDefinition the definition of Azure Monitoring list. type OperationServiceSpecificationDefinition struct { // MetricSpecifications - A list of Azure Monitoring metrics definition. MetricSpecifications *[]OperationMetricSpecificationDefinition `json:"metricSpecifications,omitempty"` @@ -3022,7 +3022,7 @@ func (r Resource) MarshalJSON() ([]byte, error) { // RetentionPolicy the retention policy for a container registry. type RetentionPolicy struct { - // Days - The number of days to retain manifest before it expires. + // Days - The number of days to retain an untagged manifest after which it gets purged. Days *int32 `json:"days,omitempty"` // LastUpdatedTime - READ-ONLY; The timestamp when the policy was last updated. LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` diff --git a/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/containerregistryapi/interfaces.go b/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/containerregistryapi/interfaces.go index 8a80b2ae34d6..56d3e1d0610d 100644 --- a/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/containerregistryapi/interfaces.go +++ b/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/containerregistryapi/interfaces.go @@ -27,6 +27,7 @@ type RegistriesClientAPI interface { CheckNameAvailability(ctx context.Context, registryNameCheckRequest containerregistry.RegistryNameCheckRequest) (result containerregistry.RegistryNameStatus, err error) Create(ctx context.Context, resourceGroupName string, registryName string, registry containerregistry.Registry) (result containerregistry.RegistriesCreateFuture, err error) Delete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.RegistriesDeleteFuture, err error) + GenerateCredentials(ctx context.Context, resourceGroupName string, registryName string, generateCredentialsParameters containerregistry.GenerateCredentialsParameters) (result containerregistry.RegistriesGenerateCredentialsFuture, err error) Get(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.Registry, err error) GetBuildSourceUploadURL(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.SourceUploadDefinition, err error) ImportImage(ctx context.Context, resourceGroupName string, registryName string, parameters containerregistry.ImportImageParameters) (result containerregistry.RegistriesImportImageFuture, err error) @@ -95,3 +96,25 @@ type TasksClientAPI interface { } var _ TasksClientAPI = (*containerregistry.TasksClient)(nil) + +// ScopeMapsClientAPI contains the set of methods on the ScopeMapsClient type. +type ScopeMapsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapCreateParameters containerregistry.ScopeMap) (result containerregistry.ScopeMapsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string) (result containerregistry.ScopeMapsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string) (result containerregistry.ScopeMap, err error) + List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ScopeMapListResultPage, err error) + Update(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapUpdateParameters containerregistry.ScopeMapUpdateParameters) (result containerregistry.ScopeMapsUpdateFuture, err error) +} + +var _ ScopeMapsClientAPI = (*containerregistry.ScopeMapsClient)(nil) + +// TokensClientAPI contains the set of methods on the TokensClient type. +type TokensClientAPI interface { + Create(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenCreateParameters containerregistry.Token) (result containerregistry.TokensCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, registryName string, tokenName string) (result containerregistry.TokensDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, registryName string, tokenName string) (result containerregistry.Token, err error) + List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.TokenListResultPage, err error) + Update(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenUpdateParameters containerregistry.TokenUpdateParameters) (result containerregistry.TokensUpdateFuture, err error) +} + +var _ TokensClientAPI = (*containerregistry.TokensClient)(nil) diff --git a/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/models.go b/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/models.go index f63f572b0722..0c1f03b9afbd 100644 --- a/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/models.go +++ b/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/models.go @@ -371,6 +371,21 @@ func PossibleSourceTriggerEventValues() []SourceTriggerEvent { return []SourceTriggerEvent{Commit, Pullrequest} } +// Status enumerates the values for status. +type Status string + +const ( + // StatusDisabled ... + StatusDisabled Status = "disabled" + // StatusEnabled ... + StatusEnabled Status = "enabled" +) + +// PossibleStatusValues returns an array of possible values for the Status const type. +func PossibleStatusValues() []Status { + return []Status{StatusDisabled, StatusEnabled} +} + // TaskStatus enumerates the values for task status. type TaskStatus string @@ -386,6 +401,36 @@ func PossibleTaskStatusValues() []TaskStatus { return []TaskStatus{TaskStatusDisabled, TaskStatusEnabled} } +// TokenCertificateName enumerates the values for token certificate name. +type TokenCertificateName string + +const ( + // Certificate1 ... + Certificate1 TokenCertificateName = "certificate1" + // Certificate2 ... + Certificate2 TokenCertificateName = "certificate2" +) + +// PossibleTokenCertificateNameValues returns an array of possible values for the TokenCertificateName const type. +func PossibleTokenCertificateNameValues() []TokenCertificateName { + return []TokenCertificateName{Certificate1, Certificate2} +} + +// TokenPasswordName enumerates the values for token password name. +type TokenPasswordName string + +const ( + // TokenPasswordNamePassword1 ... + TokenPasswordNamePassword1 TokenPasswordName = "password1" + // TokenPasswordNamePassword2 ... + TokenPasswordNamePassword2 TokenPasswordName = "password2" +) + +// PossibleTokenPasswordNameValues returns an array of possible values for the TokenPasswordName const type. +func PossibleTokenPasswordNameValues() []TokenPasswordName { + return []TokenPasswordName{TokenPasswordNamePassword1, TokenPasswordNamePassword2} +} + // TokenType enumerates the values for token type. type TokenType string @@ -492,15 +537,15 @@ func PossibleTypeBasicTaskStepUpdateParametersValues() []TypeBasicTaskStepUpdate type UpdateTriggerPayloadType string const ( - // Default ... - Default UpdateTriggerPayloadType = "Default" - // Token ... - Token UpdateTriggerPayloadType = "Token" + // UpdateTriggerPayloadTypeDefault ... + UpdateTriggerPayloadTypeDefault UpdateTriggerPayloadType = "Default" + // UpdateTriggerPayloadTypeToken ... + UpdateTriggerPayloadTypeToken UpdateTriggerPayloadType = "Token" ) // PossibleUpdateTriggerPayloadTypeValues returns an array of possible values for the UpdateTriggerPayloadType const type. func PossibleUpdateTriggerPayloadTypeValues() []UpdateTriggerPayloadType { - return []UpdateTriggerPayloadType{Default, Token} + return []UpdateTriggerPayloadType{UpdateTriggerPayloadTypeDefault, UpdateTriggerPayloadTypeToken} } // Variant enumerates the values for variant. @@ -627,7 +672,7 @@ type BaseImageTrigger struct { BaseImageTriggerType BaseImageTriggerType `json:"baseImageTriggerType,omitempty"` // UpdateTriggerEndpoint - The endpoint URL for receiving update triggers. UpdateTriggerEndpoint *string `json:"updateTriggerEndpoint,omitempty"` - // UpdateTriggerPayloadType - Type of Payload body for Base image update triggers. Possible values include: 'Default', 'Token' + // UpdateTriggerPayloadType - Type of Payload body for Base image update triggers. Possible values include: 'UpdateTriggerPayloadTypeDefault', 'UpdateTriggerPayloadTypeToken' UpdateTriggerPayloadType UpdateTriggerPayloadType `json:"updateTriggerPayloadType,omitempty"` // Status - The current status of trigger. Possible values include: 'TriggerStatusDisabled', 'TriggerStatusEnabled' Status TriggerStatus `json:"status,omitempty"` @@ -641,7 +686,7 @@ type BaseImageTriggerUpdateParameters struct { BaseImageTriggerType BaseImageTriggerType `json:"baseImageTriggerType,omitempty"` // UpdateTriggerEndpoint - The endpoint URL for receiving update triggers. UpdateTriggerEndpoint *string `json:"updateTriggerEndpoint,omitempty"` - // UpdateTriggerPayloadType - Type of Payload body for Base image update triggers. Possible values include: 'Default', 'Token' + // UpdateTriggerPayloadType - Type of Payload body for Base image update triggers. Possible values include: 'UpdateTriggerPayloadTypeDefault', 'UpdateTriggerPayloadTypeToken' UpdateTriggerPayloadType UpdateTriggerPayloadType `json:"updateTriggerPayloadType,omitempty"` // Status - The current status of trigger. Possible values include: 'TriggerStatusDisabled', 'TriggerStatusEnabled' Status TriggerStatus `json:"status,omitempty"` @@ -1682,6 +1727,26 @@ func (ftsup FileTaskStepUpdateParameters) AsBasicTaskStepUpdateParameters() (Bas return &ftsup, true } +// GenerateCredentialsParameters the parameters used to generate credentials for a specified token or user +// of a container registry. +type GenerateCredentialsParameters struct { + // TokenID - The resource ID of the token for which credentials have to be generated. + TokenID *string `json:"tokenId,omitempty"` + // Expiry - The expiry date of the generated credentials after which the credentials become invalid. + Expiry *date.Time `json:"expiry,omitempty"` + // Name - Specifies name of the password which should be regenerated if any -- password or password2. Possible values include: 'TokenPasswordNamePassword1', 'TokenPasswordNamePassword2' + Name TokenPasswordName `json:"name,omitempty"` +} + +// GenerateCredentialsResult the response from the GenerateCredentials operation. +type GenerateCredentialsResult struct { + autorest.Response `json:"-"` + // Username - The username for a container registry. + Username *string `json:"username,omitempty"` + // Passwords - The list of passwords for a container registry. + Passwords *[]TokenPassword `json:"passwords,omitempty"` +} + // IdentityProperties managed identity for the resource. type IdentityProperties struct { // PrincipalID - The principal ID of resource identity. @@ -2051,7 +2116,7 @@ type OperationPropertiesDefinition struct { ServiceSpecification *OperationServiceSpecificationDefinition `json:"serviceSpecification,omitempty"` } -// OperationServiceSpecificationDefinition the definition of Azure Monitoring metrics list. +// OperationServiceSpecificationDefinition the definition of Azure Monitoring list. type OperationServiceSpecificationDefinition struct { // MetricSpecifications - A list of Azure Monitoring metrics definition. MetricSpecifications *[]OperationMetricSpecificationDefinition `json:"metricSpecifications,omitempty"` @@ -2179,6 +2244,35 @@ func (future *RegistriesDeleteFuture) Result(client RegistriesClient) (ar autore return } +// RegistriesGenerateCredentialsFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type RegistriesGenerateCredentialsFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *RegistriesGenerateCredentialsFuture) Result(client RegistriesClient) (gcr GenerateCredentialsResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesGenerateCredentialsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesGenerateCredentialsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if gcr.Response.Response, err = future.GetResult(sender); err == nil && gcr.Response.Response.StatusCode != http.StatusNoContent { + gcr, err = client.GenerateCredentialsResponder(gcr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesGenerateCredentialsFuture", "Result", gcr.Response.Response, "Failure responding to request") + } + } + return +} + // RegistriesImportImageFuture an abstraction for monitoring and retrieving the results of a long-running // operation. type RegistriesImportImageFuture struct { @@ -2566,7 +2660,7 @@ type RegistryProperties struct { // ProvisioningState - READ-ONLY; The provisioning state of the container registry at the time the operation was called. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` // Status - READ-ONLY; The status of the container registry at the time the operation was called. - Status *Status `json:"status,omitempty"` + Status *Status1 `json:"status,omitempty"` // AdminUserEnabled - The value that indicates whether the admin user is enabled. AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"` // StorageAccount - The properties of the storage account for the container registry. Only applicable to Classic SKU. @@ -2925,7 +3019,7 @@ type ReplicationProperties struct { // ProvisioningState - READ-ONLY; The provisioning state of the replication at the time the operation was called. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` // Status - READ-ONLY; The status of the replication at the time the operation was called. - Status *Status `json:"status,omitempty"` + Status *Status1 `json:"status,omitempty"` } // ReplicationsCreateFuture an abstraction for monitoring and retrieving the results of a long-running @@ -3066,7 +3160,7 @@ func (r Resource) MarshalJSON() ([]byte, error) { // RetentionPolicy the retention policy for a container registry. type RetentionPolicy struct { - // Days - The number of days to retain manifest before it expires. + // Days - The number of days to retain an untagged manifest after which it gets purged. Days *int32 `json:"days,omitempty"` // LastUpdatedTime - READ-ONLY; The timestamp when the policy was last updated. LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` @@ -3530,208 +3624,30 @@ type RunUpdateParameters struct { IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` } -// SecretObject describes the properties of a secret object value. -type SecretObject struct { - // Value - 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 `json:"value,omitempty"` - // Type - The type of the secret object which determines how the value of the secret object has to be - // interpreted. Possible values include: 'Opaque', 'Vaultsecret' - Type SecretObjectType `json:"type,omitempty"` -} - -// SetValue the properties of a overridable value that can be passed to a task template. -type SetValue struct { - // Name - The name of the overridable value. - Name *string `json:"name,omitempty"` - // Value - The overridable value. - Value *string `json:"value,omitempty"` - // IsSecret - Flag to indicate whether the value represents a secret or not. - IsSecret *bool `json:"isSecret,omitempty"` -} - -// Sku the SKU of a container registry. -type Sku struct { - // Name - The SKU name of the container registry. Required for registry creation. Possible values include: 'Classic', 'Basic', 'Standard', 'Premium' - Name SkuName `json:"name,omitempty"` - // Tier - READ-ONLY; The SKU tier based on the SKU name. Possible values include: 'SkuTierClassic', 'SkuTierBasic', 'SkuTierStandard', 'SkuTierPremium' - Tier SkuTier `json:"tier,omitempty"` -} - -// Source the registry node that generated the event. Put differently, while the actor initiates the event, -// the source generates it. -type Source struct { - // Addr - 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 `json:"addr,omitempty"` - // InstanceID - The running instance of an application. Changes after each restart. - InstanceID *string `json:"instanceID,omitempty"` -} - -// SourceProperties the properties of the source code repository. -type SourceProperties struct { - // SourceControlType - The type of source control service. Possible values include: 'Github', 'VisualStudioTeamService' - SourceControlType SourceControlType `json:"sourceControlType,omitempty"` - // RepositoryURL - The full URL to the source code repository - RepositoryURL *string `json:"repositoryUrl,omitempty"` - // Branch - The branch name of the source code. - Branch *string `json:"branch,omitempty"` - // SourceControlAuthProperties - The authorization properties for accessing the source code repository and to set up - // webhooks for notifications. - SourceControlAuthProperties *AuthInfo `json:"sourceControlAuthProperties,omitempty"` -} - -// SourceRegistryCredentials describes the credential parameters for accessing the source registry. -type SourceRegistryCredentials struct { - // LoginMode - 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. Possible values include: 'SourceRegistryLoginModeNone', 'SourceRegistryLoginModeDefault' - LoginMode SourceRegistryLoginMode `json:"loginMode,omitempty"` -} - -// SourceTrigger the properties of a source based trigger. -type SourceTrigger struct { - // SourceRepository - The properties that describes the source(code) for the task. - SourceRepository *SourceProperties `json:"sourceRepository,omitempty"` - // SourceTriggerEvents - The source event corresponding to the trigger. - SourceTriggerEvents *[]SourceTriggerEvent `json:"sourceTriggerEvents,omitempty"` - // Status - The current status of trigger. Possible values include: 'TriggerStatusDisabled', 'TriggerStatusEnabled' - Status TriggerStatus `json:"status,omitempty"` - // Name - The name of the trigger. - Name *string `json:"name,omitempty"` -} - -// SourceTriggerDescriptor the source trigger that caused a run. -type SourceTriggerDescriptor struct { - // ID - The unique ID of the trigger. - ID *string `json:"id,omitempty"` - // EventType - The event type of the trigger. - EventType *string `json:"eventType,omitempty"` - // CommitID - The unique ID that identifies a commit. - CommitID *string `json:"commitId,omitempty"` - // PullRequestID - The unique ID that identifies pull request. - PullRequestID *string `json:"pullRequestId,omitempty"` - // RepositoryURL - The repository URL. - RepositoryURL *string `json:"repositoryUrl,omitempty"` - // BranchName - The branch name in the repository. - BranchName *string `json:"branchName,omitempty"` - // ProviderType - The source control provider type. - ProviderType *string `json:"providerType,omitempty"` -} - -// SourceTriggerUpdateParameters the properties for updating a source based trigger. -type SourceTriggerUpdateParameters struct { - // SourceRepository - The properties that describes the source(code) for the task. - SourceRepository *SourceUpdateParameters `json:"sourceRepository,omitempty"` - // SourceTriggerEvents - The source event corresponding to the trigger. - SourceTriggerEvents *[]SourceTriggerEvent `json:"sourceTriggerEvents,omitempty"` - // Status - The current status of trigger. Possible values include: 'TriggerStatusDisabled', 'TriggerStatusEnabled' - Status TriggerStatus `json:"status,omitempty"` - // Name - The name of the trigger. - Name *string `json:"name,omitempty"` -} - -// SourceUpdateParameters the properties for updating the source code repository. -type SourceUpdateParameters struct { - // SourceControlType - The type of source control service. Possible values include: 'Github', 'VisualStudioTeamService' - SourceControlType SourceControlType `json:"sourceControlType,omitempty"` - // RepositoryURL - The full URL to the source code repository - RepositoryURL *string `json:"repositoryUrl,omitempty"` - // Branch - The branch name of the source code. - Branch *string `json:"branch,omitempty"` - // SourceControlAuthProperties - The authorization properties for accessing the source code repository and to set up - // webhooks for notifications. - SourceControlAuthProperties *AuthInfoUpdateParameters `json:"sourceControlAuthProperties,omitempty"` -} - -// SourceUploadDefinition the properties of a response to source upload request. -type SourceUploadDefinition struct { - autorest.Response `json:"-"` - // UploadURL - The URL where the client can upload the source. - UploadURL *string `json:"uploadUrl,omitempty"` - // RelativePath - The relative path to the source. This is used to submit the subsequent queue build request. - RelativePath *string `json:"relativePath,omitempty"` -} - -// Status the status of an Azure resource at the time the operation was called. -type Status struct { - // DisplayStatus - READ-ONLY; The short label for the status. - DisplayStatus *string `json:"displayStatus,omitempty"` - // Message - READ-ONLY; The detailed message for the status, including alerts and error messages. - Message *string `json:"message,omitempty"` - // Timestamp - READ-ONLY; The timestamp when the status was changed to the current value. - Timestamp *date.Time `json:"timestamp,omitempty"` -} - -// StorageAccountProperties the properties of a storage account for a container registry. Only applicable -// to Classic SKU. -type StorageAccountProperties struct { - // ID - The resource ID of the storage account. - ID *string `json:"id,omitempty"` -} - -// Target the target of the event. -type Target struct { - // MediaType - The MIME type of the referenced object. - MediaType *string `json:"mediaType,omitempty"` - // Size - The number of bytes of the content. Same as Length field. - Size *int64 `json:"size,omitempty"` - // Digest - The digest of the content, as defined by the Registry V2 HTTP API Specification. - Digest *string `json:"digest,omitempty"` - // Length - The number of bytes of the content. Same as Size field. - Length *int64 `json:"length,omitempty"` - // Repository - The repository name. - Repository *string `json:"repository,omitempty"` - // URL - The direct URL to the content. - URL *string `json:"url,omitempty"` - // Tag - The tag name. - Tag *string `json:"tag,omitempty"` - // Name - The name of the artifact. - Name *string `json:"name,omitempty"` - // Version - The version of the artifact. - Version *string `json:"version,omitempty"` -} - -// 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 { +// ScopeMap an object that represents a scope map for a container registry. +type ScopeMap struct { autorest.Response `json:"-"` - // Identity - Identity for the resource. - Identity *IdentityProperties `json:"identity,omitempty"` - // TaskProperties - The properties of a task. - *TaskProperties `json:"properties,omitempty"` + // ScopeMapProperties - The properties of the scope map. + *ScopeMapProperties `json:"properties,omitempty"` // ID - READ-ONLY; The resource ID. ID *string `json:"id,omitempty"` // Name - READ-ONLY; The name of the resource. Name *string `json:"name,omitempty"` // Type - READ-ONLY; The type of the resource. Type *string `json:"type,omitempty"` - // Location - The location of the resource. This cannot be changed after the resource is created. - Location *string `json:"location,omitempty"` - // Tags - The tags of the resource. - Tags map[string]*string `json:"tags"` } -// MarshalJSON is the custom marshaler for Task. -func (t Task) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ScopeMap. +func (sm ScopeMap) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if t.Identity != nil { - objectMap["identity"] = t.Identity - } - if t.TaskProperties != nil { - objectMap["properties"] = t.TaskProperties - } - if t.Location != nil { - objectMap["location"] = t.Location - } - if t.Tags != nil { - objectMap["tags"] = t.Tags + if sm.ScopeMapProperties != nil { + objectMap["properties"] = sm.ScopeMapProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for Task struct. -func (t *Task) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for ScopeMap struct. +func (sm *ScopeMap) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -3739,23 +3655,14 @@ func (t *Task) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { - case "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - t.Identity = &identity - } case "properties": if v != nil { - var taskProperties TaskProperties - err = json.Unmarshal(*v, &taskProperties) + var scopeMapProperties ScopeMapProperties + err = json.Unmarshal(*v, &scopeMapProperties) if err != nil { return err } - t.TaskProperties = &taskProperties + sm.ScopeMapProperties = &scopeMapProperties } case "id": if v != nil { @@ -3764,7 +3671,7 @@ func (t *Task) UnmarshalJSON(body []byte) error { if err != nil { return err } - t.ID = &ID + sm.ID = &ID } case "name": if v != nil { @@ -3773,7 +3680,7 @@ func (t *Task) UnmarshalJSON(body []byte) error { if err != nil { return err } - t.Name = &name + sm.Name = &name } case "type": if v != nil { @@ -3782,25 +3689,7 @@ func (t *Task) UnmarshalJSON(body []byte) error { if err != nil { return err } - t.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - t.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - t.Tags = tags + sm.Type = &typeVar } } } @@ -3808,26 +3697,26 @@ func (t *Task) UnmarshalJSON(body []byte) error { return nil } -// TaskListResult the collection of tasks. -type TaskListResult struct { +// ScopeMapListResult the result of a request to list scope maps for a container registry. +type ScopeMapListResult struct { autorest.Response `json:"-"` - // Value - The collection value. - Value *[]Task `json:"value,omitempty"` - // NextLink - The URI that can be used to request the next set of paged results. + // Value - 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 `json:"value,omitempty"` + // NextLink - The URI that can be used to request the next list of scope maps. NextLink *string `json:"nextLink,omitempty"` } -// TaskListResultIterator provides access to a complete listing of Task values. -type TaskListResultIterator struct { +// ScopeMapListResultIterator provides access to a complete listing of ScopeMap values. +type ScopeMapListResultIterator struct { i int - page TaskListResultPage + page ScopeMapListResultPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *TaskListResultIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *ScopeMapListResultIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskListResultIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapListResultIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -3852,62 +3741,62 @@ func (iter *TaskListResultIterator) NextWithContext(ctx context.Context) (err er // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *TaskListResultIterator) Next() error { +func (iter *ScopeMapListResultIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TaskListResultIterator) NotDone() bool { +func (iter ScopeMapListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter TaskListResultIterator) Response() TaskListResult { +func (iter ScopeMapListResultIterator) Response() ScopeMapListResult { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter TaskListResultIterator) Value() Task { +func (iter ScopeMapListResultIterator) Value() ScopeMap { if !iter.page.NotDone() { - return Task{} + return ScopeMap{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the TaskListResultIterator type. -func NewTaskListResultIterator(page TaskListResultPage) TaskListResultIterator { - return TaskListResultIterator{page: page} +// Creates a new instance of the ScopeMapListResultIterator type. +func NewScopeMapListResultIterator(page ScopeMapListResultPage) ScopeMapListResultIterator { + return ScopeMapListResultIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (tlr TaskListResult) IsEmpty() bool { - return tlr.Value == nil || len(*tlr.Value) == 0 +func (smlr ScopeMapListResult) IsEmpty() bool { + return smlr.Value == nil || len(*smlr.Value) == 0 } -// taskListResultPreparer prepares a request to retrieve the next set of results. +// scopeMapListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (tlr TaskListResult) taskListResultPreparer(ctx context.Context) (*http.Request, error) { - if tlr.NextLink == nil || len(to.String(tlr.NextLink)) < 1 { +func (smlr ScopeMapListResult) scopeMapListResultPreparer(ctx context.Context) (*http.Request, error) { + if smlr.NextLink == nil || len(to.String(smlr.NextLink)) < 1 { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(tlr.NextLink))) + autorest.WithBaseURL(to.String(smlr.NextLink))) } -// TaskListResultPage contains a page of Task values. -type TaskListResultPage struct { - fn func(context.Context, TaskListResult) (TaskListResult, error) - tlr TaskListResult +// ScopeMapListResultPage contains a page of ScopeMap values. +type ScopeMapListResultPage struct { + fn func(context.Context, ScopeMapListResult) (ScopeMapListResult, error) + smlr ScopeMapListResult } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *TaskListResultPage) NextWithContext(ctx context.Context) (err error) { +func (page *ScopeMapListResultPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskListResultPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapListResultPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -3916,181 +3805,168 @@ func (page *TaskListResultPage) NextWithContext(ctx context.Context) (err error) tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.tlr) + next, err := page.fn(ctx, page.smlr) if err != nil { return err } - page.tlr = next + page.smlr = next return nil } // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *TaskListResultPage) Next() error { +func (page *ScopeMapListResultPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TaskListResultPage) NotDone() bool { - return !page.tlr.IsEmpty() +func (page ScopeMapListResultPage) NotDone() bool { + return !page.smlr.IsEmpty() } // Response returns the raw server response from the last page request. -func (page TaskListResultPage) Response() TaskListResult { - return page.tlr +func (page ScopeMapListResultPage) Response() ScopeMapListResult { + return page.smlr } // Values returns the slice of values for the current page or nil if there are no values. -func (page TaskListResultPage) Values() []Task { - if page.tlr.IsEmpty() { +func (page ScopeMapListResultPage) Values() []ScopeMap { + if page.smlr.IsEmpty() { return nil } - return *page.tlr.Value + return *page.smlr.Value } -// Creates a new instance of the TaskListResultPage type. -func NewTaskListResultPage(getNextPage func(context.Context, TaskListResult) (TaskListResult, error)) TaskListResultPage { - return TaskListResultPage{fn: getNextPage} +// Creates a new instance of the ScopeMapListResultPage type. +func NewScopeMapListResultPage(getNextPage func(context.Context, ScopeMapListResult) (ScopeMapListResult, error)) ScopeMapListResultPage { + return ScopeMapListResultPage{fn: getNextPage} } -// TaskProperties the properties of a task. -type TaskProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state of the task. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // CreationDate - READ-ONLY; The creation date of task. +// ScopeMapProperties the properties of a scope map. +type ScopeMapProperties struct { + // Description - The user friendly description of the scope map. + Description *string `json:"description,omitempty"` + // Type - READ-ONLY; The type of the scope map. E.g. BuildIn scope map. + Type *string `json:"type,omitempty"` + // CreationDate - READ-ONLY; The creation date of scope map. CreationDate *date.Time `json:"creationDate,omitempty"` - // Status - The current status of task. Possible values include: 'TaskStatusDisabled', 'TaskStatusEnabled' - Status TaskStatus `json:"status,omitempty"` - // Platform - The platform properties against which the run has to happen. - Platform *PlatformProperties `json:"platform,omitempty"` - // AgentConfiguration - The machine configuration of the run agent. - AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` - // Timeout - Run timeout in seconds. - Timeout *int32 `json:"timeout,omitempty"` - // Step - The properties of a task step. - Step BasicTaskStepProperties `json:"step,omitempty"` - // Trigger - The properties that describe all triggers for the task. - Trigger *TriggerProperties `json:"trigger,omitempty"` - // Credentials - The properties that describes a set of credentials that will be used when this run is invoked. - Credentials *Credentials `json:"credentials,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the resource. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Actions - The list of scoped permissions for registry artifacts. + // E.g. repositories/repository-name/pull, + // repositories/repository-name/delete + Actions *[]string `json:"actions,omitempty"` } -// UnmarshalJSON is the custom unmarshaler for TaskProperties struct. -func (tp *TaskProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) +// ScopeMapPropertiesUpdateParameters the update parameters for scope map properties. +type ScopeMapPropertiesUpdateParameters struct { + // Description - The user friendly description of the scope map. + Description *string `json:"description,omitempty"` + // Actions - The list of scope permissions for registry artifacts. + // E.g. repositories/repository-name/pull, + // repositories/repository-name/delete + Actions *[]string `json:"actions,omitempty"` +} + +// ScopeMapsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ScopeMapsCreateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ScopeMapsCreateFuture) Result(client ScopeMapsClient) (sm ScopeMap, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) if err != nil { - return err + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsCreateFuture", "Result", future.Response(), "Polling failure") + return } - for k, v := range m { - switch k { - case "provisioningState": - if v != nil { - var provisioningState ProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - tp.ProvisioningState = provisioningState - } - case "creationDate": - if v != nil { - var creationDate date.Time - err = json.Unmarshal(*v, &creationDate) - if err != nil { - return err - } - tp.CreationDate = &creationDate - } - case "status": - if v != nil { - var status TaskStatus - err = json.Unmarshal(*v, &status) - if err != nil { - return err - } - tp.Status = status - } - case "platform": - if v != nil { - var platform PlatformProperties - err = json.Unmarshal(*v, &platform) - if err != nil { - return err - } - tp.Platform = &platform - } - case "agentConfiguration": - if v != nil { - var agentConfiguration AgentProperties - err = json.Unmarshal(*v, &agentConfiguration) - if err != nil { - return err - } - tp.AgentConfiguration = &agentConfiguration - } - case "timeout": - if v != nil { - var timeout int32 - err = json.Unmarshal(*v, &timeout) - if err != nil { - return err - } - tp.Timeout = &timeout - } - case "step": - if v != nil { - step, err := unmarshalBasicTaskStepProperties(*v) - if err != nil { - return err - } - tp.Step = step - } - case "trigger": - if v != nil { - var trigger TriggerProperties - err = json.Unmarshal(*v, &trigger) - if err != nil { - return err - } - tp.Trigger = &trigger - } - case "credentials": - if v != nil { - var credentials Credentials - err = json.Unmarshal(*v, &credentials) - if err != nil { - return err - } - tp.Credentials = &credentials - } + if !done { + err = azure.NewAsyncOpIncompleteError("containerregistry.ScopeMapsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sm.Response.Response, err = future.GetResult(sender); err == nil && sm.Response.Response.StatusCode != http.StatusNoContent { + sm, err = client.CreateResponder(sm.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsCreateFuture", "Result", sm.Response.Response, "Failure responding to request") } } + return +} - return nil +// ScopeMapsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ScopeMapsDeleteFuture struct { + azure.Future } -// TaskPropertiesUpdateParameters the properties for updating a task. -type TaskPropertiesUpdateParameters struct { - // Status - The current status of task. Possible values include: 'TaskStatusDisabled', 'TaskStatusEnabled' - Status TaskStatus `json:"status,omitempty"` - // Platform - The platform properties against which the run has to happen. - Platform *PlatformUpdateParameters `json:"platform,omitempty"` - // AgentConfiguration - The machine configuration of the run agent. - AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` - // Timeout - Run timeout in seconds. - Timeout *int32 `json:"timeout,omitempty"` - // Step - The properties for updating a task step. - Step BasicTaskStepUpdateParameters `json:"step,omitempty"` - // Trigger - The properties for updating trigger properties. - Trigger *TriggerUpdateParameters `json:"trigger,omitempty"` - // Credentials - The parameters that describes a set of credentials that will be used when this run is invoked. - Credentials *Credentials `json:"credentials,omitempty"` +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ScopeMapsDeleteFuture) Result(client ScopeMapsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("containerregistry.ScopeMapsDeleteFuture") + return + } + ar.Response = future.Response() + return } -// UnmarshalJSON is the custom unmarshaler for TaskPropertiesUpdateParameters struct. -func (tpup *TaskPropertiesUpdateParameters) UnmarshalJSON(body []byte) error { +// ScopeMapsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ScopeMapsUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ScopeMapsUpdateFuture) Result(client ScopeMapsClient) (sm ScopeMap, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("containerregistry.ScopeMapsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sm.Response.Response, err = future.GetResult(sender); err == nil && sm.Response.Response.StatusCode != http.StatusNoContent { + sm, err = client.UpdateResponder(sm.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsUpdateFuture", "Result", sm.Response.Response, "Failure responding to request") + } + } + return +} + +// ScopeMapUpdateParameters the properties for updating the scope map. +type ScopeMapUpdateParameters struct { + // ScopeMapPropertiesUpdateParameters - The update parameters for scope map properties. + *ScopeMapPropertiesUpdateParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ScopeMapUpdateParameters. +func (smup ScopeMapUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if smup.ScopeMapPropertiesUpdateParameters != nil { + objectMap["properties"] = smup.ScopeMapPropertiesUpdateParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ScopeMapUpdateParameters struct. +func (smup *ScopeMapUpdateParameters) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -4098,25 +3974,608 @@ func (tpup *TaskPropertiesUpdateParameters) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { - case "status": - if v != nil { - var status TaskStatus - err = json.Unmarshal(*v, &status) - if err != nil { - return err - } - tpup.Status = status - } - case "platform": + case "properties": if v != nil { - var platform PlatformUpdateParameters - err = json.Unmarshal(*v, &platform) + var scopeMapPropertiesUpdateParameters ScopeMapPropertiesUpdateParameters + err = json.Unmarshal(*v, &scopeMapPropertiesUpdateParameters) if err != nil { return err } - tpup.Platform = &platform + smup.ScopeMapPropertiesUpdateParameters = &scopeMapPropertiesUpdateParameters } - case "agentConfiguration": + } + } + + return nil +} + +// SecretObject describes the properties of a secret object value. +type SecretObject struct { + // Value - 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 `json:"value,omitempty"` + // Type - The type of the secret object which determines how the value of the secret object has to be + // interpreted. Possible values include: 'Opaque', 'Vaultsecret' + Type SecretObjectType `json:"type,omitempty"` +} + +// SetValue the properties of a overridable value that can be passed to a task template. +type SetValue struct { + // Name - The name of the overridable value. + Name *string `json:"name,omitempty"` + // Value - The overridable value. + Value *string `json:"value,omitempty"` + // IsSecret - Flag to indicate whether the value represents a secret or not. + IsSecret *bool `json:"isSecret,omitempty"` +} + +// Sku the SKU of a container registry. +type Sku struct { + // Name - The SKU name of the container registry. Required for registry creation. Possible values include: 'Classic', 'Basic', 'Standard', 'Premium' + Name SkuName `json:"name,omitempty"` + // Tier - READ-ONLY; The SKU tier based on the SKU name. Possible values include: 'SkuTierClassic', 'SkuTierBasic', 'SkuTierStandard', 'SkuTierPremium' + Tier SkuTier `json:"tier,omitempty"` +} + +// Source the registry node that generated the event. Put differently, while the actor initiates the event, +// the source generates it. +type Source struct { + // Addr - 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 `json:"addr,omitempty"` + // InstanceID - The running instance of an application. Changes after each restart. + InstanceID *string `json:"instanceID,omitempty"` +} + +// SourceProperties the properties of the source code repository. +type SourceProperties struct { + // SourceControlType - The type of source control service. Possible values include: 'Github', 'VisualStudioTeamService' + SourceControlType SourceControlType `json:"sourceControlType,omitempty"` + // RepositoryURL - The full URL to the source code repository + RepositoryURL *string `json:"repositoryUrl,omitempty"` + // Branch - The branch name of the source code. + Branch *string `json:"branch,omitempty"` + // SourceControlAuthProperties - The authorization properties for accessing the source code repository and to set up + // webhooks for notifications. + SourceControlAuthProperties *AuthInfo `json:"sourceControlAuthProperties,omitempty"` +} + +// SourceRegistryCredentials describes the credential parameters for accessing the source registry. +type SourceRegistryCredentials struct { + // LoginMode - 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. Possible values include: 'SourceRegistryLoginModeNone', 'SourceRegistryLoginModeDefault' + LoginMode SourceRegistryLoginMode `json:"loginMode,omitempty"` +} + +// SourceTrigger the properties of a source based trigger. +type SourceTrigger struct { + // SourceRepository - The properties that describes the source(code) for the task. + SourceRepository *SourceProperties `json:"sourceRepository,omitempty"` + // SourceTriggerEvents - The source event corresponding to the trigger. + SourceTriggerEvents *[]SourceTriggerEvent `json:"sourceTriggerEvents,omitempty"` + // Status - The current status of trigger. Possible values include: 'TriggerStatusDisabled', 'TriggerStatusEnabled' + Status TriggerStatus `json:"status,omitempty"` + // Name - The name of the trigger. + Name *string `json:"name,omitempty"` +} + +// SourceTriggerDescriptor the source trigger that caused a run. +type SourceTriggerDescriptor struct { + // ID - The unique ID of the trigger. + ID *string `json:"id,omitempty"` + // EventType - The event type of the trigger. + EventType *string `json:"eventType,omitempty"` + // CommitID - The unique ID that identifies a commit. + CommitID *string `json:"commitId,omitempty"` + // PullRequestID - The unique ID that identifies pull request. + PullRequestID *string `json:"pullRequestId,omitempty"` + // RepositoryURL - The repository URL. + RepositoryURL *string `json:"repositoryUrl,omitempty"` + // BranchName - The branch name in the repository. + BranchName *string `json:"branchName,omitempty"` + // ProviderType - The source control provider type. + ProviderType *string `json:"providerType,omitempty"` +} + +// SourceTriggerUpdateParameters the properties for updating a source based trigger. +type SourceTriggerUpdateParameters struct { + // SourceRepository - The properties that describes the source(code) for the task. + SourceRepository *SourceUpdateParameters `json:"sourceRepository,omitempty"` + // SourceTriggerEvents - The source event corresponding to the trigger. + SourceTriggerEvents *[]SourceTriggerEvent `json:"sourceTriggerEvents,omitempty"` + // Status - The current status of trigger. Possible values include: 'TriggerStatusDisabled', 'TriggerStatusEnabled' + Status TriggerStatus `json:"status,omitempty"` + // Name - The name of the trigger. + Name *string `json:"name,omitempty"` +} + +// SourceUpdateParameters the properties for updating the source code repository. +type SourceUpdateParameters struct { + // SourceControlType - The type of source control service. Possible values include: 'Github', 'VisualStudioTeamService' + SourceControlType SourceControlType `json:"sourceControlType,omitempty"` + // RepositoryURL - The full URL to the source code repository + RepositoryURL *string `json:"repositoryUrl,omitempty"` + // Branch - The branch name of the source code. + Branch *string `json:"branch,omitempty"` + // SourceControlAuthProperties - The authorization properties for accessing the source code repository and to set up + // webhooks for notifications. + SourceControlAuthProperties *AuthInfoUpdateParameters `json:"sourceControlAuthProperties,omitempty"` +} + +// SourceUploadDefinition the properties of a response to source upload request. +type SourceUploadDefinition struct { + autorest.Response `json:"-"` + // UploadURL - The URL where the client can upload the source. + UploadURL *string `json:"uploadUrl,omitempty"` + // RelativePath - The relative path to the source. This is used to submit the subsequent queue build request. + RelativePath *string `json:"relativePath,omitempty"` +} + +// Status1 the status of an Azure resource at the time the operation was called. +type Status1 struct { + // DisplayStatus - READ-ONLY; The short label for the status. + DisplayStatus *string `json:"displayStatus,omitempty"` + // Message - READ-ONLY; The detailed message for the status, including alerts and error messages. + Message *string `json:"message,omitempty"` + // Timestamp - READ-ONLY; The timestamp when the status was changed to the current value. + Timestamp *date.Time `json:"timestamp,omitempty"` +} + +// StorageAccountProperties the properties of a storage account for a container registry. Only applicable +// to Classic SKU. +type StorageAccountProperties struct { + // ID - The resource ID of the storage account. + ID *string `json:"id,omitempty"` +} + +// Target the target of the event. +type Target struct { + // MediaType - The MIME type of the referenced object. + MediaType *string `json:"mediaType,omitempty"` + // Size - The number of bytes of the content. Same as Length field. + Size *int64 `json:"size,omitempty"` + // Digest - The digest of the content, as defined by the Registry V2 HTTP API Specification. + Digest *string `json:"digest,omitempty"` + // Length - The number of bytes of the content. Same as Size field. + Length *int64 `json:"length,omitempty"` + // Repository - The repository name. + Repository *string `json:"repository,omitempty"` + // URL - The direct URL to the content. + URL *string `json:"url,omitempty"` + // Tag - The tag name. + Tag *string `json:"tag,omitempty"` + // Name - The name of the artifact. + Name *string `json:"name,omitempty"` + // Version - The version of the artifact. + Version *string `json:"version,omitempty"` +} + +// 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 { + autorest.Response `json:"-"` + // Identity - Identity for the resource. + Identity *IdentityProperties `json:"identity,omitempty"` + // TaskProperties - The properties of a task. + *TaskProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. This cannot be changed after the resource is created. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Task. +func (t Task) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if t.Identity != nil { + objectMap["identity"] = t.Identity + } + if t.TaskProperties != nil { + objectMap["properties"] = t.TaskProperties + } + if t.Location != nil { + objectMap["location"] = t.Location + } + if t.Tags != nil { + objectMap["tags"] = t.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Task struct. +func (t *Task) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "identity": + if v != nil { + var identity IdentityProperties + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + t.Identity = &identity + } + case "properties": + if v != nil { + var taskProperties TaskProperties + err = json.Unmarshal(*v, &taskProperties) + if err != nil { + return err + } + t.TaskProperties = &taskProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + t.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + t.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + t.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + t.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + t.Tags = tags + } + } + } + + return nil +} + +// TaskListResult the collection of tasks. +type TaskListResult struct { + autorest.Response `json:"-"` + // Value - The collection value. + Value *[]Task `json:"value,omitempty"` + // NextLink - The URI that can be used to request the next set of paged results. + NextLink *string `json:"nextLink,omitempty"` +} + +// TaskListResultIterator provides access to a complete listing of Task values. +type TaskListResultIterator struct { + i int + page TaskListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *TaskListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TaskListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *TaskListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter TaskListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter TaskListResultIterator) Response() TaskListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter TaskListResultIterator) Value() Task { + if !iter.page.NotDone() { + return Task{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the TaskListResultIterator type. +func NewTaskListResultIterator(page TaskListResultPage) TaskListResultIterator { + return TaskListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (tlr TaskListResult) IsEmpty() bool { + return tlr.Value == nil || len(*tlr.Value) == 0 +} + +// taskListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (tlr TaskListResult) taskListResultPreparer(ctx context.Context) (*http.Request, error) { + if tlr.NextLink == nil || len(to.String(tlr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(tlr.NextLink))) +} + +// TaskListResultPage contains a page of Task values. +type TaskListResultPage struct { + fn func(context.Context, TaskListResult) (TaskListResult, error) + tlr TaskListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *TaskListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TaskListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.tlr) + if err != nil { + return err + } + page.tlr = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *TaskListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page TaskListResultPage) NotDone() bool { + return !page.tlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page TaskListResultPage) Response() TaskListResult { + return page.tlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page TaskListResultPage) Values() []Task { + if page.tlr.IsEmpty() { + return nil + } + return *page.tlr.Value +} + +// Creates a new instance of the TaskListResultPage type. +func NewTaskListResultPage(getNextPage func(context.Context, TaskListResult) (TaskListResult, error)) TaskListResultPage { + return TaskListResultPage{fn: getNextPage} +} + +// TaskProperties the properties of a task. +type TaskProperties struct { + // ProvisioningState - READ-ONLY; The provisioning state of the task. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // CreationDate - READ-ONLY; The creation date of task. + CreationDate *date.Time `json:"creationDate,omitempty"` + // Status - The current status of task. Possible values include: 'TaskStatusDisabled', 'TaskStatusEnabled' + Status TaskStatus `json:"status,omitempty"` + // Platform - The platform properties against which the run has to happen. + Platform *PlatformProperties `json:"platform,omitempty"` + // AgentConfiguration - The machine configuration of the run agent. + AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` + // Timeout - Run timeout in seconds. + Timeout *int32 `json:"timeout,omitempty"` + // Step - The properties of a task step. + Step BasicTaskStepProperties `json:"step,omitempty"` + // Trigger - The properties that describe all triggers for the task. + Trigger *TriggerProperties `json:"trigger,omitempty"` + // Credentials - The properties that describes a set of credentials that will be used when this run is invoked. + Credentials *Credentials `json:"credentials,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for TaskProperties struct. +func (tp *TaskProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "provisioningState": + if v != nil { + var provisioningState ProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + tp.ProvisioningState = provisioningState + } + case "creationDate": + if v != nil { + var creationDate date.Time + err = json.Unmarshal(*v, &creationDate) + if err != nil { + return err + } + tp.CreationDate = &creationDate + } + case "status": + if v != nil { + var status TaskStatus + err = json.Unmarshal(*v, &status) + if err != nil { + return err + } + tp.Status = status + } + case "platform": + if v != nil { + var platform PlatformProperties + err = json.Unmarshal(*v, &platform) + if err != nil { + return err + } + tp.Platform = &platform + } + case "agentConfiguration": + if v != nil { + var agentConfiguration AgentProperties + err = json.Unmarshal(*v, &agentConfiguration) + if err != nil { + return err + } + tp.AgentConfiguration = &agentConfiguration + } + case "timeout": + if v != nil { + var timeout int32 + err = json.Unmarshal(*v, &timeout) + if err != nil { + return err + } + tp.Timeout = &timeout + } + case "step": + if v != nil { + step, err := unmarshalBasicTaskStepProperties(*v) + if err != nil { + return err + } + tp.Step = step + } + case "trigger": + if v != nil { + var trigger TriggerProperties + err = json.Unmarshal(*v, &trigger) + if err != nil { + return err + } + tp.Trigger = &trigger + } + case "credentials": + if v != nil { + var credentials Credentials + err = json.Unmarshal(*v, &credentials) + if err != nil { + return err + } + tp.Credentials = &credentials + } + } + } + + return nil +} + +// TaskPropertiesUpdateParameters the properties for updating a task. +type TaskPropertiesUpdateParameters struct { + // Status - The current status of task. Possible values include: 'TaskStatusDisabled', 'TaskStatusEnabled' + Status TaskStatus `json:"status,omitempty"` + // Platform - The platform properties against which the run has to happen. + Platform *PlatformUpdateParameters `json:"platform,omitempty"` + // AgentConfiguration - The machine configuration of the run agent. + AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` + // Timeout - Run timeout in seconds. + Timeout *int32 `json:"timeout,omitempty"` + // Step - The properties for updating a task step. + Step BasicTaskStepUpdateParameters `json:"step,omitempty"` + // Trigger - The properties for updating trigger properties. + Trigger *TriggerUpdateParameters `json:"trigger,omitempty"` + // Credentials - The parameters that describes a set of credentials that will be used when this run is invoked. + Credentials *Credentials `json:"credentials,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for TaskPropertiesUpdateParameters struct. +func (tpup *TaskPropertiesUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "status": + if v != nil { + var status TaskStatus + err = json.Unmarshal(*v, &status) + if err != nil { + return err + } + tpup.Status = status + } + case "platform": + if v != nil { + var platform PlatformUpdateParameters + err = json.Unmarshal(*v, &platform) + if err != nil { + return err + } + tpup.Platform = &platform + } + case "agentConfiguration": if v != nil { var agentConfiguration AgentProperties err = json.Unmarshal(*v, &agentConfiguration) @@ -4163,385 +4622,814 @@ func (tpup *TaskPropertiesUpdateParameters) UnmarshalJSON(body []byte) error { } } - return nil + return nil +} + +// TaskRunRequest the parameters for a task run request. +type TaskRunRequest struct { + // TaskID - The resource ID of task against which run has to be queued. + TaskID *string `json:"taskId,omitempty"` + // OverrideTaskStepProperties - Set of overridable parameters that can be passed when running a Task. + OverrideTaskStepProperties *OverrideTaskStepProperties `json:"overrideTaskStepProperties,omitempty"` + // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. + IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` + // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' + Type Type `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TaskRunRequest. +func (trr TaskRunRequest) MarshalJSON() ([]byte, error) { + trr.Type = TypeTaskRunRequest + objectMap := make(map[string]interface{}) + if trr.TaskID != nil { + objectMap["taskId"] = trr.TaskID + } + if trr.OverrideTaskStepProperties != nil { + objectMap["overrideTaskStepProperties"] = trr.OverrideTaskStepProperties + } + if trr.IsArchiveEnabled != nil { + objectMap["isArchiveEnabled"] = trr.IsArchiveEnabled + } + if trr.Type != "" { + objectMap["type"] = trr.Type + } + return json.Marshal(objectMap) +} + +// AsDockerBuildRequest is the BasicRunRequest implementation for TaskRunRequest. +func (trr TaskRunRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { + return nil, false +} + +// AsFileTaskRunRequest is the BasicRunRequest implementation for TaskRunRequest. +func (trr TaskRunRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { + return nil, false +} + +// AsTaskRunRequest is the BasicRunRequest implementation for TaskRunRequest. +func (trr TaskRunRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { + return &trr, true +} + +// AsEncodedTaskRunRequest is the BasicRunRequest implementation for TaskRunRequest. +func (trr TaskRunRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { + return nil, false +} + +// AsRunRequest is the BasicRunRequest implementation for TaskRunRequest. +func (trr TaskRunRequest) AsRunRequest() (*RunRequest, bool) { + return nil, false +} + +// AsBasicRunRequest is the BasicRunRequest implementation for TaskRunRequest. +func (trr TaskRunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { + return &trr, true +} + +// TasksCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type TasksCreateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *TasksCreateFuture) Result(client TasksClient) (t Task, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TasksCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("containerregistry.TasksCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { + t, err = client.CreateResponder(t.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TasksCreateFuture", "Result", t.Response.Response, "Failure responding to request") + } + } + return +} + +// TasksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type TasksDeleteFuture struct { + azure.Future } -// TaskRunRequest the parameters for a task run request. -type TaskRunRequest struct { - // TaskID - The resource ID of task against which run has to be queued. - TaskID *string `json:"taskId,omitempty"` - // OverrideTaskStepProperties - Set of overridable parameters that can be passed when running a Task. - OverrideTaskStepProperties *OverrideTaskStepProperties `json:"overrideTaskStepProperties,omitempty"` - // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. - IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` - // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' - Type Type `json:"type,omitempty"` +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *TasksDeleteFuture) Result(client TasksClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TasksDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("containerregistry.TasksDeleteFuture") + return + } + ar.Response = future.Response() + return } -// MarshalJSON is the custom marshaler for TaskRunRequest. -func (trr TaskRunRequest) MarshalJSON() ([]byte, error) { - trr.Type = TypeTaskRunRequest - objectMap := make(map[string]interface{}) - if trr.TaskID != nil { - objectMap["taskId"] = trr.TaskID +// BasicTaskStepProperties base properties for any task step. +type BasicTaskStepProperties interface { + AsDockerBuildStep() (*DockerBuildStep, bool) + AsFileTaskStep() (*FileTaskStep, bool) + AsEncodedTaskStep() (*EncodedTaskStep, bool) + AsTaskStepProperties() (*TaskStepProperties, bool) +} + +// TaskStepProperties base properties for any task step. +type TaskStepProperties struct { + // BaseImageDependencies - READ-ONLY; List of base image dependencies for a step. + BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` + // ContextPath - The URL(absolute or relative) of the source context for the task step. + ContextPath *string `json:"contextPath,omitempty"` + // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. + ContextAccessToken *string `json:"contextAccessToken,omitempty"` + // Type - Possible values include: 'TypeTaskStepProperties', 'TypeDocker', 'TypeFileTask', 'TypeEncodedTask' + Type TypeBasicTaskStepProperties `json:"type,omitempty"` +} + +func unmarshalBasicTaskStepProperties(body []byte) (BasicTaskStepProperties, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err } - if trr.OverrideTaskStepProperties != nil { - objectMap["overrideTaskStepProperties"] = trr.OverrideTaskStepProperties + + switch m["type"] { + case string(TypeDocker): + var dbs DockerBuildStep + err := json.Unmarshal(body, &dbs) + return dbs, err + case string(TypeFileTask): + var fts FileTaskStep + err := json.Unmarshal(body, &fts) + return fts, err + case string(TypeEncodedTask): + var ets EncodedTaskStep + err := json.Unmarshal(body, &ets) + return ets, err + default: + var tsp TaskStepProperties + err := json.Unmarshal(body, &tsp) + return tsp, err } - if trr.IsArchiveEnabled != nil { - objectMap["isArchiveEnabled"] = trr.IsArchiveEnabled +} +func unmarshalBasicTaskStepPropertiesArray(body []byte) ([]BasicTaskStepProperties, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err } - if trr.Type != "" { - objectMap["type"] = trr.Type + + tspArray := make([]BasicTaskStepProperties, len(rawMessages)) + + for index, rawMessage := range rawMessages { + tsp, err := unmarshalBasicTaskStepProperties(*rawMessage) + if err != nil { + return nil, err + } + tspArray[index] = tsp + } + return tspArray, nil +} + +// MarshalJSON is the custom marshaler for TaskStepProperties. +func (tsp TaskStepProperties) MarshalJSON() ([]byte, error) { + tsp.Type = TypeTaskStepProperties + objectMap := make(map[string]interface{}) + if tsp.ContextPath != nil { + objectMap["contextPath"] = tsp.ContextPath + } + if tsp.ContextAccessToken != nil { + objectMap["contextAccessToken"] = tsp.ContextAccessToken + } + if tsp.Type != "" { + objectMap["type"] = tsp.Type } return json.Marshal(objectMap) } -// AsDockerBuildRequest is the BasicRunRequest implementation for TaskRunRequest. -func (trr TaskRunRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { +// AsDockerBuildStep is the BasicTaskStepProperties implementation for TaskStepProperties. +func (tsp TaskStepProperties) AsDockerBuildStep() (*DockerBuildStep, bool) { return nil, false } -// AsFileTaskRunRequest is the BasicRunRequest implementation for TaskRunRequest. -func (trr TaskRunRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { +// AsFileTaskStep is the BasicTaskStepProperties implementation for TaskStepProperties. +func (tsp TaskStepProperties) AsFileTaskStep() (*FileTaskStep, bool) { return nil, false } -// AsTaskRunRequest is the BasicRunRequest implementation for TaskRunRequest. -func (trr TaskRunRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { - return &trr, true +// AsEncodedTaskStep is the BasicTaskStepProperties implementation for TaskStepProperties. +func (tsp TaskStepProperties) AsEncodedTaskStep() (*EncodedTaskStep, bool) { + return nil, false } -// AsEncodedTaskRunRequest is the BasicRunRequest implementation for TaskRunRequest. -func (trr TaskRunRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { +// AsTaskStepProperties is the BasicTaskStepProperties implementation for TaskStepProperties. +func (tsp TaskStepProperties) AsTaskStepProperties() (*TaskStepProperties, bool) { + return &tsp, true +} + +// AsBasicTaskStepProperties is the BasicTaskStepProperties implementation for TaskStepProperties. +func (tsp TaskStepProperties) AsBasicTaskStepProperties() (BasicTaskStepProperties, bool) { + return &tsp, true +} + +// BasicTaskStepUpdateParameters base properties for updating any task step. +type BasicTaskStepUpdateParameters interface { + AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) + AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) + AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) + AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) +} + +// TaskStepUpdateParameters base properties for updating any task step. +type TaskStepUpdateParameters struct { + // ContextPath - The URL(absolute or relative) of the source context for the task step. + ContextPath *string `json:"contextPath,omitempty"` + // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. + ContextAccessToken *string `json:"contextAccessToken,omitempty"` + // Type - Possible values include: 'TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters', 'TypeBasicTaskStepUpdateParametersTypeDocker', 'TypeBasicTaskStepUpdateParametersTypeFileTask', 'TypeBasicTaskStepUpdateParametersTypeEncodedTask' + Type TypeBasicTaskStepUpdateParameters `json:"type,omitempty"` +} + +func unmarshalBasicTaskStepUpdateParameters(body []byte) (BasicTaskStepUpdateParameters, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeBasicTaskStepUpdateParametersTypeDocker): + var dbsup DockerBuildStepUpdateParameters + err := json.Unmarshal(body, &dbsup) + return dbsup, err + case string(TypeBasicTaskStepUpdateParametersTypeFileTask): + var ftsup FileTaskStepUpdateParameters + err := json.Unmarshal(body, &ftsup) + return ftsup, err + case string(TypeBasicTaskStepUpdateParametersTypeEncodedTask): + var etsup EncodedTaskStepUpdateParameters + err := json.Unmarshal(body, &etsup) + return etsup, err + default: + var tsup TaskStepUpdateParameters + err := json.Unmarshal(body, &tsup) + return tsup, err + } +} +func unmarshalBasicTaskStepUpdateParametersArray(body []byte) ([]BasicTaskStepUpdateParameters, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + tsupArray := make([]BasicTaskStepUpdateParameters, len(rawMessages)) + + for index, rawMessage := range rawMessages { + tsup, err := unmarshalBasicTaskStepUpdateParameters(*rawMessage) + if err != nil { + return nil, err + } + tsupArray[index] = tsup + } + return tsupArray, nil +} + +// MarshalJSON is the custom marshaler for TaskStepUpdateParameters. +func (tsup TaskStepUpdateParameters) MarshalJSON() ([]byte, error) { + tsup.Type = TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters + objectMap := make(map[string]interface{}) + if tsup.ContextPath != nil { + objectMap["contextPath"] = tsup.ContextPath + } + if tsup.ContextAccessToken != nil { + objectMap["contextAccessToken"] = tsup.ContextAccessToken + } + if tsup.Type != "" { + objectMap["type"] = tsup.Type + } + return json.Marshal(objectMap) +} + +// AsDockerBuildStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. +func (tsup TaskStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { return nil, false } -// AsRunRequest is the BasicRunRequest implementation for TaskRunRequest. -func (trr TaskRunRequest) AsRunRequest() (*RunRequest, bool) { +// AsFileTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. +func (tsup TaskStepUpdateParameters) AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) { return nil, false } -// AsBasicRunRequest is the BasicRunRequest implementation for TaskRunRequest. -func (trr TaskRunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { - return &trr, true +// AsEncodedTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. +func (tsup TaskStepUpdateParameters) AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) { + return nil, false } -// TasksCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TasksCreateFuture struct { +// AsTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. +func (tsup TaskStepUpdateParameters) AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) { + return &tsup, true +} + +// AsBasicTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. +func (tsup TaskStepUpdateParameters) AsBasicTaskStepUpdateParameters() (BasicTaskStepUpdateParameters, bool) { + return &tsup, true +} + +// TasksUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type TasksUpdateFuture struct { azure.Future } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future *TasksCreateFuture) Result(client TasksClient) (t Task, err error) { +func (future *TasksUpdateFuture) Result(client TasksClient) (t Task, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksCreateFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "containerregistry.TasksUpdateFuture", "Result", future.Response(), "Polling failure") return } if !done { - err = azure.NewAsyncOpIncompleteError("containerregistry.TasksCreateFuture") + err = azure.NewAsyncOpIncompleteError("containerregistry.TasksUpdateFuture") return } sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { - t, err = client.CreateResponder(t.Response.Response) + t, err = client.UpdateResponder(t.Response.Response) if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksCreateFuture", "Result", t.Response.Response, "Failure responding to request") + err = autorest.NewErrorWithError(err, "containerregistry.TasksUpdateFuture", "Result", t.Response.Response, "Failure responding to request") } } return } -// TasksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TasksDeleteFuture struct { - azure.Future +// TaskUpdateParameters the parameters for updating a task. +type TaskUpdateParameters struct { + // Identity - Identity for the resource. + Identity *IdentityProperties `json:"identity,omitempty"` + // TaskPropertiesUpdateParameters - The properties for updating a task. + *TaskPropertiesUpdateParameters `json:"properties,omitempty"` + // Tags - The ARM resource tags. + Tags map[string]*string `json:"tags"` } -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *TasksDeleteFuture) Result(client TasksClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) +// MarshalJSON is the custom marshaler for TaskUpdateParameters. +func (tup TaskUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tup.Identity != nil { + objectMap["identity"] = tup.Identity + } + if tup.TaskPropertiesUpdateParameters != nil { + objectMap["properties"] = tup.TaskPropertiesUpdateParameters + } + if tup.Tags != nil { + objectMap["tags"] = tup.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for TaskUpdateParameters struct. +func (tup *TaskUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksDeleteFuture", "Result", future.Response(), "Polling failure") - return + return err } - if !done { - err = azure.NewAsyncOpIncompleteError("containerregistry.TasksDeleteFuture") - return + for k, v := range m { + switch k { + case "identity": + if v != nil { + var identity IdentityProperties + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + tup.Identity = &identity + } + case "properties": + if v != nil { + var taskPropertiesUpdateParameters TaskPropertiesUpdateParameters + err = json.Unmarshal(*v, &taskPropertiesUpdateParameters) + if err != nil { + return err + } + tup.TaskPropertiesUpdateParameters = &taskPropertiesUpdateParameters + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + tup.Tags = tags + } + } } - ar.Response = future.Response() - return + + return nil } -// BasicTaskStepProperties base properties for any task step. -type BasicTaskStepProperties interface { - AsDockerBuildStep() (*DockerBuildStep, bool) - AsFileTaskStep() (*FileTaskStep, bool) - AsEncodedTaskStep() (*EncodedTaskStep, bool) - AsTaskStepProperties() (*TaskStepProperties, bool) +// TimerTrigger the properties of a timer trigger. +type TimerTrigger struct { + // Schedule - The CRON expression for the task schedule + Schedule *string `json:"schedule,omitempty"` + // Status - The current status of trigger. Possible values include: 'TriggerStatusDisabled', 'TriggerStatusEnabled' + Status TriggerStatus `json:"status,omitempty"` + // Name - The name of the trigger. + Name *string `json:"name,omitempty"` } -// TaskStepProperties base properties for any task step. -type TaskStepProperties struct { - // BaseImageDependencies - READ-ONLY; List of base image dependencies for a step. - BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeTaskStepProperties', 'TypeDocker', 'TypeFileTask', 'TypeEncodedTask' - Type TypeBasicTaskStepProperties `json:"type,omitempty"` +// TimerTriggerDescriptor ... +type TimerTriggerDescriptor struct { + // TimerTriggerName - The timer trigger name that caused the run. + TimerTriggerName *string `json:"timerTriggerName,omitempty"` + // ScheduleOccurrence - The occurrence that triggered the run. + ScheduleOccurrence *string `json:"scheduleOccurrence,omitempty"` } -func unmarshalBasicTaskStepProperties(body []byte) (BasicTaskStepProperties, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } +// TimerTriggerUpdateParameters the properties for updating a timer trigger. +type TimerTriggerUpdateParameters struct { + // Schedule - The CRON expression for the task schedule + Schedule *string `json:"schedule,omitempty"` + // Status - The current status of trigger. Possible values include: 'TriggerStatusDisabled', 'TriggerStatusEnabled' + Status TriggerStatus `json:"status,omitempty"` + // Name - The name of the trigger. + Name *string `json:"name,omitempty"` +} - switch m["type"] { - case string(TypeDocker): - var dbs DockerBuildStep - err := json.Unmarshal(body, &dbs) - return dbs, err - case string(TypeFileTask): - var fts FileTaskStep - err := json.Unmarshal(body, &fts) - return fts, err - case string(TypeEncodedTask): - var ets EncodedTaskStep - err := json.Unmarshal(body, &ets) - return ets, err - default: - var tsp TaskStepProperties - err := json.Unmarshal(body, &tsp) - return tsp, err +// Token an object that represents a token for a container registry. +type Token struct { + autorest.Response `json:"-"` + // TokenProperties - The properties of the token. + *TokenProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Token. +func (t Token) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if t.TokenProperties != nil { + objectMap["properties"] = t.TokenProperties } + return json.Marshal(objectMap) } -func unmarshalBasicTaskStepPropertiesArray(body []byte) ([]BasicTaskStepProperties, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) + +// UnmarshalJSON is the custom unmarshaler for Token struct. +func (t *Token) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) if err != nil { - return nil, err + return err } - - tspArray := make([]BasicTaskStepProperties, len(rawMessages)) - - for index, rawMessage := range rawMessages { - tsp, err := unmarshalBasicTaskStepProperties(*rawMessage) - if err != nil { - return nil, err + for k, v := range m { + switch k { + case "properties": + if v != nil { + var tokenProperties TokenProperties + err = json.Unmarshal(*v, &tokenProperties) + if err != nil { + return err + } + t.TokenProperties = &tokenProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + t.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + t.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + t.Type = &typeVar + } } - tspArray[index] = tsp } - return tspArray, nil + + return nil } -// MarshalJSON is the custom marshaler for TaskStepProperties. -func (tsp TaskStepProperties) MarshalJSON() ([]byte, error) { - tsp.Type = TypeTaskStepProperties - objectMap := make(map[string]interface{}) - if tsp.ContextPath != nil { - objectMap["contextPath"] = tsp.ContextPath +// TokenCertificate the properties of a certificate used for authenticating a token. +type TokenCertificate struct { + // Name - Possible values include: 'Certificate1', 'Certificate2' + Name TokenCertificateName `json:"name,omitempty"` + // Expiry - The expiry datetime of the certificate. + Expiry *date.Time `json:"expiry,omitempty"` + // Thumbprint - The thumbprint of the certificate. + Thumbprint *string `json:"thumbprint,omitempty"` + // EncodedPemCertificate - Base 64 encoded string of the public certificate1 in PEM format that will be used for authenticating the token. + EncodedPemCertificate *string `json:"encodedPemCertificate,omitempty"` +} + +// TokenCredentialsProperties the properties of the credentials that can be used for authenticating the +// token. +type TokenCredentialsProperties struct { + Certificates *[]TokenCertificate `json:"certificates,omitempty"` + Passwords *[]TokenPassword `json:"passwords,omitempty"` +} + +// TokenListResult the result of a request to list tokens for a container registry. +type TokenListResult struct { + autorest.Response `json:"-"` + // Value - The list of tokens. Since this list may be incomplete, the nextLink field should be used to request the next list of tokens. + Value *[]Token `json:"value,omitempty"` + // NextLink - The URI that can be used to request the next list of tokens. + NextLink *string `json:"nextLink,omitempty"` +} + +// TokenListResultIterator provides access to a complete listing of Token values. +type TokenListResultIterator struct { + i int + page TokenListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *TokenListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TokenListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() } - if tsp.ContextAccessToken != nil { - objectMap["contextAccessToken"] = tsp.ContextAccessToken + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil } - if tsp.Type != "" { - objectMap["type"] = tsp.Type + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err } - return json.Marshal(objectMap) + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *TokenListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) } -// AsDockerBuildStep is the BasicTaskStepProperties implementation for TaskStepProperties. -func (tsp TaskStepProperties) AsDockerBuildStep() (*DockerBuildStep, bool) { - return nil, false +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter TokenListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) } -// AsFileTaskStep is the BasicTaskStepProperties implementation for TaskStepProperties. -func (tsp TaskStepProperties) AsFileTaskStep() (*FileTaskStep, bool) { - return nil, false +// Response returns the raw server response from the last page request. +func (iter TokenListResultIterator) Response() TokenListResult { + return iter.page.Response() } -// AsEncodedTaskStep is the BasicTaskStepProperties implementation for TaskStepProperties. -func (tsp TaskStepProperties) AsEncodedTaskStep() (*EncodedTaskStep, bool) { - return nil, false +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter TokenListResultIterator) Value() Token { + if !iter.page.NotDone() { + return Token{} + } + return iter.page.Values()[iter.i] } -// AsTaskStepProperties is the BasicTaskStepProperties implementation for TaskStepProperties. -func (tsp TaskStepProperties) AsTaskStepProperties() (*TaskStepProperties, bool) { - return &tsp, true +// Creates a new instance of the TokenListResultIterator type. +func NewTokenListResultIterator(page TokenListResultPage) TokenListResultIterator { + return TokenListResultIterator{page: page} } -// AsBasicTaskStepProperties is the BasicTaskStepProperties implementation for TaskStepProperties. -func (tsp TaskStepProperties) AsBasicTaskStepProperties() (BasicTaskStepProperties, bool) { - return &tsp, true +// IsEmpty returns true if the ListResult contains no values. +func (tlr TokenListResult) IsEmpty() bool { + return tlr.Value == nil || len(*tlr.Value) == 0 } -// BasicTaskStepUpdateParameters base properties for updating any task step. -type BasicTaskStepUpdateParameters interface { - AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) - AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) - AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) - AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) +// tokenListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (tlr TokenListResult) tokenListResultPreparer(ctx context.Context) (*http.Request, error) { + if tlr.NextLink == nil || len(to.String(tlr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(tlr.NextLink))) } -// TaskStepUpdateParameters base properties for updating any task step. -type TaskStepUpdateParameters struct { - // ContextPath - The URL(absolute or relative) of the source context for the task step. - ContextPath *string `json:"contextPath,omitempty"` - // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. - ContextAccessToken *string `json:"contextAccessToken,omitempty"` - // Type - Possible values include: 'TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters', 'TypeBasicTaskStepUpdateParametersTypeDocker', 'TypeBasicTaskStepUpdateParametersTypeFileTask', 'TypeBasicTaskStepUpdateParametersTypeEncodedTask' - Type TypeBasicTaskStepUpdateParameters `json:"type,omitempty"` +// TokenListResultPage contains a page of Token values. +type TokenListResultPage struct { + fn func(context.Context, TokenListResult) (TokenListResult, error) + tlr TokenListResult } -func unmarshalBasicTaskStepUpdateParameters(body []byte) (BasicTaskStepUpdateParameters, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *TokenListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TokenListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.tlr) if err != nil { - return nil, err + return err } + page.tlr = next + return nil +} - switch m["type"] { - case string(TypeBasicTaskStepUpdateParametersTypeDocker): - var dbsup DockerBuildStepUpdateParameters - err := json.Unmarshal(body, &dbsup) - return dbsup, err - case string(TypeBasicTaskStepUpdateParametersTypeFileTask): - var ftsup FileTaskStepUpdateParameters - err := json.Unmarshal(body, &ftsup) - return ftsup, err - case string(TypeBasicTaskStepUpdateParametersTypeEncodedTask): - var etsup EncodedTaskStepUpdateParameters - err := json.Unmarshal(body, &etsup) - return etsup, err - default: - var tsup TaskStepUpdateParameters - err := json.Unmarshal(body, &tsup) - return tsup, err - } +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *TokenListResultPage) Next() error { + return page.NextWithContext(context.Background()) } -func unmarshalBasicTaskStepUpdateParametersArray(body []byte) ([]BasicTaskStepUpdateParameters, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - tsupArray := make([]BasicTaskStepUpdateParameters, len(rawMessages)) +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page TokenListResultPage) NotDone() bool { + return !page.tlr.IsEmpty() +} - for index, rawMessage := range rawMessages { - tsup, err := unmarshalBasicTaskStepUpdateParameters(*rawMessage) - if err != nil { - return nil, err - } - tsupArray[index] = tsup - } - return tsupArray, nil +// Response returns the raw server response from the last page request. +func (page TokenListResultPage) Response() TokenListResult { + return page.tlr } -// MarshalJSON is the custom marshaler for TaskStepUpdateParameters. -func (tsup TaskStepUpdateParameters) MarshalJSON() ([]byte, error) { - tsup.Type = TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters - objectMap := make(map[string]interface{}) - if tsup.ContextPath != nil { - objectMap["contextPath"] = tsup.ContextPath - } - if tsup.ContextAccessToken != nil { - objectMap["contextAccessToken"] = tsup.ContextAccessToken - } - if tsup.Type != "" { - objectMap["type"] = tsup.Type +// Values returns the slice of values for the current page or nil if there are no values. +func (page TokenListResultPage) Values() []Token { + if page.tlr.IsEmpty() { + return nil } - return json.Marshal(objectMap) + return *page.tlr.Value } -// AsDockerBuildStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. -func (tsup TaskStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { - return nil, false +// Creates a new instance of the TokenListResultPage type. +func NewTokenListResultPage(getNextPage func(context.Context, TokenListResult) (TokenListResult, error)) TokenListResultPage { + return TokenListResultPage{fn: getNextPage} } -// AsFileTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. -func (tsup TaskStepUpdateParameters) AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) { - return nil, false +// TokenPassword the password that will be used for authenticating the token of a container registry. +type TokenPassword struct { + // CreationTime - The password created datetime of the password. + CreationTime *date.Time `json:"creationTime,omitempty"` + // Expiry - The expiry datetime of the password. + Expiry *date.Time `json:"expiry,omitempty"` + // Name - The password name "password" or "password2". Possible values include: 'TokenPasswordNamePassword1', 'TokenPasswordNamePassword2' + Name TokenPasswordName `json:"name,omitempty"` + // Value - READ-ONLY; The password value. + Value *string `json:"value,omitempty"` } -// AsEncodedTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. -func (tsup TaskStepUpdateParameters) AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) { - return nil, false +// TokenProperties the properties of a token. +type TokenProperties struct { + // CreationDate - READ-ONLY; The creation date of scope map. + CreationDate *date.Time `json:"creationDate,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the resource. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ScopeMapID - The resource ID of the scope map to which the token will be associated with. + ScopeMapID *string `json:"scopeMapId,omitempty"` + // ObjectID - The user/group/application object ID for which the token has to be created. + ObjectID *string `json:"objectId,omitempty"` + // Credentials - The credentials that can be used for authenticating the token. + Credentials *TokenCredentialsProperties `json:"credentials,omitempty"` + // Status - The status of the token example enabled or disabled. Possible values include: 'StatusEnabled', 'StatusDisabled' + Status Status `json:"status,omitempty"` +} + +// TokensCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type TokensCreateFuture struct { + azure.Future } -// AsTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. -func (tsup TaskStepUpdateParameters) AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) { - return &tsup, true +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *TokensCreateFuture) Result(client TokensClient) (t Token, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TokensCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("containerregistry.TokensCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { + t, err = client.CreateResponder(t.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TokensCreateFuture", "Result", t.Response.Response, "Failure responding to request") + } + } + return } -// AsBasicTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. -func (tsup TaskStepUpdateParameters) AsBasicTaskStepUpdateParameters() (BasicTaskStepUpdateParameters, bool) { - return &tsup, true +// TokensDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type TokensDeleteFuture struct { + azure.Future } -// TasksUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TasksUpdateFuture struct { +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *TokensDeleteFuture) Result(client TokensClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TokensDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("containerregistry.TokensDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// TokensUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type TokensUpdateFuture struct { azure.Future } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future *TasksUpdateFuture) Result(client TasksClient) (t Task, err error) { +func (future *TokensUpdateFuture) Result(client TokensClient) (t Token, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksUpdateFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "containerregistry.TokensUpdateFuture", "Result", future.Response(), "Polling failure") return } if !done { - err = azure.NewAsyncOpIncompleteError("containerregistry.TasksUpdateFuture") + err = azure.NewAsyncOpIncompleteError("containerregistry.TokensUpdateFuture") return } sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { t, err = client.UpdateResponder(t.Response.Response) if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksUpdateFuture", "Result", t.Response.Response, "Failure responding to request") + err = autorest.NewErrorWithError(err, "containerregistry.TokensUpdateFuture", "Result", t.Response.Response, "Failure responding to request") } } return } -// TaskUpdateParameters the parameters for updating a task. -type TaskUpdateParameters struct { - // Identity - Identity for the resource. - Identity *IdentityProperties `json:"identity,omitempty"` - // TaskPropertiesUpdateParameters - The properties for updating a task. - *TaskPropertiesUpdateParameters `json:"properties,omitempty"` - // Tags - The ARM resource tags. - Tags map[string]*string `json:"tags"` +// TokenUpdateParameters the parameters for updating a token. +type TokenUpdateParameters struct { + // TokenUpdateProperties - The properties of the token update parameters. + *TokenUpdateProperties `json:"properties,omitempty"` } -// MarshalJSON is the custom marshaler for TaskUpdateParameters. -func (tup TaskUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for TokenUpdateParameters. +func (tup TokenUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if tup.Identity != nil { - objectMap["identity"] = tup.Identity - } - if tup.TaskPropertiesUpdateParameters != nil { - objectMap["properties"] = tup.TaskPropertiesUpdateParameters - } - if tup.Tags != nil { - objectMap["tags"] = tup.Tags + if tup.TokenUpdateProperties != nil { + objectMap["properties"] = tup.TokenUpdateProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for TaskUpdateParameters struct. -func (tup *TaskUpdateParameters) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for TokenUpdateParameters struct. +func (tup *TokenUpdateParameters) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -4549,32 +5437,14 @@ func (tup *TaskUpdateParameters) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { - case "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - tup.Identity = &identity - } case "properties": if v != nil { - var taskPropertiesUpdateParameters TaskPropertiesUpdateParameters - err = json.Unmarshal(*v, &taskPropertiesUpdateParameters) - if err != nil { - return err - } - tup.TaskPropertiesUpdateParameters = &taskPropertiesUpdateParameters - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) + var tokenUpdateProperties TokenUpdateProperties + err = json.Unmarshal(*v, &tokenUpdateProperties) if err != nil { return err } - tup.Tags = tags + tup.TokenUpdateProperties = &tokenUpdateProperties } } } @@ -4582,32 +5452,14 @@ func (tup *TaskUpdateParameters) UnmarshalJSON(body []byte) error { return nil } -// TimerTrigger the properties of a timer trigger. -type TimerTrigger struct { - // Schedule - The CRON expression for the task schedule - Schedule *string `json:"schedule,omitempty"` - // Status - The current status of trigger. Possible values include: 'TriggerStatusDisabled', 'TriggerStatusEnabled' - Status TriggerStatus `json:"status,omitempty"` - // Name - The name of the trigger. - Name *string `json:"name,omitempty"` -} - -// TimerTriggerDescriptor ... -type TimerTriggerDescriptor struct { - // TimerTriggerName - The timer trigger name that caused the run. - TimerTriggerName *string `json:"timerTriggerName,omitempty"` - // ScheduleOccurrence - The occurrence that triggered the run. - ScheduleOccurrence *string `json:"scheduleOccurrence,omitempty"` -} - -// TimerTriggerUpdateParameters the properties for updating a timer trigger. -type TimerTriggerUpdateParameters struct { - // Schedule - The CRON expression for the task schedule - Schedule *string `json:"schedule,omitempty"` - // Status - The current status of trigger. Possible values include: 'TriggerStatusDisabled', 'TriggerStatusEnabled' - Status TriggerStatus `json:"status,omitempty"` - // Name - The name of the trigger. - Name *string `json:"name,omitempty"` +// TokenUpdateProperties the parameters for updating token properties. +type TokenUpdateProperties struct { + // ScopeMapID - The resource ID of the scope map to which the token will be associated with. + ScopeMapID *string `json:"scopeMapId,omitempty"` + // Status - The status of the token example enabled or disabled. Possible values include: 'StatusEnabled', 'StatusDisabled' + Status Status `json:"status,omitempty"` + // Credentials - The credentials that can be used for authenticating the token. + Credentials *TokenCredentialsProperties `json:"credentials,omitempty"` } // TriggerProperties the properties of a trigger. diff --git a/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/registries.go b/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/registries.go index 355fe2dcddb9..16cf6c62c4fa 100644 --- a/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/registries.go +++ b/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/registries.go @@ -311,6 +311,96 @@ func (client RegistriesClient) DeleteResponder(resp *http.Response) (result auto return } +// GenerateCredentials generate keys for a token of a specified container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// generateCredentialsParameters - the parameters for generating credentials. +func (client RegistriesClient) GenerateCredentials(ctx context.Context, resourceGroupName string, registryName string, generateCredentialsParameters GenerateCredentialsParameters) (result RegistriesGenerateCredentialsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.GenerateCredentials") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.RegistriesClient", "GenerateCredentials", err.Error()) + } + + req, err := client.GenerateCredentialsPreparer(ctx, resourceGroupName, registryName, generateCredentialsParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GenerateCredentials", nil, "Failure preparing request") + return + } + + result, err = client.GenerateCredentialsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GenerateCredentials", result.Response(), "Failure sending request") + return + } + + return +} + +// GenerateCredentialsPreparer prepares the GenerateCredentials request. +func (client RegistriesClient) GenerateCredentialsPreparer(ctx context.Context, resourceGroupName string, registryName string, generateCredentialsParameters GenerateCredentialsParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/generateCredentials", pathParameters), + autorest.WithJSON(generateCredentialsParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GenerateCredentialsSender sends the GenerateCredentials request. The method will close the +// http.Response Body if it receives an error. +func (client RegistriesClient) GenerateCredentialsSender(req *http.Request) (future RegistriesGenerateCredentialsFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// GenerateCredentialsResponder handles the response to the GenerateCredentials request. The method always +// closes the http.Response Body. +func (client RegistriesClient) GenerateCredentialsResponder(resp *http.Response) (result GenerateCredentialsResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // Get gets the properties of the specified container registry. // Parameters: // resourceGroupName - the name of the resource group to which the container registry belongs. diff --git a/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/scopemaps.go b/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/scopemaps.go new file mode 100644 index 000000000000..90bd1a9ff108 --- /dev/null +++ b/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/scopemaps.go @@ -0,0 +1,547 @@ +package containerregistry + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ScopeMapsClient is the client for the ScopeMaps methods of the Containerregistry service. +type ScopeMapsClient struct { + BaseClient +} + +// NewScopeMapsClient creates an instance of the ScopeMapsClient client. +func NewScopeMapsClient(subscriptionID string) ScopeMapsClient { + return NewScopeMapsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewScopeMapsClientWithBaseURI creates an instance of the ScopeMapsClient client. +func NewScopeMapsClientWithBaseURI(baseURI string, subscriptionID string) ScopeMapsClient { + return ScopeMapsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a scope map for a container registry with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// scopeMapName - the name of the scope map. +// scopeMapCreateParameters - the parameters for creating a scope map. +func (client ScopeMapsClient) Create(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapCreateParameters ScopeMap) (result ScopeMapsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapsClient.Create") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: scopeMapName, + Constraints: []validation.Constraint{{Target: "scopeMapName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "scopeMapName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "scopeMapName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}, + {TargetValue: scopeMapCreateParameters, + Constraints: []validation.Constraint{{Target: "scopeMapCreateParameters.ScopeMapProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "scopeMapCreateParameters.ScopeMapProperties.Actions", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("containerregistry.ScopeMapsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, scopeMapName, scopeMapCreateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ScopeMapsClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapCreateParameters ScopeMap) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "scopeMapName": autorest.Encode("path", scopeMapName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}", pathParameters), + autorest.WithJSON(scopeMapCreateParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ScopeMapsClient) CreateSender(req *http.Request) (future ScopeMapsCreateFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ScopeMapsClient) CreateResponder(resp *http.Response) (result ScopeMap, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a scope map from a container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// scopeMapName - the name of the scope map. +func (client ScopeMapsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string) (result ScopeMapsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: scopeMapName, + Constraints: []validation.Constraint{{Target: "scopeMapName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "scopeMapName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "scopeMapName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.ScopeMapsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, scopeMapName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ScopeMapsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "scopeMapName": autorest.Encode("path", scopeMapName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ScopeMapsClient) DeleteSender(req *http.Request) (future ScopeMapsDeleteFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ScopeMapsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the properties of the specified scope map. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// scopeMapName - the name of the scope map. +func (client ScopeMapsClient) Get(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string) (result ScopeMap, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: scopeMapName, + Constraints: []validation.Constraint{{Target: "scopeMapName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "scopeMapName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "scopeMapName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.ScopeMapsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, registryName, scopeMapName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ScopeMapsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "scopeMapName": autorest.Encode("path", scopeMapName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ScopeMapsClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ScopeMapsClient) GetResponder(resp *http.Response) (result ScopeMap, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all the scope maps for the specified container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +func (client ScopeMapsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result ScopeMapListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapsClient.List") + defer func() { + sc := -1 + if result.smlr.Response.Response != nil { + sc = result.smlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.ScopeMapsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, registryName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.smlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "List", resp, "Failure sending request") + return + } + + result.smlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ScopeMapsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ScopeMapsClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ScopeMapsClient) ListResponder(resp *http.Response) (result ScopeMapListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ScopeMapsClient) listNextResults(ctx context.Context, lastResults ScopeMapListResult) (result ScopeMapListResult, err error) { + req, err := lastResults.scopeMapListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ScopeMapsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result ScopeMapListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, registryName) + return +} + +// Update updates a scope map with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// scopeMapName - the name of the scope map. +// scopeMapUpdateParameters - the parameters for updating a scope map. +func (client ScopeMapsClient) Update(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapUpdateParameters ScopeMapUpdateParameters) (result ScopeMapsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapsClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: scopeMapName, + Constraints: []validation.Constraint{{Target: "scopeMapName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "scopeMapName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "scopeMapName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.ScopeMapsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, scopeMapName, scopeMapUpdateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ScopeMapsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapUpdateParameters ScopeMapUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "scopeMapName": autorest.Encode("path", scopeMapName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}", pathParameters), + autorest.WithJSON(scopeMapUpdateParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ScopeMapsClient) UpdateSender(req *http.Request) (future ScopeMapsUpdateFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ScopeMapsClient) UpdateResponder(resp *http.Response) (result ScopeMap, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/tokens.go b/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/tokens.go new file mode 100644 index 000000000000..8a3dafead703 --- /dev/null +++ b/services/containerregistry/mgmt/2019-06-01-preview/containerregistry/tokens.go @@ -0,0 +1,544 @@ +package containerregistry + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// TokensClient is the client for the Tokens methods of the Containerregistry service. +type TokensClient struct { + BaseClient +} + +// NewTokensClient creates an instance of the TokensClient client. +func NewTokensClient(subscriptionID string) TokensClient { + return NewTokensClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTokensClientWithBaseURI creates an instance of the TokensClient client. +func NewTokensClientWithBaseURI(baseURI string, subscriptionID string) TokensClient { + return TokensClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a token for a container registry with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// tokenName - the name of the token. +// tokenCreateParameters - the parameters for creating a token. +func (client TokensClient) Create(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenCreateParameters Token) (result TokensCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TokensClient.Create") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: tokenName, + Constraints: []validation.Constraint{{Target: "tokenName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "tokenName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "tokenName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.TokensClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, tokenName, tokenCreateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client TokensClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenCreateParameters Token) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "tokenName": autorest.Encode("path", tokenName), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}", pathParameters), + autorest.WithJSON(tokenCreateParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client TokensClient) CreateSender(req *http.Request) (future TokensCreateFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client TokensClient) CreateResponder(resp *http.Response) (result Token, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a token from a container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// tokenName - the name of the token. +func (client TokensClient) Delete(ctx context.Context, resourceGroupName string, registryName string, tokenName string) (result TokensDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TokensClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: tokenName, + Constraints: []validation.Constraint{{Target: "tokenName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "tokenName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "tokenName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.TokensClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, tokenName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client TokensClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, tokenName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "tokenName": autorest.Encode("path", tokenName), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client TokensClient) DeleteSender(req *http.Request) (future TokensDeleteFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client TokensClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the properties of the specified token. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// tokenName - the name of the token. +func (client TokensClient) Get(ctx context.Context, resourceGroupName string, registryName string, tokenName string) (result Token, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TokensClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: tokenName, + Constraints: []validation.Constraint{{Target: "tokenName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "tokenName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "tokenName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.TokensClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, registryName, tokenName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client TokensClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, tokenName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "tokenName": autorest.Encode("path", tokenName), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client TokensClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client TokensClient) GetResponder(resp *http.Response) (result Token, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all the tokens for the specified container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +func (client TokensClient) List(ctx context.Context, resourceGroupName string, registryName string) (result TokenListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TokensClient.List") + defer func() { + sc := -1 + if result.tlr.Response.Response != nil { + sc = result.tlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.TokensClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, registryName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.tlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "List", resp, "Failure sending request") + return + } + + result.tlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client TokensClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client TokensClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client TokensClient) ListResponder(resp *http.Response) (result TokenListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client TokensClient) listNextResults(ctx context.Context, lastResults TokenListResult) (result TokenListResult, err error) { + req, err := lastResults.tokenListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerregistry.TokensClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerregistry.TokensClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client TokensClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result TokenListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TokensClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, registryName) + return +} + +// Update updates a token with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// tokenName - the name of the token. +// tokenUpdateParameters - the parameters for updating a token. +func (client TokensClient) Update(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenUpdateParameters TokenUpdateParameters) (result TokensUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TokensClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: tokenName, + Constraints: []validation.Constraint{{Target: "tokenName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "tokenName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "tokenName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.TokensClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, tokenName, tokenUpdateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client TokensClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenUpdateParameters TokenUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "tokenName": autorest.Encode("path", tokenName), + } + + const APIVersion = "2019-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tokens/{tokenName}", pathParameters), + autorest.WithJSON(tokenUpdateParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client TokensClient) UpdateSender(req *http.Request) (future TokensUpdateFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client TokensClient) UpdateResponder(resp *http.Response) (result Token, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +}