diff --git a/internal/services/containers/client/client.go b/internal/services/containers/client/client.go index f9d963845a92..d378bdf0bb1c 100644 --- a/internal/services/containers/client/client.go +++ b/internal/services/containers/client/client.go @@ -2,7 +2,6 @@ package client import ( legacy "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice" - legacyacr "github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2019-06-01-preview/containerregistry" "github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2021-08-01-preview/containerregistry" "github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice" "github.com/Azure/go-autorest/autorest/azure" @@ -22,7 +21,8 @@ type Client struct { WebhooksClient *containerregistry.WebhooksClient TokensClient *containerregistry.TokensClient ScopeMapsClient *containerregistry.ScopeMapsClient - TasksClient *legacyacr.TasksClient + TasksClient *containerregistry.TasksClient + RunsClient *containerregistry.RunsClient ConnectedRegistriesClient *containerregistry.ConnectedRegistriesClient Environment azure.Environment @@ -47,9 +47,12 @@ func NewClient(o *common.ClientOptions) *Client { scopeMapsClient := containerregistry.NewScopeMapsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&scopeMapsClient.Client, o.ResourceManagerAuthorizer) - tasksClient := legacyacr.NewTasksClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + tasksClient := containerregistry.NewTasksClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&tasksClient.Client, o.ResourceManagerAuthorizer) + runsClient := containerregistry.NewRunsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&runsClient.Client, o.ResourceManagerAuthorizer) + containerInstanceClient := containerinstance.NewContainerInstanceClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&containerInstanceClient.Client, o.ResourceManagerAuthorizer) @@ -83,6 +86,7 @@ func NewClient(o *common.ClientOptions) *Client { TokensClient: &tokensClient, ScopeMapsClient: &scopeMapsClient, TasksClient: &tasksClient, + RunsClient: &runsClient, ConnectedRegistriesClient: &connectedRegistriesClient, } } diff --git a/internal/services/containers/container_registry_task_resource.go b/internal/services/containers/container_registry_task_resource.go index f3038b6d6a9c..2f6bf304d735 100644 --- a/internal/services/containers/container_registry_task_resource.go +++ b/internal/services/containers/container_registry_task_resource.go @@ -5,7 +5,7 @@ import ( "fmt" "time" - legacyacr "github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2019-06-01-preview/containerregistry" + "github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2021-08-01-preview/containerregistry" "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" @@ -171,28 +171,28 @@ func (r ContainerRegistryTaskResource) Arguments() map[string]*pluginsdk.Schema Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(legacyacr.Windows), - string(legacyacr.Linux), + string(containerregistry.OSWindows), + string(containerregistry.OSLinux), }, false), }, "architecture": { Type: pluginsdk.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{ - string(legacyacr.Amd64), - string(legacyacr.Arm), - string(legacyacr.Arm64), - string(legacyacr.ThreeEightSix), - string(legacyacr.X86), + string(containerregistry.ArchitectureAmd64), + string(containerregistry.ArchitectureArm), + string(containerregistry.ArchitectureArm64), + string(containerregistry.ArchitectureThreeEightSix), + string(containerregistry.ArchitectureX86), }, false), }, "variant": { Type: pluginsdk.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{ - string(legacyacr.V6), - string(legacyacr.V7), - string(legacyacr.V8), + string(containerregistry.VariantV6), + string(containerregistry.VariantV7), + string(containerregistry.VariantV8), }, false), }, }, @@ -370,8 +370,8 @@ func (r ContainerRegistryTaskResource) Arguments() map[string]*pluginsdk.Schema Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(legacyacr.All), - string(legacyacr.Runtime), + string(containerregistry.BaseImageTriggerTypeAll), + string(containerregistry.BaseImageTriggerTypeRuntime), }, false), }, "enabled": { @@ -389,8 +389,8 @@ func (r ContainerRegistryTaskResource) Arguments() map[string]*pluginsdk.Schema Type: pluginsdk.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{ - string(legacyacr.UpdateTriggerPayloadTypeDefault), - string(legacyacr.UpdateTriggerPayloadTypeToken), + string(containerregistry.UpdateTriggerPayloadTypeDefault), + string(containerregistry.UpdateTriggerPayloadTypeToken), }, false), }, }, @@ -412,8 +412,8 @@ func (r ContainerRegistryTaskResource) Arguments() map[string]*pluginsdk.Schema Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringInSlice([]string{ - string(legacyacr.Commit), - string(legacyacr.Pullrequest), + string(containerregistry.SourceTriggerEventCommit), + string(containerregistry.SourceTriggerEventPullrequest), }, false), }, }, @@ -421,8 +421,8 @@ func (r ContainerRegistryTaskResource) Arguments() map[string]*pluginsdk.Schema Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(legacyacr.Github), - string(legacyacr.VisualStudioTeamService), + string(containerregistry.SourceControlTypeGithub), + string(containerregistry.SourceControlTypeVisualStudioTeamService), }, false), }, "repository_url": { @@ -444,8 +444,8 @@ func (r ContainerRegistryTaskResource) Arguments() map[string]*pluginsdk.Schema Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(legacyacr.PAT), - string(legacyacr.OAuth), + string(containerregistry.TokenTypePAT), + string(containerregistry.TokenTypeOAuth), }, false), }, "token": { @@ -521,8 +521,8 @@ func (r ContainerRegistryTaskResource) Arguments() map[string]*pluginsdk.Schema Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(legacyacr.SourceRegistryLoginModeNone), - string(legacyacr.SourceRegistryLoginModeDefault), + string(containerregistry.SourceRegistryLoginModeNone), + string(containerregistry.SourceRegistryLoginModeDefault), }, false), }, }, @@ -687,9 +687,9 @@ func (r ContainerRegistryTaskResource) Create() sdk.ResourceFunc { return metadata.ResourceRequiresImport(r.ResourceType(), id) } - status := legacyacr.TaskStatusDisabled + status := containerregistry.TaskStatusDisabled if model.Enabled { - status = legacyacr.TaskStatusEnabled + status = containerregistry.TaskStatusEnabled } expandedIdentity, err := expandRegistryTaskIdentity(metadata.ResourceData.Get("identity").([]interface{})) @@ -697,8 +697,8 @@ func (r ContainerRegistryTaskResource) Create() sdk.ResourceFunc { return fmt.Errorf("expanding `identity`: %+v", err) } - params := legacyacr.Task{ - TaskProperties: &legacyacr.TaskProperties{ + params := containerregistry.Task{ + TaskProperties: &containerregistry.TaskProperties{ Platform: expandRegistryTaskPlatform(model.Platform), Step: expandRegistryTaskStep(model), Trigger: expandRegistryTaskTrigger(model), @@ -789,7 +789,7 @@ func (r ContainerRegistryTaskResource) Read() sdk.ResourceFunc { logTemplate = *props.LogTemplate } platform = flattenRegistryTaskPlatform(props.Platform) - enabled = props.Status == legacyacr.TaskStatusEnabled + enabled = props.Status == containerregistry.TaskStatusEnabled if props.Timeout != nil { timeoutInSec = int(*props.Timeout) } @@ -926,9 +926,9 @@ func (r ContainerRegistryTaskResource) Update() sdk.ResourceFunc { existing.TaskProperties.AgentPoolName = &model.AgentPoolName } if metadata.ResourceData.HasChange("enabled") { - status := legacyacr.TaskStatusDisabled + status := containerregistry.TaskStatusDisabled if model.Enabled { - status = legacyacr.TaskStatusEnabled + status = containerregistry.TaskStatusEnabled } existing.TaskProperties.Status = status } @@ -957,52 +957,52 @@ func (r ContainerRegistryTaskResource) Update() sdk.ResourceFunc { } } -func expandRegistryTaskTrigger(model ContainerRegistryTaskModel) *legacyacr.TriggerProperties { +func expandRegistryTaskTrigger(model ContainerRegistryTaskModel) *containerregistry.TriggerProperties { baseImageTrigger := expandRegistryTaskBaseImageTrigger(model.BaseImageTrigger) sourceTriggers := expandRegistryTaskSourceTriggers(model.SourceTrigger) timerTriggers := expandRegistryTaskTimerTriggers(model.TimerTrigger) if baseImageTrigger == nil && sourceTriggers == nil && timerTriggers == nil { return nil } - return &legacyacr.TriggerProperties{ + return &containerregistry.TriggerProperties{ BaseImageTrigger: baseImageTrigger, SourceTriggers: sourceTriggers, TimerTriggers: timerTriggers, } } -func expandRegistryTaskBaseImageTrigger(triggers []BaseImageTrigger) *legacyacr.BaseImageTrigger { +func expandRegistryTaskBaseImageTrigger(triggers []BaseImageTrigger) *containerregistry.BaseImageTrigger { if len(triggers) == 0 { return nil } trigger := triggers[0] - status := legacyacr.TriggerStatusDisabled + status := containerregistry.TriggerStatusDisabled if trigger.Enabled { - status = legacyacr.TriggerStatusEnabled + status = containerregistry.TriggerStatusEnabled } - out := &legacyacr.BaseImageTrigger{ + out := &containerregistry.BaseImageTrigger{ Name: &trigger.Name, - BaseImageTriggerType: legacyacr.BaseImageTriggerType(trigger.Type), + BaseImageTriggerType: containerregistry.BaseImageTriggerType(trigger.Type), Status: status, } if trigger.UpdateTriggerEndpoint != "" { out.UpdateTriggerEndpoint = &trigger.UpdateTriggerEndpoint } if trigger.UpdateTriggerPayloadType != "" { - out.UpdateTriggerPayloadType = legacyacr.UpdateTriggerPayloadType(trigger.UpdateTriggerPayloadType) + out.UpdateTriggerPayloadType = containerregistry.UpdateTriggerPayloadType(trigger.UpdateTriggerPayloadType) } return out } -func flattenRegistryTaskBaseImageTrigger(trigger *legacyacr.BaseImageTrigger, model ContainerRegistryTaskModel) []BaseImageTrigger { +func flattenRegistryTaskBaseImageTrigger(trigger *containerregistry.BaseImageTrigger, model ContainerRegistryTaskModel) []BaseImageTrigger { if trigger == nil { return nil } obj := BaseImageTrigger{ Type: string(trigger.BaseImageTriggerType), - Enabled: trigger.Status == legacyacr.TriggerStatusEnabled, + Enabled: trigger.Status == containerregistry.TriggerStatusEnabled, UpdateTriggerPayloadType: string(trigger.UpdateTriggerPayloadType), } @@ -1018,28 +1018,28 @@ func flattenRegistryTaskBaseImageTrigger(trigger *legacyacr.BaseImageTrigger, mo return []BaseImageTrigger{obj} } -func expandRegistryTaskSourceTriggers(triggers []SourceTrigger) *[]legacyacr.SourceTrigger { +func expandRegistryTaskSourceTriggers(triggers []SourceTrigger) *[]containerregistry.SourceTrigger { if len(triggers) == 0 { return nil } - out := make([]legacyacr.SourceTrigger, 0, len(triggers)) + out := make([]containerregistry.SourceTrigger, 0, len(triggers)) for _, trigger := range triggers { - status := legacyacr.TriggerStatusDisabled + status := containerregistry.TriggerStatusDisabled if trigger.Enabled { - status = legacyacr.TriggerStatusEnabled + status = containerregistry.TriggerStatusEnabled } - sourceTrigger := legacyacr.SourceTrigger{ + sourceTrigger := containerregistry.SourceTrigger{ Name: &trigger.Name, Status: status, - SourceRepository: &legacyacr.SourceProperties{ - SourceControlType: legacyacr.SourceControlType(trigger.SourceType), + SourceRepository: &containerregistry.SourceProperties{ + SourceControlType: containerregistry.SourceControlType(trigger.SourceType), RepositoryURL: &trigger.RepositoryURL, }, } if len(trigger.Events) != 0 { - events := make([]legacyacr.SourceTriggerEvent, 0, len(trigger.Events)) + events := make([]containerregistry.SourceTriggerEvent, 0, len(trigger.Events)) for _, event := range trigger.Events { - events = append(events, legacyacr.SourceTriggerEvent(event)) + events = append(events, containerregistry.SourceTriggerEvent(event)) } sourceTrigger.SourceTriggerEvents = &events } @@ -1055,14 +1055,14 @@ func expandRegistryTaskSourceTriggers(triggers []SourceTrigger) *[]legacyacr.Sou return &out } -func flattenRegistryTaskSourceTriggers(triggers *[]legacyacr.SourceTrigger, model ContainerRegistryTaskModel) []SourceTrigger { +func flattenRegistryTaskSourceTriggers(triggers *[]containerregistry.SourceTrigger, model ContainerRegistryTaskModel) []SourceTrigger { if triggers == nil { return nil } out := make([]SourceTrigger, 0, len(*triggers)) for i, trigger := range *triggers { obj := SourceTrigger{ - Enabled: trigger.Status == legacyacr.TriggerStatusEnabled, + Enabled: trigger.Status == containerregistry.TriggerStatusEnabled, } if trigger.Name != nil { obj.Name = *trigger.Name @@ -1094,9 +1094,9 @@ func flattenRegistryTaskSourceTriggers(triggers *[]legacyacr.SourceTrigger, mode return out } -func expandRegistryTaskAuthInfo(auth Auth) *legacyacr.AuthInfo { - out := legacyacr.AuthInfo{ - TokenType: legacyacr.TokenType(auth.TokenType), +func expandRegistryTaskAuthInfo(auth Auth) *containerregistry.AuthInfo { + out := containerregistry.AuthInfo{ + TokenType: containerregistry.TokenType(auth.TokenType), Token: &auth.Token, } if auth.RefreshToken != "" { @@ -1111,17 +1111,17 @@ func expandRegistryTaskAuthInfo(auth Auth) *legacyacr.AuthInfo { return &out } -func expandRegistryTaskTimerTriggers(triggers []TimerTrigger) *[]legacyacr.TimerTrigger { +func expandRegistryTaskTimerTriggers(triggers []TimerTrigger) *[]containerregistry.TimerTrigger { if len(triggers) == 0 { return nil } - out := make([]legacyacr.TimerTrigger, 0, len(triggers)) + out := make([]containerregistry.TimerTrigger, 0, len(triggers)) for _, trigger := range triggers { - status := legacyacr.TriggerStatusDisabled + status := containerregistry.TriggerStatusDisabled if trigger.Enabled { - status = legacyacr.TriggerStatusEnabled + status = containerregistry.TriggerStatusEnabled } - timerTrigger := legacyacr.TimerTrigger{ + timerTrigger := containerregistry.TimerTrigger{ Name: &trigger.Name, Schedule: &trigger.Schedule, Status: status, @@ -1131,14 +1131,14 @@ func expandRegistryTaskTimerTriggers(triggers []TimerTrigger) *[]legacyacr.Timer return &out } -func flattenRegistryTaskTimerTriggers(triggers *[]legacyacr.TimerTrigger) []TimerTrigger { +func flattenRegistryTaskTimerTriggers(triggers *[]containerregistry.TimerTrigger) []TimerTrigger { if triggers == nil { return nil } out := make([]TimerTrigger, 0, len(*triggers)) for _, trigger := range *triggers { obj := TimerTrigger{ - Enabled: trigger.Status == legacyacr.TriggerStatusEnabled, + Enabled: trigger.Status == containerregistry.TriggerStatusEnabled, } if trigger.Name != nil { obj.Name = *trigger.Name @@ -1151,7 +1151,7 @@ func flattenRegistryTaskTimerTriggers(triggers *[]legacyacr.TimerTrigger) []Time return out } -func expandRegistryTaskStep(model ContainerRegistryTaskModel) legacyacr.BasicTaskStepProperties { +func expandRegistryTaskStep(model ContainerRegistryTaskModel) containerregistry.BasicTaskStepProperties { switch { case len(model.DockerStep) != 0: return expandRegistryTaskDockerStep(model.DockerStep[0]) @@ -1163,9 +1163,9 @@ func expandRegistryTaskStep(model ContainerRegistryTaskModel) legacyacr.BasicTas return nil } -func expandRegistryTaskDockerStep(step DockerStep) legacyacr.DockerBuildStep { - out := legacyacr.DockerBuildStep{ - Type: legacyacr.TypeDocker, +func expandRegistryTaskDockerStep(step DockerStep) containerregistry.DockerBuildStep { + out := containerregistry.DockerBuildStep{ + Type: containerregistry.TypeBasicTaskStepPropertiesTypeDocker, DockerFilePath: &step.DockerfilePath, IsPushEnabled: &step.IsPushEnabled, NoCache: utils.Bool(!step.IsCacheEnabled), @@ -1187,7 +1187,7 @@ func expandRegistryTaskDockerStep(step DockerStep) legacyacr.DockerBuildStep { return out } -func flattenRegistryTaskDockerStep(step legacyacr.BasicTaskStepProperties, model ContainerRegistryTaskModel) []DockerStep { +func flattenRegistryTaskDockerStep(step containerregistry.BasicTaskStepProperties, model ContainerRegistryTaskModel) []DockerStep { if step == nil { return nil } @@ -1231,9 +1231,9 @@ func flattenRegistryTaskDockerStep(step legacyacr.BasicTaskStepProperties, model return []DockerStep{obj} } -func expandRegistryTaskFileTaskStep(step FileTaskStep) legacyacr.FileTaskStep { - out := legacyacr.FileTaskStep{ - Type: legacyacr.TypeFileTask, +func expandRegistryTaskFileTaskStep(step FileTaskStep) containerregistry.FileTaskStep { + out := containerregistry.FileTaskStep{ + Type: containerregistry.TypeBasicTaskStepPropertiesTypeFileTask, TaskFilePath: &step.TaskFilePath, Values: expandRegistryTaskValues(step.Values, step.SecretValues), } @@ -1249,7 +1249,7 @@ func expandRegistryTaskFileTaskStep(step FileTaskStep) legacyacr.FileTaskStep { return out } -func flattenRegistryTaskFileTaskStep(step legacyacr.BasicTaskStepProperties, model ContainerRegistryTaskModel) []FileTaskStep { +func flattenRegistryTaskFileTaskStep(step containerregistry.BasicTaskStepProperties, model ContainerRegistryTaskModel) []FileTaskStep { if step == nil { return nil } @@ -1284,9 +1284,9 @@ func flattenRegistryTaskFileTaskStep(step legacyacr.BasicTaskStepProperties, mod return []FileTaskStep{obj} } -func expandRegistryTaskEncodedTaskStep(step EncodedTaskStep) legacyacr.EncodedTaskStep { - out := legacyacr.EncodedTaskStep{ - Type: legacyacr.TypeEncodedTask, +func expandRegistryTaskEncodedTaskStep(step EncodedTaskStep) containerregistry.EncodedTaskStep { + out := containerregistry.EncodedTaskStep{ + Type: containerregistry.TypeBasicTaskStepPropertiesTypeEncodedTask, EncodedTaskContent: utils.String(utils.Base64EncodeIfNot(step.TaskContent)), Values: expandRegistryTaskValues(step.Values, step.SecretValues), } @@ -1302,7 +1302,7 @@ func expandRegistryTaskEncodedTaskStep(step EncodedTaskStep) legacyacr.EncodedTa return out } -func flattenRegistryTaskEncodedTaskStep(step legacyacr.BasicTaskStepProperties, model ContainerRegistryTaskModel) []EncodedTaskStep { +func flattenRegistryTaskEncodedTaskStep(step containerregistry.BasicTaskStepProperties, model ContainerRegistryTaskModel) []EncodedTaskStep { if step == nil { return nil } @@ -1340,20 +1340,20 @@ func flattenRegistryTaskEncodedTaskStep(step legacyacr.BasicTaskStepProperties, return []EncodedTaskStep{obj} } -func expandRegistryTaskArguments(arguments map[string]string, secretArguments map[string]string) *[]legacyacr.Argument { +func expandRegistryTaskArguments(arguments map[string]string, secretArguments map[string]string) *[]containerregistry.Argument { if len(arguments) == 0 && len(secretArguments) == 0 { return nil } - out := make([]legacyacr.Argument, 0, len(arguments)+len(secretArguments)) + out := make([]containerregistry.Argument, 0, len(arguments)+len(secretArguments)) for k, v := range arguments { - out = append(out, legacyacr.Argument{ + out = append(out, containerregistry.Argument{ Name: utils.String(k), Value: utils.String(v), IsSecret: utils.Bool(false), }) } for k, v := range secretArguments { - out = append(out, legacyacr.Argument{ + out = append(out, containerregistry.Argument{ Name: utils.String(k), Value: utils.String(v), IsSecret: utils.Bool(true), @@ -1362,7 +1362,7 @@ func expandRegistryTaskArguments(arguments map[string]string, secretArguments ma return &out } -func flattenRegistryTaskArguments(arguments *[]legacyacr.Argument) map[string]string { +func flattenRegistryTaskArguments(arguments *[]containerregistry.Argument) map[string]string { if arguments == nil { return nil } @@ -1396,20 +1396,20 @@ func flattenRegistryTaskArguments(arguments *[]legacyacr.Argument) map[string]st return args } -func expandRegistryTaskValues(values map[string]string, secretValues map[string]string) *[]legacyacr.SetValue { +func expandRegistryTaskValues(values map[string]string, secretValues map[string]string) *[]containerregistry.SetValue { if len(values) == 0 && len(secretValues) == 0 { return nil } - out := make([]legacyacr.SetValue, 0, len(values)+len(secretValues)) + out := make([]containerregistry.SetValue, 0, len(values)+len(secretValues)) for k, v := range values { - out = append(out, legacyacr.SetValue{ + out = append(out, containerregistry.SetValue{ Name: utils.String(k), Value: utils.String(v), IsSecret: utils.Bool(false), }) } for k, v := range secretValues { - out = append(out, legacyacr.SetValue{ + out = append(out, containerregistry.SetValue{ Name: utils.String(k), Value: utils.String(v), IsSecret: utils.Bool(true), @@ -1418,7 +1418,7 @@ func expandRegistryTaskValues(values map[string]string, secretValues map[string] return &out } -func flattenRegistryTaskValues(values *[]legacyacr.SetValue) map[string]string { +func flattenRegistryTaskValues(values *[]containerregistry.SetValue) map[string]string { if values == nil { return nil } @@ -1451,19 +1451,19 @@ func flattenRegistryTaskValues(values *[]legacyacr.SetValue) map[string]string { return vals } -func expandRegistryTaskIdentity(input []interface{}) (*legacyacr.IdentityProperties, error) { +func expandRegistryTaskIdentity(input []interface{}) (*containerregistry.IdentityProperties, error) { expanded, err := identity.ExpandSystemAndUserAssignedMap(input) if err != nil { return nil, err } - out := legacyacr.IdentityProperties{ - Type: legacyacr.ResourceIdentityType(string(expanded.Type)), + out := containerregistry.IdentityProperties{ + Type: containerregistry.ResourceIdentityType(string(expanded.Type)), } if len(expanded.IdentityIds) > 0 { - out.UserAssignedIdentities = map[string]*legacyacr.UserIdentityProperties{} + out.UserAssignedIdentities = map[string]*containerregistry.UserIdentityProperties{} for k := range expanded.IdentityIds { - out.UserAssignedIdentities[k] = &legacyacr.UserIdentityProperties{ + out.UserAssignedIdentities[k] = &containerregistry.UserIdentityProperties{ // intentionally empty } } @@ -1471,7 +1471,7 @@ func expandRegistryTaskIdentity(input []interface{}) (*legacyacr.IdentityPropert return &out, nil } -func flattenRegistryTaskIdentity(input *legacyacr.IdentityProperties) (*[]interface{}, error) { +func flattenRegistryTaskIdentity(input *containerregistry.IdentityProperties) (*[]interface{}, error) { var transform *identity.SystemAndUserAssignedMap if input != nil { @@ -1496,24 +1496,24 @@ func flattenRegistryTaskIdentity(input *legacyacr.IdentityProperties) (*[]interf return identity.FlattenSystemAndUserAssignedMap(transform) } -func expandRegistryTaskPlatform(input []Platform) *legacyacr.PlatformProperties { +func expandRegistryTaskPlatform(input []Platform) *containerregistry.PlatformProperties { if len(input) == 0 { return nil } platform := input[0] - out := &legacyacr.PlatformProperties{ - Os: legacyacr.OS(platform.OS), + out := &containerregistry.PlatformProperties{ + Os: containerregistry.OS(platform.OS), } if arch := platform.Architecture; arch != "" { - out.Architecture = legacyacr.Architecture(arch) + out.Architecture = containerregistry.Architecture(arch) } if variant := platform.Variant; variant != "" { - out.Variant = legacyacr.Variant(variant) + out.Variant = containerregistry.Variant(variant) } return out } -func flattenRegistryTaskPlatform(platform *legacyacr.PlatformProperties) []Platform { +func flattenRegistryTaskPlatform(platform *containerregistry.PlatformProperties) []Platform { if platform == nil { return nil } @@ -1524,18 +1524,18 @@ func flattenRegistryTaskPlatform(platform *legacyacr.PlatformProperties) []Platf }} } -func expandRegistryTaskCredentials(input []RegistryCredential) *legacyacr.Credentials { +func expandRegistryTaskCredentials(input []RegistryCredential) *containerregistry.Credentials { if len(input) == 0 { return nil } - return &legacyacr.Credentials{ + return &containerregistry.Credentials{ SourceRegistry: expandSourceRegistryCredential(input[0].Source), CustomRegistries: expandCustomRegistryCredential(input[0].Custom), } } -func flattenRegistryTaskCredentials(input *legacyacr.Credentials, model ContainerRegistryTaskModel) []RegistryCredential { +func flattenRegistryTaskCredentials(input *containerregistry.Credentials, model ContainerRegistryTaskModel) []RegistryCredential { if input == nil { return nil } @@ -1554,15 +1554,15 @@ func flattenRegistryTaskCredentials(input *legacyacr.Credentials, model Containe } } -func expandSourceRegistryCredential(input []SourceRegistryCredential) *legacyacr.SourceRegistryCredentials { +func expandSourceRegistryCredential(input []SourceRegistryCredential) *containerregistry.SourceRegistryCredentials { if len(input) == 0 { return nil } - return &legacyacr.SourceRegistryCredentials{LoginMode: legacyacr.SourceRegistryLoginMode(input[0].LoginMode)} + return &containerregistry.SourceRegistryCredentials{LoginMode: containerregistry.SourceRegistryLoginMode(input[0].LoginMode)} } -func flattenSourceRegistryCredential(input *legacyacr.SourceRegistryCredentials) []SourceRegistryCredential { +func flattenSourceRegistryCredential(input *containerregistry.SourceRegistryCredentials) []SourceRegistryCredential { if input == nil { return nil } @@ -1570,31 +1570,31 @@ func flattenSourceRegistryCredential(input *legacyacr.SourceRegistryCredentials) return []SourceRegistryCredential{{LoginMode: string(input.LoginMode)}} } -func expandCustomRegistryCredential(input []CustomRegistryCredential) map[string]*legacyacr.CustomRegistryCredentials { +func expandCustomRegistryCredential(input []CustomRegistryCredential) map[string]*containerregistry.CustomRegistryCredentials { if len(input) == 0 { return nil } - out := map[string]*legacyacr.CustomRegistryCredentials{} + out := map[string]*containerregistry.CustomRegistryCredentials{} for _, credential := range input { - cred := &legacyacr.CustomRegistryCredentials{} + cred := &containerregistry.CustomRegistryCredentials{} if credential.UserName != "" { - usernameType := legacyacr.Opaque + usernameType := containerregistry.SecretObjectTypeOpaque if _, err := keyVaultParse.ParseNestedItemID(credential.UserName); err == nil { - usernameType = legacyacr.Vaultsecret + usernameType = containerregistry.SecretObjectTypeVaultsecret } - cred.UserName = &legacyacr.SecretObject{ + cred.UserName = &containerregistry.SecretObject{ Value: utils.String(credential.UserName), Type: usernameType, } } if credential.Password != "" { - passwordType := legacyacr.Opaque + passwordType := containerregistry.SecretObjectTypeOpaque if _, err := keyVaultParse.ParseNestedItemID(credential.Password); err == nil { - passwordType = legacyacr.Vaultsecret + passwordType = containerregistry.SecretObjectTypeVaultsecret } - cred.Password = &legacyacr.SecretObject{ + cred.Password = &containerregistry.SecretObject{ Value: utils.String(credential.Password), Type: passwordType, } @@ -1607,16 +1607,16 @@ func expandCustomRegistryCredential(input []CustomRegistryCredential) map[string return out } -func expandRegistryTaskAgentProperties(input []AgentConfig) *legacyacr.AgentProperties { +func expandRegistryTaskAgentProperties(input []AgentConfig) *containerregistry.AgentProperties { if len(input) == 0 { return nil } agentConfig := input[0] - return &legacyacr.AgentProperties{CPU: utils.Int32(int32(agentConfig.CPU))} + return &containerregistry.AgentProperties{CPU: utils.Int32(int32(agentConfig.CPU))} } -func flattenRegistryTaskAgentProperties(input *legacyacr.AgentProperties) []AgentConfig { +func flattenRegistryTaskAgentProperties(input *containerregistry.AgentProperties) []AgentConfig { if input == nil { return nil } @@ -1628,12 +1628,12 @@ func flattenRegistryTaskAgentProperties(input *legacyacr.AgentProperties) []Agen return []AgentConfig{{CPU: cpu}} } -func patchRegistryTaskTriggerSourceTrigger(triggers []legacyacr.SourceTrigger, model ContainerRegistryTaskModel) *[]legacyacr.SourceTrigger { +func patchRegistryTaskTriggerSourceTrigger(triggers []containerregistry.SourceTrigger, model ContainerRegistryTaskModel) *[]containerregistry.SourceTrigger { if len(triggers) != len(model.SourceTrigger) { return &triggers } - result := make([]legacyacr.SourceTrigger, len(triggers)) + result := make([]containerregistry.SourceTrigger, len(triggers)) for i, trigger := range model.SourceTrigger { t := (triggers)[i] if len(trigger.Auth) == 0 { diff --git a/internal/services/containers/container_registry_task_schedule_run_now_resource.go b/internal/services/containers/container_registry_task_schedule_run_now_resource.go new file mode 100644 index 000000000000..39a5bce845ed --- /dev/null +++ b/internal/services/containers/container_registry_task_schedule_run_now_resource.go @@ -0,0 +1,164 @@ +package containers + +import ( + "context" + "fmt" + "time" + + "github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2021-08-01-preview/containerregistry" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type ContainerRegistryTaskScheduleResource struct{} + +var _ sdk.Resource = ContainerRegistryTaskScheduleResource{} + +type ContainerRegistryTaskScheduleModel struct { + TaskId string `tfschema:"container_registry_task_id"` +} + +func (r ContainerRegistryTaskScheduleResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "container_registry_task_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.ContainerRegistryTaskID, + }, + } +} + +func (r ContainerRegistryTaskScheduleResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (r ContainerRegistryTaskScheduleResource) ResourceType() string { + return "azurerm_container_registry_task_schedule_run_now" +} + +func (r ContainerRegistryTaskScheduleResource) ModelObject() interface{} { + return &ContainerRegistryTaskScheduleModel{} +} + +func (r ContainerRegistryTaskScheduleResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return validate.ContainerRegistryTaskScheduleID +} + +func (r ContainerRegistryTaskScheduleResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + taskClient := metadata.Client.Containers.TasksClient + + var model ContainerRegistryTaskScheduleModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding %+v", err) + } + + taskId, err := parse.ContainerRegistryTaskID(model.TaskId) + if err != nil { + return fmt.Errorf("parsing container registry task ID: %v", err) + } + + resp, err := taskClient.Get(ctx, taskId.ResourceGroup, taskId.RegistryName, taskId.TaskName) + if err != nil { + return fmt.Errorf("retrieving %q: %+v", taskId, err) + } + if resp.TaskProperties == nil { + return fmt.Errorf("unexpected nil `taskProperties` of %q", taskId) + } + if resp.TaskProperties.Step == nil { + return fmt.Errorf("unexpected nil `taskProperties.step` of %q", taskId) + } + + req := containerregistry.TaskRunRequest{ + TaskID: utils.String(taskId.ID()), + } + switch resp.TaskProperties.Step.(type) { + case containerregistry.DockerBuildStep: + req.Type = containerregistry.TypeDockerBuildRequest + case containerregistry.FileTaskStep: + req.Type = containerregistry.TypeFileTaskRunRequest + case containerregistry.EncodedTaskStep: + req.Type = containerregistry.TypeEncodedTaskRunRequest + default: + return fmt.Errorf("unexpected container registry task step type: %T", resp.TaskProperties.Step) + } + + registryClient := metadata.Client.Containers.RegistriesClient + future, err := registryClient.ScheduleRun(ctx, taskId.ResourceGroup, taskId.RegistryName, req) + if err != nil { + return fmt.Errorf("scheduling the task: %v", err) + } + if err := future.WaitForCompletionRef(ctx, registryClient.Client); err != nil { + return fmt.Errorf("waiting for schedule: %v", err) + } + + run, err := future.Result(*registryClient) + if err != nil { + return fmt.Errorf("getting the scheduled run: %v", err) + } + + if run.Name == nil { + return fmt.Errorf("unexpected nil scheduled run name") + } + + runsClient := metadata.Client.Containers.RunsClient + + timeout, _ := ctx.Deadline() + stateConf := &pluginsdk.StateChangeConf{ + Pending: []string{string(containerregistry.RunStatusQueued), string(containerregistry.RunStatusStarted), string(containerregistry.RunStatusRunning)}, + Target: []string{string(containerregistry.RunStatusSucceeded)}, + Refresh: func() (interface{}, string, error) { + resp, err := runsClient.Get(ctx, taskId.ResourceGroup, taskId.RegistryName, *run.Name) + if err != nil { + return nil, "", fmt.Errorf("getting the scheduled run: %v", err) + } + + if resp.RunProperties == nil { + return nil, "", fmt.Errorf("unexpected nil properties of the scheduled run") + } + + return run, string(resp.RunProperties.Status), nil + }, + ContinuousTargetOccurence: 1, + PollInterval: 5 * time.Second, + Timeout: time.Until(timeout), + } + if _, err := stateConf.WaitForStateContext(ctx); err != nil { + return fmt.Errorf("waiting for scheduled task to finish: %+v", err) + } + + metadata.SetID(parse.NewContainerRegistryTaskScheduleID(taskId.SubscriptionId, taskId.ResourceGroup, taskId.RegistryName, taskId.TaskName, "schedule")) + return nil + }, + } +} + +func (r ContainerRegistryTaskScheduleResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + id, err := parse.ContainerRegistryTaskScheduleID(metadata.ResourceData.Id()) + if err != nil { + return err + } + model := ContainerRegistryTaskScheduleModel{TaskId: parse.NewContainerRegistryTaskID(id.SubscriptionId, id.ResourceGroup, id.RegistryName, id.TaskName).ID()} + return metadata.Encode(&model) + }, + } +} + +func (r ContainerRegistryTaskScheduleResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + return nil + }, + } +} diff --git a/internal/services/containers/container_registry_task_schedule_run_now_resource_test.go b/internal/services/containers/container_registry_task_schedule_run_now_resource_test.go new file mode 100644 index 000000000000..317c5bcc8232 --- /dev/null +++ b/internal/services/containers/container_registry_task_schedule_run_now_resource_test.go @@ -0,0 +1,149 @@ +package containers_test + +import ( + "context" + "fmt" + "os" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type ContainerRegistryTaskScheduleResource struct { + githubRepo +} + +func TestAccContainerRegistryTaskSchedule_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_container_registry_task_schedule_run_now", "test") + + preCheckGithubRepo(t) + + r := ContainerRegistryTaskScheduleResource{ + githubRepo: githubRepo{ + url: os.Getenv("ARM_TEST_ACR_TASK_GITHUB_REPO_URL"), + token: os.Getenv("ARM_TEST_ACR_TASK_GITHUB_USER_TOKEN"), + }, + } + + data.ResourceTest(t, r, []resource.TestStep{ + { + Config: r.basic(data, r.dockerTaskStep), + }, + data.ImportStep(), + { + Config: r.basic(data, r.fileTaskStep), + }, + data.ImportStep(), + { + Config: r.basic(data, r.encodedTaskStep), + }, + data.ImportStep(), + }) +} + +func (r ContainerRegistryTaskScheduleResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + ret := false + return &ret, nil +} + +func (r ContainerRegistryTaskScheduleResource) basic(data acceptance.TestData, tpl func(data acceptance.TestData) string) string { + template := tpl(data) + return fmt.Sprintf(` +%s + +resource "azurerm_container_registry_task_schedule_run_now" "test" { + container_registry_task_id = azurerm_container_registry_task.test.id +} +`, template) +} + +func (r ContainerRegistryTaskScheduleResource) dockerTaskStep(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_container_registry_task" "test" { + name = "testacccrTask%d" + container_registry_id = azurerm_container_registry.test.id + platform { + os = "Linux" + } + docker_step { + dockerfile_path = "Dockerfile" + context_path = "%s" + context_access_token = "%s" + image_names = ["helloworld:{{.Run.ID}}"] + } +} +`, template, data.RandomInteger, r.githubRepo.url, r.githubRepo.token) +} + +func (r ContainerRegistryTaskScheduleResource) fileTaskStep(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_container_registry_task" "test" { + name = "testacccrTask%d" + container_registry_id = azurerm_container_registry.test.id + platform { + os = "Linux" + } + file_step { + task_file_path = "taskmulti.yaml" + context_path = "%s" + context_access_token = "%s" + } +} +`, template, data.RandomInteger, r.githubRepo.url, r.githubRepo.token) +} + +func (r ContainerRegistryTaskScheduleResource) encodedTaskStep(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_container_registry_task" "test" { + name = "testacccrTask%d" + container_registry_id = azurerm_container_registry.test.id + platform { + os = "Linux" + } + encoded_step { + task_content = < 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs", 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 RunsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client RunsClient) ListResponder(resp *http.Response) (result RunListResult, err error) { - err = autorest.Respond( - resp, - 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 RunsClient) listNextResults(ctx context.Context, lastResults RunListResult) (result RunListResult, err error) { - req, err := lastResults.runListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.RunsClient", "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.RunsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client RunsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string, filter string, top *int32) (result RunListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunsClient.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, filter, top) - return -} - -// Update patch the run properties. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// runID - the run ID. -// runUpdateParameters - the run update properties. -func (client RunsClient) Update(ctx context.Context, resourceGroupName string, registryName string, runID string, runUpdateParameters RunUpdateParameters) (result RunsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RunsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.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.RunsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, runID, runUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client RunsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, runID string, runUpdateParameters RunUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "runId": autorest.Encode("path", runID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-06-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}/runs/{runId}", pathParameters), - autorest.WithJSON(runUpdateParameters), - 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 RunsClient) UpdateSender(req *http.Request) (future RunsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client RunsClient) UpdateResponder(resp *http.Response) (result Run, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2019-06-01-preview/containerregistry/scopemaps.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2019-06-01-preview/containerregistry/scopemaps.go deleted file mode 100644 index f22da284db00..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2019-06-01-preview/containerregistry/scopemaps.go +++ /dev/null @@ -1,545 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -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 using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -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.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.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) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - 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, - 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.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.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) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - 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, - 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 - } - - 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) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// 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, - 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 - } - if result.smlr.hasNextLink() && result.smlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - 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) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// 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, - 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.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.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) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - 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, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2019-06-01-preview/containerregistry/taskruns.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2019-06-01-preview/containerregistry/taskruns.go deleted file mode 100644 index ee13d4b2d14f..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2019-06-01-preview/containerregistry/taskruns.go +++ /dev/null @@ -1,634 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -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" -) - -// TaskRunsClient is the client for the TaskRuns methods of the Containerregistry service. -type TaskRunsClient struct { - BaseClient -} - -// NewTaskRunsClient creates an instance of the TaskRunsClient client. -func NewTaskRunsClient(subscriptionID string) TaskRunsClient { - return NewTaskRunsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTaskRunsClientWithBaseURI creates an instance of the TaskRunsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewTaskRunsClientWithBaseURI(baseURI string, subscriptionID string) TaskRunsClient { - return TaskRunsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a task run 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. -// taskRunName - the name of the task run. -// taskRun - the parameters of a run that needs to scheduled. -func (client TaskRunsClient) Create(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, taskRun TaskRun) (result TaskRunsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.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: taskRunName, - Constraints: []validation.Constraint{{Target: "taskRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TaskRunsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, taskRunName, taskRun) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client TaskRunsClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, taskRun TaskRun) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskRunName": autorest.Encode("path", taskRunName), - } - - const APIVersion = "2019-06-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}/taskRuns/{taskRunName}", pathParameters), - autorest.WithJSON(taskRun), - 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 TaskRunsClient) CreateSender(req *http.Request) (future TaskRunsCreateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client TaskRunsClient) CreateResponder(resp *http.Response) (result TaskRun, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a specified task run resource. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskRunName - the name of the task run. -func (client TaskRunsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result TaskRunsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.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: taskRunName, - Constraints: []validation.Constraint{{Target: "taskRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TaskRunsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, taskRunName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TaskRunsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskRunName": autorest.Encode("path", taskRunName), - } - - const APIVersion = "2019-06-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}/taskRuns/{taskRunName}", 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 TaskRunsClient) DeleteSender(req *http.Request) (future TaskRunsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client TaskRunsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the detailed information for a given task run. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskRunName - the name of the task run. -func (client TaskRunsClient) Get(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result TaskRun, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.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: taskRunName, - Constraints: []validation.Constraint{{Target: "taskRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TaskRunsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, taskRunName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "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.TaskRunsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TaskRunsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskRunName": autorest.Encode("path", taskRunName), - } - - const APIVersion = "2019-06-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}/taskRuns/{taskRunName}", 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 TaskRunsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client TaskRunsClient) GetResponder(resp *http.Response) (result TaskRun, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDetails gets the detailed information for a given task run that includes all secrets. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskRunName - the name of the task run. -func (client TaskRunsClient) GetDetails(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result TaskRun, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.GetDetails") - 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: taskRunName, - Constraints: []validation.Constraint{{Target: "taskRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TaskRunsClient", "GetDetails", err.Error()) - } - - req, err := client.GetDetailsPreparer(ctx, resourceGroupName, registryName, taskRunName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "GetDetails", nil, "Failure preparing request") - return - } - - resp, err := client.GetDetailsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "GetDetails", resp, "Failure sending request") - return - } - - result, err = client.GetDetailsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "GetDetails", resp, "Failure responding to request") - return - } - - return -} - -// GetDetailsPreparer prepares the GetDetails request. -func (client TaskRunsClient) GetDetailsPreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskRunName": autorest.Encode("path", taskRunName), - } - - const APIVersion = "2019-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}/listDetails", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetDetailsSender sends the GetDetails request. The method will close the -// http.Response Body if it receives an error. -func (client TaskRunsClient) GetDetailsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetDetailsResponder handles the response to the GetDetails request. The method always -// closes the http.Response Body. -func (client TaskRunsClient) GetDetailsResponder(resp *http.Response) (result TaskRun, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all the task runs for 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. -func (client TaskRunsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result TaskRunListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.List") - defer func() { - sc := -1 - if result.trlr.Response.Response != nil { - sc = result.trlr.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.TaskRunsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.trlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "List", resp, "Failure sending request") - return - } - - result.trlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "List", resp, "Failure responding to request") - return - } - if result.trlr.hasNextLink() && result.trlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TaskRunsClient) 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-06-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}/taskRuns", 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 TaskRunsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client TaskRunsClient) ListResponder(resp *http.Response) (result TaskRunListResult, err error) { - err = autorest.Respond( - resp, - 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 TaskRunsClient) listNextResults(ctx context.Context, lastResults TaskRunListResult) (result TaskRunListResult, err error) { - req, err := lastResults.taskRunListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "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.TaskRunsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client TaskRunsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result TaskRunListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.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 task run 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. -// taskRunName - the name of the task run. -// updateParameters - the parameters for updating a task run. -func (client TaskRunsClient) Update(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, updateParameters TaskRunUpdateParameters) (result TaskRunsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.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: taskRunName, - Constraints: []validation.Constraint{{Target: "taskRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TaskRunsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, taskRunName, updateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client TaskRunsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, updateParameters TaskRunUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskRunName": autorest.Encode("path", taskRunName), - } - - const APIVersion = "2019-06-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}/taskRuns/{taskRunName}", pathParameters), - autorest.WithJSON(updateParameters), - 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 TaskRunsClient) UpdateSender(req *http.Request) (future TaskRunsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client TaskRunsClient) UpdateResponder(resp *http.Response) (result TaskRun, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2019-06-01-preview/containerregistry/tasks.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2019-06-01-preview/containerregistry/tasks.go deleted file mode 100644 index 3af51765a125..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2019-06-01-preview/containerregistry/tasks.go +++ /dev/null @@ -1,645 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -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" -) - -// TasksClient is the client for the Tasks methods of the Containerregistry service. -type TasksClient struct { - BaseClient -} - -// NewTasksClient creates an instance of the TasksClient client. -func NewTasksClient(subscriptionID string) TasksClient { - return NewTasksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTasksClientWithBaseURI creates an instance of the TasksClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewTasksClientWithBaseURI(baseURI string, subscriptionID string) TasksClient { - return TasksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a task 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. -// taskName - the name of the container registry task. -// taskCreateParameters - the parameters for creating a task. -func (client TasksClient) Create(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskCreateParameters Task) (result TasksCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.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: taskName, - Constraints: []validation.Constraint{{Target: "taskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}, - {TargetValue: taskCreateParameters, - Constraints: []validation.Constraint{{Target: "taskCreateParameters.TaskProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "taskCreateParameters.TaskProperties.Timeout", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "taskCreateParameters.TaskProperties.Timeout", Name: validation.InclusiveMaximum, Rule: int64(28800), Chain: nil}, - {Target: "taskCreateParameters.TaskProperties.Timeout", Name: validation.InclusiveMinimum, Rule: int64(300), Chain: nil}, - }}, - {Target: "taskCreateParameters.TaskProperties.Trigger", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "taskCreateParameters.TaskProperties.Trigger.BaseImageTrigger", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "taskCreateParameters.TaskProperties.Trigger.BaseImageTrigger.Name", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.TasksClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, taskName, taskCreateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client TasksClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskCreateParameters Task) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskName": autorest.Encode("path", taskName), - } - - const APIVersion = "2019-06-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}/tasks/{taskName}", pathParameters), - autorest.WithJSON(taskCreateParameters), - 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 TasksClient) CreateSender(req *http.Request) (future TasksCreateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client TasksClient) CreateResponder(resp *http.Response) (result Task, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a specified task. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskName - the name of the container registry task. -func (client TasksClient) Delete(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result TasksDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.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: taskName, - Constraints: []validation.Constraint{{Target: "taskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TasksClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, taskName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TasksClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, taskName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskName": autorest.Encode("path", taskName), - } - - const APIVersion = "2019-06-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}/tasks/{taskName}", 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 TasksClient) DeleteSender(req *http.Request) (future TasksDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client TasksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get the properties of a specified task. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskName - the name of the container registry task. -func (client TasksClient) Get(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result Task, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.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: taskName, - Constraints: []validation.Constraint{{Target: "taskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TasksClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, taskName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "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.TasksClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TasksClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, taskName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskName": autorest.Encode("path", taskName), - } - - const APIVersion = "2019-06-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}/tasks/{taskName}", 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 TasksClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client TasksClient) GetResponder(resp *http.Response) (result Task, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDetails returns a task with extended information that includes all secrets. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// taskName - the name of the container registry task. -func (client TasksClient) GetDetails(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result Task, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.GetDetails") - 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: taskName, - Constraints: []validation.Constraint{{Target: "taskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TasksClient", "GetDetails", err.Error()) - } - - req, err := client.GetDetailsPreparer(ctx, resourceGroupName, registryName, taskName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "GetDetails", nil, "Failure preparing request") - return - } - - resp, err := client.GetDetailsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "GetDetails", resp, "Failure sending request") - return - } - - result, err = client.GetDetailsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "GetDetails", resp, "Failure responding to request") - return - } - - return -} - -// GetDetailsPreparer prepares the GetDetails request. -func (client TasksClient) GetDetailsPreparer(ctx context.Context, resourceGroupName string, registryName string, taskName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskName": autorest.Encode("path", taskName), - } - - const APIVersion = "2019-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}/listDetails", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetDetailsSender sends the GetDetails request. The method will close the -// http.Response Body if it receives an error. -func (client TasksClient) GetDetailsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetDetailsResponder handles the response to the GetDetails request. The method always -// closes the http.Response Body. -func (client TasksClient) GetDetailsResponder(resp *http.Response) (result Task, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all the tasks for 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. -func (client TasksClient) List(ctx context.Context, resourceGroupName string, registryName string) (result TaskListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.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.TasksClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "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.TasksClient", "List", resp, "Failure sending request") - return - } - - result.tlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "List", resp, "Failure responding to request") - return - } - if result.tlr.hasNextLink() && result.tlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TasksClient) 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-06-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}/tasks", 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 TasksClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client TasksClient) ListResponder(resp *http.Response) (result TaskListResult, err error) { - err = autorest.Respond( - resp, - 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 TasksClient) listNextResults(ctx context.Context, lastResults TaskListResult) (result TaskListResult, err error) { - req, err := lastResults.taskListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.TasksClient", "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.TasksClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client TasksClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result TaskListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.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 task 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. -// taskName - the name of the container registry task. -// taskUpdateParameters - the parameters for updating a task. -func (client TasksClient) Update(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskUpdateParameters TaskUpdateParameters) (result TasksUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.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: taskName, - Constraints: []validation.Constraint{{Target: "taskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "taskName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "taskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.TasksClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, taskName, taskUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client TasksClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskUpdateParameters TaskUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "taskName": autorest.Encode("path", taskName), - } - - const APIVersion = "2019-06-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}/tasks/{taskName}", pathParameters), - autorest.WithJSON(taskUpdateParameters), - 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 TasksClient) UpdateSender(req *http.Request) (future TasksUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client TasksClient) UpdateResponder(resp *http.Response) (result Task, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2019-06-01-preview/containerregistry/tokens.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2019-06-01-preview/containerregistry/tokens.go deleted file mode 100644 index cee1b1d5e0be..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2019-06-01-preview/containerregistry/tokens.go +++ /dev/null @@ -1,542 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -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 using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -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.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.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) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - 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, - 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.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.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) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - 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, - 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 - } - - 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) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// 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, - 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 - } - if result.tlr.hasNextLink() && result.tlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - 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) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// 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, - 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.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.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) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - 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, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2019-06-01-preview/containerregistry/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2019-06-01-preview/containerregistry/version.go deleted file mode 100644 index 218df2849aa5..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2019-06-01-preview/containerregistry/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package containerregistry - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " containerregistry/2019-06-01-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2019-06-01-preview/containerregistry/webhooks.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2019-06-01-preview/containerregistry/webhooks.go deleted file mode 100644 index 1c520279eb92..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2019-06-01-preview/containerregistry/webhooks.go +++ /dev/null @@ -1,866 +0,0 @@ -package containerregistry - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -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" -) - -// WebhooksClient is the client for the Webhooks methods of the Containerregistry service. -type WebhooksClient struct { - BaseClient -} - -// NewWebhooksClient creates an instance of the WebhooksClient client. -func NewWebhooksClient(subscriptionID string) WebhooksClient { - return NewWebhooksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWebhooksClientWithBaseURI creates an instance of the WebhooksClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWebhooksClientWithBaseURI(baseURI string, subscriptionID string) WebhooksClient { - return WebhooksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a webhook 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. -// webhookName - the name of the webhook. -// webhookCreateParameters - the parameters for creating a webhook. -func (client WebhooksClient) Create(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookCreateParameters WebhookCreateParameters) (result WebhooksCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.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: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, - {TargetValue: webhookCreateParameters, - Constraints: []validation.Constraint{{Target: "webhookCreateParameters.Location", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "webhookCreateParameters.WebhookPropertiesCreateParameters", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "webhookCreateParameters.WebhookPropertiesCreateParameters.ServiceURI", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "webhookCreateParameters.WebhookPropertiesCreateParameters.Actions", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, webhookName, webhookCreateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client WebhooksClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookCreateParameters WebhookCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2019-05-01" - 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}/webhooks/{webhookName}", pathParameters), - autorest.WithJSON(webhookCreateParameters), - 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 WebhooksClient) CreateSender(req *http.Request) (future WebhooksCreateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client WebhooksClient) CreateResponder(resp *http.Response) (result Webhook, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a webhook 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. -// webhookName - the name of the webhook. -func (client WebhooksClient) Delete(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result WebhooksDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.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: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WebhooksClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2019-05-01" - 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}/webhooks/{webhookName}", 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 WebhooksClient) DeleteSender(req *http.Request) (future WebhooksDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client WebhooksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the properties of the specified webhook. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) Get(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result Webhook, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "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.WebhooksClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WebhooksClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2019-05-01" - 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}/webhooks/{webhookName}", 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 WebhooksClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client WebhooksClient) GetResponder(resp *http.Response) (result Webhook, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetCallbackConfig gets the configuration of service URI and custom headers for the webhook. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) GetCallbackConfig(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result CallbackConfig, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.GetCallbackConfig") - 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: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "GetCallbackConfig", err.Error()) - } - - req, err := client.GetCallbackConfigPreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "GetCallbackConfig", nil, "Failure preparing request") - return - } - - resp, err := client.GetCallbackConfigSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "GetCallbackConfig", resp, "Failure sending request") - return - } - - result, err = client.GetCallbackConfigResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "GetCallbackConfig", resp, "Failure responding to request") - return - } - - return -} - -// GetCallbackConfigPreparer prepares the GetCallbackConfig request. -func (client WebhooksClient) GetCallbackConfigPreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetCallbackConfigSender sends the GetCallbackConfig request. The method will close the -// http.Response Body if it receives an error. -func (client WebhooksClient) GetCallbackConfigSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetCallbackConfigResponder handles the response to the GetCallbackConfig request. The method always -// closes the http.Response Body. -func (client WebhooksClient) GetCallbackConfigResponder(resp *http.Response) (result CallbackConfig, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all the webhooks 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 WebhooksClient) List(ctx context.Context, resourceGroupName string, registryName string) (result WebhookListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.List") - defer func() { - sc := -1 - if result.wlr.Response.Response != nil { - sc = result.wlr.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.WebhooksClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, registryName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.wlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "List", resp, "Failure sending request") - return - } - - result.wlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "List", resp, "Failure responding to request") - return - } - if result.wlr.hasNextLink() && result.wlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client WebhooksClient) 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" - 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}/webhooks", 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 WebhooksClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client WebhooksClient) ListResponder(resp *http.Response) (result WebhookListResult, err error) { - err = autorest.Respond( - resp, - 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 WebhooksClient) listNextResults(ctx context.Context, lastResults WebhookListResult) (result WebhookListResult, err error) { - req, err := lastResults.webhookListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "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.WebhooksClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client WebhooksClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result WebhookListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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 -} - -// ListEvents lists recent events for the specified webhook. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) ListEvents(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result EventListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.ListEvents") - defer func() { - sc := -1 - if result.elr.Response.Response != nil { - sc = result.elr.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: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "ListEvents", err.Error()) - } - - result.fn = client.listEventsNextResults - req, err := client.ListEventsPreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "ListEvents", nil, "Failure preparing request") - return - } - - resp, err := client.ListEventsSender(req) - if err != nil { - result.elr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "ListEvents", resp, "Failure sending request") - return - } - - result.elr, err = client.ListEventsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "ListEvents", resp, "Failure responding to request") - return - } - if result.elr.hasNextLink() && result.elr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListEventsPreparer prepares the ListEvents request. -func (client WebhooksClient) ListEventsPreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/listEvents", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListEventsSender sends the ListEvents request. The method will close the -// http.Response Body if it receives an error. -func (client WebhooksClient) ListEventsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListEventsResponder handles the response to the ListEvents request. The method always -// closes the http.Response Body. -func (client WebhooksClient) ListEventsResponder(resp *http.Response) (result EventListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listEventsNextResults retrieves the next set of results, if any. -func (client WebhooksClient) listEventsNextResults(ctx context.Context, lastResults EventListResult) (result EventListResult, err error) { - req, err := lastResults.eventListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "listEventsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListEventsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "listEventsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListEventsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "listEventsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListEventsComplete enumerates all values, automatically crossing page boundaries as required. -func (client WebhooksClient) ListEventsComplete(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result EventListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.ListEvents") - 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.ListEvents(ctx, resourceGroupName, registryName, webhookName) - return -} - -// Ping triggers a ping event to be sent to the webhook. -// Parameters: -// resourceGroupName - the name of the resource group to which the container registry belongs. -// registryName - the name of the container registry. -// webhookName - the name of the webhook. -func (client WebhooksClient) Ping(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result EventInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.Ping") - 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: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Ping", err.Error()) - } - - req, err := client.PingPreparer(ctx, resourceGroupName, registryName, webhookName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Ping", nil, "Failure preparing request") - return - } - - resp, err := client.PingSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Ping", resp, "Failure sending request") - return - } - - result, err = client.PingResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Ping", resp, "Failure responding to request") - return - } - - return -} - -// PingPreparer prepares the Ping request. -func (client WebhooksClient) PingPreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2019-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PingSender sends the Ping request. The method will close the -// http.Response Body if it receives an error. -func (client WebhooksClient) PingSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// PingResponder handles the response to the Ping request. The method always -// closes the http.Response Body. -func (client WebhooksClient) PingResponder(resp *http.Response) (result EventInfo, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates a webhook 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. -// webhookName - the name of the webhook. -// webhookUpdateParameters - the parameters for updating a webhook. -func (client WebhooksClient) Update(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookUpdateParameters WebhookUpdateParameters) (result WebhooksUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.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: webhookName, - Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, - {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerregistry.WebhooksClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, webhookName, webhookUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client WebhooksClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookUpdateParameters WebhookUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registryName": autorest.Encode("path", registryName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webhookName": autorest.Encode("path", webhookName), - } - - const APIVersion = "2019-05-01" - 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}/webhooks/{webhookName}", pathParameters), - autorest.WithJSON(webhookUpdateParameters), - 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 WebhooksClient) UpdateSender(req *http.Request) (future WebhooksUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client WebhooksClient) UpdateResponder(resp *http.Response) (result Webhook, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 864f8d73cc42..bd2a8421cbdf 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -47,7 +47,6 @@ github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01 github.com/Azure/azure-sdk-for-go/services/preview/automation/mgmt/2020-01-13-preview/automation github.com/Azure/azure-sdk-for-go/services/preview/blueprint/mgmt/2018-11-01-preview/blueprint github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice -github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2019-06-01-preview/containerregistry github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2021-08-01-preview/containerregistry github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders diff --git a/website/docs/r/container_registry_task_schedule_run_now.html.markdown b/website/docs/r/container_registry_task_schedule_run_now.html.markdown new file mode 100644 index 000000000000..a211194289e8 --- /dev/null +++ b/website/docs/r/container_registry_task_schedule_run_now.html.markdown @@ -0,0 +1,66 @@ +--- +subcategory: "Container" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_container_registry_task_schedule_run_now" +description: |- + Runs a Container Registry Task Schedule. +--- + +# azurerm_container_registry_task_schedule_run_now + +Runs a Container Registry Task Schedule. + +## Example Usage + +```hcl +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "example" { + name = "example-rg" + location = "West Europe" +} +resource "azurerm_container_registry" "example" { + name = "example-acr" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + sku = "Basic" +} +resource "azurerm_container_registry_task" "example" { + name = "example-task" + container_registry_id = azurerm_container_registry.example.id + platform { + os = "Linux" + } + docker_step { + dockerfile_path = "Dockerfile" + context_path = "https://github.com//acr-build-helloworld-node#main" + context_access_token = "" + image_names = ["helloworld:{{.Run.ID}}"] + } +} +resource "azurerm_container_registry_task_schedule_run_now" "example" { + container_registry_task_id = azurerm_container_registry_task.example.id +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `container_registry_task_id` - (Required) The ID of the Container Registry Task that to be scheduled. Changing this forces a new Container Registry Task Schedule to be created. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Container Registry Task Schedule. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Container Registry Task Schedule. +* `read` - (Defaults to 5 minutes) Used when retrieving the Container Registry Task Schedule. +* `delete` - (Defaults to 30 minutes) Used when deleting the Container Registry Task Schedule.