1package containerregistry 2 3// Copyright (c) Microsoft and contributors. All rights reserved. 4// 5// Licensed under the Apache License, Version 2.0 (the "License"); 6// you may not use this file except in compliance with the License. 7// You may obtain a copy of the License at 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// 14// See the License for the specific language governing permissions and 15// limitations under the License. 16// 17// Code generated by Microsoft (R) AutoRest Code Generator. 18// Changes may cause incorrect behavior and will be lost if the code is regenerated. 19 20import ( 21 "context" 22 "encoding/json" 23 "github.com/Azure/go-autorest/autorest" 24 "github.com/Azure/go-autorest/autorest/azure" 25 "github.com/Azure/go-autorest/autorest/date" 26 "github.com/Azure/go-autorest/autorest/to" 27 "github.com/Azure/go-autorest/tracing" 28 "net/http" 29) 30 31// The package's fully qualified name. 32const fqdn = "github.com/Azure/azure-sdk-for-go/services/containerregistry/mgmt/2019-06-01-preview/containerregistry" 33 34// Action enumerates the values for action. 35type Action string 36 37const ( 38 // Allow ... 39 Allow Action = "Allow" 40) 41 42// PossibleActionValues returns an array of possible values for the Action const type. 43func PossibleActionValues() []Action { 44 return []Action{Allow} 45} 46 47// Architecture enumerates the values for architecture. 48type Architecture string 49 50const ( 51 // Amd64 ... 52 Amd64 Architecture = "amd64" 53 // Arm ... 54 Arm Architecture = "arm" 55 // Arm64 ... 56 Arm64 Architecture = "arm64" 57 // ThreeEightSix ... 58 ThreeEightSix Architecture = "386" 59 // X86 ... 60 X86 Architecture = "x86" 61) 62 63// PossibleArchitectureValues returns an array of possible values for the Architecture const type. 64func PossibleArchitectureValues() []Architecture { 65 return []Architecture{Amd64, Arm, Arm64, ThreeEightSix, X86} 66} 67 68// BaseImageDependencyType enumerates the values for base image dependency type. 69type BaseImageDependencyType string 70 71const ( 72 // BuildTime ... 73 BuildTime BaseImageDependencyType = "BuildTime" 74 // RunTime ... 75 RunTime BaseImageDependencyType = "RunTime" 76) 77 78// PossibleBaseImageDependencyTypeValues returns an array of possible values for the BaseImageDependencyType const type. 79func PossibleBaseImageDependencyTypeValues() []BaseImageDependencyType { 80 return []BaseImageDependencyType{BuildTime, RunTime} 81} 82 83// BaseImageTriggerType enumerates the values for base image trigger type. 84type BaseImageTriggerType string 85 86const ( 87 // All ... 88 All BaseImageTriggerType = "All" 89 // Runtime ... 90 Runtime BaseImageTriggerType = "Runtime" 91) 92 93// PossibleBaseImageTriggerTypeValues returns an array of possible values for the BaseImageTriggerType const type. 94func PossibleBaseImageTriggerTypeValues() []BaseImageTriggerType { 95 return []BaseImageTriggerType{All, Runtime} 96} 97 98// DefaultAction enumerates the values for default action. 99type DefaultAction string 100 101const ( 102 // DefaultActionAllow ... 103 DefaultActionAllow DefaultAction = "Allow" 104 // DefaultActionDeny ... 105 DefaultActionDeny DefaultAction = "Deny" 106) 107 108// PossibleDefaultActionValues returns an array of possible values for the DefaultAction const type. 109func PossibleDefaultActionValues() []DefaultAction { 110 return []DefaultAction{DefaultActionAllow, DefaultActionDeny} 111} 112 113// ImportMode enumerates the values for import mode. 114type ImportMode string 115 116const ( 117 // Force ... 118 Force ImportMode = "Force" 119 // NoForce ... 120 NoForce ImportMode = "NoForce" 121) 122 123// PossibleImportModeValues returns an array of possible values for the ImportMode const type. 124func PossibleImportModeValues() []ImportMode { 125 return []ImportMode{Force, NoForce} 126} 127 128// OS enumerates the values for os. 129type OS string 130 131const ( 132 // Linux ... 133 Linux OS = "Linux" 134 // Windows ... 135 Windows OS = "Windows" 136) 137 138// PossibleOSValues returns an array of possible values for the OS const type. 139func PossibleOSValues() []OS { 140 return []OS{Linux, Windows} 141} 142 143// PasswordName enumerates the values for password name. 144type PasswordName string 145 146const ( 147 // Password ... 148 Password PasswordName = "password" 149 // Password2 ... 150 Password2 PasswordName = "password2" 151) 152 153// PossiblePasswordNameValues returns an array of possible values for the PasswordName const type. 154func PossiblePasswordNameValues() []PasswordName { 155 return []PasswordName{Password, Password2} 156} 157 158// PolicyStatus enumerates the values for policy status. 159type PolicyStatus string 160 161const ( 162 // Disabled ... 163 Disabled PolicyStatus = "disabled" 164 // Enabled ... 165 Enabled PolicyStatus = "enabled" 166) 167 168// PossiblePolicyStatusValues returns an array of possible values for the PolicyStatus const type. 169func PossiblePolicyStatusValues() []PolicyStatus { 170 return []PolicyStatus{Disabled, Enabled} 171} 172 173// ProvisioningState enumerates the values for provisioning state. 174type ProvisioningState string 175 176const ( 177 // Canceled ... 178 Canceled ProvisioningState = "Canceled" 179 // Creating ... 180 Creating ProvisioningState = "Creating" 181 // Deleting ... 182 Deleting ProvisioningState = "Deleting" 183 // Failed ... 184 Failed ProvisioningState = "Failed" 185 // Succeeded ... 186 Succeeded ProvisioningState = "Succeeded" 187 // Updating ... 188 Updating ProvisioningState = "Updating" 189) 190 191// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. 192func PossibleProvisioningStateValues() []ProvisioningState { 193 return []ProvisioningState{Canceled, Creating, Deleting, Failed, Succeeded, Updating} 194} 195 196// RegistryUsageUnit enumerates the values for registry usage unit. 197type RegistryUsageUnit string 198 199const ( 200 // Bytes ... 201 Bytes RegistryUsageUnit = "Bytes" 202 // Count ... 203 Count RegistryUsageUnit = "Count" 204) 205 206// PossibleRegistryUsageUnitValues returns an array of possible values for the RegistryUsageUnit const type. 207func PossibleRegistryUsageUnitValues() []RegistryUsageUnit { 208 return []RegistryUsageUnit{Bytes, Count} 209} 210 211// ResourceIdentityType enumerates the values for resource identity type. 212type ResourceIdentityType string 213 214const ( 215 // None ... 216 None ResourceIdentityType = "None" 217 // SystemAssigned ... 218 SystemAssigned ResourceIdentityType = "SystemAssigned" 219 // SystemAssignedUserAssigned ... 220 SystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" 221 // UserAssigned ... 222 UserAssigned ResourceIdentityType = "UserAssigned" 223) 224 225// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. 226func PossibleResourceIdentityTypeValues() []ResourceIdentityType { 227 return []ResourceIdentityType{None, SystemAssigned, SystemAssignedUserAssigned, UserAssigned} 228} 229 230// RunStatus enumerates the values for run status. 231type RunStatus string 232 233const ( 234 // RunStatusCanceled ... 235 RunStatusCanceled RunStatus = "Canceled" 236 // RunStatusError ... 237 RunStatusError RunStatus = "Error" 238 // RunStatusFailed ... 239 RunStatusFailed RunStatus = "Failed" 240 // RunStatusQueued ... 241 RunStatusQueued RunStatus = "Queued" 242 // RunStatusRunning ... 243 RunStatusRunning RunStatus = "Running" 244 // RunStatusStarted ... 245 RunStatusStarted RunStatus = "Started" 246 // RunStatusSucceeded ... 247 RunStatusSucceeded RunStatus = "Succeeded" 248 // RunStatusTimeout ... 249 RunStatusTimeout RunStatus = "Timeout" 250) 251 252// PossibleRunStatusValues returns an array of possible values for the RunStatus const type. 253func PossibleRunStatusValues() []RunStatus { 254 return []RunStatus{RunStatusCanceled, RunStatusError, RunStatusFailed, RunStatusQueued, RunStatusRunning, RunStatusStarted, RunStatusSucceeded, RunStatusTimeout} 255} 256 257// RunType enumerates the values for run type. 258type RunType string 259 260const ( 261 // AutoBuild ... 262 AutoBuild RunType = "AutoBuild" 263 // AutoRun ... 264 AutoRun RunType = "AutoRun" 265 // QuickBuild ... 266 QuickBuild RunType = "QuickBuild" 267 // QuickRun ... 268 QuickRun RunType = "QuickRun" 269) 270 271// PossibleRunTypeValues returns an array of possible values for the RunType const type. 272func PossibleRunTypeValues() []RunType { 273 return []RunType{AutoBuild, AutoRun, QuickBuild, QuickRun} 274} 275 276// SecretObjectType enumerates the values for secret object type. 277type SecretObjectType string 278 279const ( 280 // Opaque ... 281 Opaque SecretObjectType = "Opaque" 282 // Vaultsecret ... 283 Vaultsecret SecretObjectType = "Vaultsecret" 284) 285 286// PossibleSecretObjectTypeValues returns an array of possible values for the SecretObjectType const type. 287func PossibleSecretObjectTypeValues() []SecretObjectType { 288 return []SecretObjectType{Opaque, Vaultsecret} 289} 290 291// SkuName enumerates the values for sku name. 292type SkuName string 293 294const ( 295 // Basic ... 296 Basic SkuName = "Basic" 297 // Classic ... 298 Classic SkuName = "Classic" 299 // Premium ... 300 Premium SkuName = "Premium" 301 // Standard ... 302 Standard SkuName = "Standard" 303) 304 305// PossibleSkuNameValues returns an array of possible values for the SkuName const type. 306func PossibleSkuNameValues() []SkuName { 307 return []SkuName{Basic, Classic, Premium, Standard} 308} 309 310// SkuTier enumerates the values for sku tier. 311type SkuTier string 312 313const ( 314 // SkuTierBasic ... 315 SkuTierBasic SkuTier = "Basic" 316 // SkuTierClassic ... 317 SkuTierClassic SkuTier = "Classic" 318 // SkuTierPremium ... 319 SkuTierPremium SkuTier = "Premium" 320 // SkuTierStandard ... 321 SkuTierStandard SkuTier = "Standard" 322) 323 324// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. 325func PossibleSkuTierValues() []SkuTier { 326 return []SkuTier{SkuTierBasic, SkuTierClassic, SkuTierPremium, SkuTierStandard} 327} 328 329// SourceControlType enumerates the values for source control type. 330type SourceControlType string 331 332const ( 333 // Github ... 334 Github SourceControlType = "Github" 335 // VisualStudioTeamService ... 336 VisualStudioTeamService SourceControlType = "VisualStudioTeamService" 337) 338 339// PossibleSourceControlTypeValues returns an array of possible values for the SourceControlType const type. 340func PossibleSourceControlTypeValues() []SourceControlType { 341 return []SourceControlType{Github, VisualStudioTeamService} 342} 343 344// SourceRegistryLoginMode enumerates the values for source registry login mode. 345type SourceRegistryLoginMode string 346 347const ( 348 // SourceRegistryLoginModeDefault ... 349 SourceRegistryLoginModeDefault SourceRegistryLoginMode = "Default" 350 // SourceRegistryLoginModeNone ... 351 SourceRegistryLoginModeNone SourceRegistryLoginMode = "None" 352) 353 354// PossibleSourceRegistryLoginModeValues returns an array of possible values for the SourceRegistryLoginMode const type. 355func PossibleSourceRegistryLoginModeValues() []SourceRegistryLoginMode { 356 return []SourceRegistryLoginMode{SourceRegistryLoginModeDefault, SourceRegistryLoginModeNone} 357} 358 359// SourceTriggerEvent enumerates the values for source trigger event. 360type SourceTriggerEvent string 361 362const ( 363 // Commit ... 364 Commit SourceTriggerEvent = "commit" 365 // Pullrequest ... 366 Pullrequest SourceTriggerEvent = "pullrequest" 367) 368 369// PossibleSourceTriggerEventValues returns an array of possible values for the SourceTriggerEvent const type. 370func PossibleSourceTriggerEventValues() []SourceTriggerEvent { 371 return []SourceTriggerEvent{Commit, Pullrequest} 372} 373 374// TaskStatus enumerates the values for task status. 375type TaskStatus string 376 377const ( 378 // TaskStatusDisabled ... 379 TaskStatusDisabled TaskStatus = "Disabled" 380 // TaskStatusEnabled ... 381 TaskStatusEnabled TaskStatus = "Enabled" 382) 383 384// PossibleTaskStatusValues returns an array of possible values for the TaskStatus const type. 385func PossibleTaskStatusValues() []TaskStatus { 386 return []TaskStatus{TaskStatusDisabled, TaskStatusEnabled} 387} 388 389// TokenType enumerates the values for token type. 390type TokenType string 391 392const ( 393 // OAuth ... 394 OAuth TokenType = "OAuth" 395 // PAT ... 396 PAT TokenType = "PAT" 397) 398 399// PossibleTokenTypeValues returns an array of possible values for the TokenType const type. 400func PossibleTokenTypeValues() []TokenType { 401 return []TokenType{OAuth, PAT} 402} 403 404// TriggerStatus enumerates the values for trigger status. 405type TriggerStatus string 406 407const ( 408 // TriggerStatusDisabled ... 409 TriggerStatusDisabled TriggerStatus = "Disabled" 410 // TriggerStatusEnabled ... 411 TriggerStatusEnabled TriggerStatus = "Enabled" 412) 413 414// PossibleTriggerStatusValues returns an array of possible values for the TriggerStatus const type. 415func PossibleTriggerStatusValues() []TriggerStatus { 416 return []TriggerStatus{TriggerStatusDisabled, TriggerStatusEnabled} 417} 418 419// TrustPolicyType enumerates the values for trust policy type. 420type TrustPolicyType string 421 422const ( 423 // Notary ... 424 Notary TrustPolicyType = "Notary" 425) 426 427// PossibleTrustPolicyTypeValues returns an array of possible values for the TrustPolicyType const type. 428func PossibleTrustPolicyTypeValues() []TrustPolicyType { 429 return []TrustPolicyType{Notary} 430} 431 432// Type enumerates the values for type. 433type Type string 434 435const ( 436 // TypeDockerBuildRequest ... 437 TypeDockerBuildRequest Type = "DockerBuildRequest" 438 // TypeEncodedTaskRunRequest ... 439 TypeEncodedTaskRunRequest Type = "EncodedTaskRunRequest" 440 // TypeFileTaskRunRequest ... 441 TypeFileTaskRunRequest Type = "FileTaskRunRequest" 442 // TypeRunRequest ... 443 TypeRunRequest Type = "RunRequest" 444 // TypeTaskRunRequest ... 445 TypeTaskRunRequest Type = "TaskRunRequest" 446) 447 448// PossibleTypeValues returns an array of possible values for the Type const type. 449func PossibleTypeValues() []Type { 450 return []Type{TypeDockerBuildRequest, TypeEncodedTaskRunRequest, TypeFileTaskRunRequest, TypeRunRequest, TypeTaskRunRequest} 451} 452 453// TypeBasicTaskStepProperties enumerates the values for type basic task step properties. 454type TypeBasicTaskStepProperties string 455 456const ( 457 // TypeDocker ... 458 TypeDocker TypeBasicTaskStepProperties = "Docker" 459 // TypeEncodedTask ... 460 TypeEncodedTask TypeBasicTaskStepProperties = "EncodedTask" 461 // TypeFileTask ... 462 TypeFileTask TypeBasicTaskStepProperties = "FileTask" 463 // TypeTaskStepProperties ... 464 TypeTaskStepProperties TypeBasicTaskStepProperties = "TaskStepProperties" 465) 466 467// PossibleTypeBasicTaskStepPropertiesValues returns an array of possible values for the TypeBasicTaskStepProperties const type. 468func PossibleTypeBasicTaskStepPropertiesValues() []TypeBasicTaskStepProperties { 469 return []TypeBasicTaskStepProperties{TypeDocker, TypeEncodedTask, TypeFileTask, TypeTaskStepProperties} 470} 471 472// TypeBasicTaskStepUpdateParameters enumerates the values for type basic task step update parameters. 473type TypeBasicTaskStepUpdateParameters string 474 475const ( 476 // TypeBasicTaskStepUpdateParametersTypeDocker ... 477 TypeBasicTaskStepUpdateParametersTypeDocker TypeBasicTaskStepUpdateParameters = "Docker" 478 // TypeBasicTaskStepUpdateParametersTypeEncodedTask ... 479 TypeBasicTaskStepUpdateParametersTypeEncodedTask TypeBasicTaskStepUpdateParameters = "EncodedTask" 480 // TypeBasicTaskStepUpdateParametersTypeFileTask ... 481 TypeBasicTaskStepUpdateParametersTypeFileTask TypeBasicTaskStepUpdateParameters = "FileTask" 482 // TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters ... 483 TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters TypeBasicTaskStepUpdateParameters = "TaskStepUpdateParameters" 484) 485 486// PossibleTypeBasicTaskStepUpdateParametersValues returns an array of possible values for the TypeBasicTaskStepUpdateParameters const type. 487func PossibleTypeBasicTaskStepUpdateParametersValues() []TypeBasicTaskStepUpdateParameters { 488 return []TypeBasicTaskStepUpdateParameters{TypeBasicTaskStepUpdateParametersTypeDocker, TypeBasicTaskStepUpdateParametersTypeEncodedTask, TypeBasicTaskStepUpdateParametersTypeFileTask, TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters} 489} 490 491// UpdateTriggerPayloadType enumerates the values for update trigger payload type. 492type UpdateTriggerPayloadType string 493 494const ( 495 // Default ... 496 Default UpdateTriggerPayloadType = "Default" 497 // Token ... 498 Token UpdateTriggerPayloadType = "Token" 499) 500 501// PossibleUpdateTriggerPayloadTypeValues returns an array of possible values for the UpdateTriggerPayloadType const type. 502func PossibleUpdateTriggerPayloadTypeValues() []UpdateTriggerPayloadType { 503 return []UpdateTriggerPayloadType{Default, Token} 504} 505 506// Variant enumerates the values for variant. 507type Variant string 508 509const ( 510 // V6 ... 511 V6 Variant = "v6" 512 // V7 ... 513 V7 Variant = "v7" 514 // V8 ... 515 V8 Variant = "v8" 516) 517 518// PossibleVariantValues returns an array of possible values for the Variant const type. 519func PossibleVariantValues() []Variant { 520 return []Variant{V6, V7, V8} 521} 522 523// WebhookAction enumerates the values for webhook action. 524type WebhookAction string 525 526const ( 527 // ChartDelete ... 528 ChartDelete WebhookAction = "chart_delete" 529 // ChartPush ... 530 ChartPush WebhookAction = "chart_push" 531 // Delete ... 532 Delete WebhookAction = "delete" 533 // Push ... 534 Push WebhookAction = "push" 535 // Quarantine ... 536 Quarantine WebhookAction = "quarantine" 537) 538 539// PossibleWebhookActionValues returns an array of possible values for the WebhookAction const type. 540func PossibleWebhookActionValues() []WebhookAction { 541 return []WebhookAction{ChartDelete, ChartPush, Delete, Push, Quarantine} 542} 543 544// WebhookStatus enumerates the values for webhook status. 545type WebhookStatus string 546 547const ( 548 // WebhookStatusDisabled ... 549 WebhookStatusDisabled WebhookStatus = "disabled" 550 // WebhookStatusEnabled ... 551 WebhookStatusEnabled WebhookStatus = "enabled" 552) 553 554// PossibleWebhookStatusValues returns an array of possible values for the WebhookStatus const type. 555func PossibleWebhookStatusValues() []WebhookStatus { 556 return []WebhookStatus{WebhookStatusDisabled, WebhookStatusEnabled} 557} 558 559// Actor the agent that initiated the event. For most situations, this could be from the authorization 560// context of the request. 561type Actor struct { 562 // Name - The subject or username associated with the request context that generated the event. 563 Name *string `json:"name,omitempty"` 564} 565 566// AgentProperties the properties that determine the run agent configuration. 567type AgentProperties struct { 568 // CPU - The CPU configuration in terms of number of cores required for the run. 569 CPU *int32 `json:"cpu,omitempty"` 570} 571 572// Argument the properties of a run argument. 573type Argument struct { 574 // Name - The name of the argument. 575 Name *string `json:"name,omitempty"` 576 // Value - The value of the argument. 577 Value *string `json:"value,omitempty"` 578 // IsSecret - Flag to indicate whether the argument represents a secret and want to be removed from build logs. 579 IsSecret *bool `json:"isSecret,omitempty"` 580} 581 582// AuthInfo the authorization properties for accessing the source code repository. 583type AuthInfo struct { 584 // TokenType - The type of Auth token. Possible values include: 'PAT', 'OAuth' 585 TokenType TokenType `json:"tokenType,omitempty"` 586 // Token - The access token used to access the source control provider. 587 Token *string `json:"token,omitempty"` 588 // RefreshToken - The refresh token used to refresh the access token. 589 RefreshToken *string `json:"refreshToken,omitempty"` 590 // Scope - The scope of the access token. 591 Scope *string `json:"scope,omitempty"` 592 // ExpiresIn - Time in seconds that the token remains valid 593 ExpiresIn *int32 `json:"expiresIn,omitempty"` 594} 595 596// AuthInfoUpdateParameters the authorization properties for accessing the source code repository. 597type AuthInfoUpdateParameters struct { 598 // TokenType - The type of Auth token. Possible values include: 'PAT', 'OAuth' 599 TokenType TokenType `json:"tokenType,omitempty"` 600 // Token - The access token used to access the source control provider. 601 Token *string `json:"token,omitempty"` 602 // RefreshToken - The refresh token used to refresh the access token. 603 RefreshToken *string `json:"refreshToken,omitempty"` 604 // Scope - The scope of the access token. 605 Scope *string `json:"scope,omitempty"` 606 // ExpiresIn - Time in seconds that the token remains valid 607 ExpiresIn *int32 `json:"expiresIn,omitempty"` 608} 609 610// BaseImageDependency properties that describe a base image dependency. 611type BaseImageDependency struct { 612 // Type - The type of the base image dependency. Possible values include: 'BuildTime', 'RunTime' 613 Type BaseImageDependencyType `json:"type,omitempty"` 614 // Registry - The registry login server. 615 Registry *string `json:"registry,omitempty"` 616 // Repository - The repository name. 617 Repository *string `json:"repository,omitempty"` 618 // Tag - The tag name. 619 Tag *string `json:"tag,omitempty"` 620 // Digest - The sha256-based digest of the image manifest. 621 Digest *string `json:"digest,omitempty"` 622} 623 624// BaseImageTrigger the trigger based on base image dependency. 625type BaseImageTrigger struct { 626 // BaseImageTriggerType - The type of the auto trigger for base image dependency updates. Possible values include: 'All', 'Runtime' 627 BaseImageTriggerType BaseImageTriggerType `json:"baseImageTriggerType,omitempty"` 628 // UpdateTriggerEndpoint - The endpoint URL for receiving update triggers. 629 UpdateTriggerEndpoint *string `json:"updateTriggerEndpoint,omitempty"` 630 // UpdateTriggerPayloadType - Type of Payload body for Base image update triggers. Possible values include: 'Default', 'Token' 631 UpdateTriggerPayloadType UpdateTriggerPayloadType `json:"updateTriggerPayloadType,omitempty"` 632 // Status - The current status of trigger. Possible values include: 'TriggerStatusDisabled', 'TriggerStatusEnabled' 633 Status TriggerStatus `json:"status,omitempty"` 634 // Name - The name of the trigger. 635 Name *string `json:"name,omitempty"` 636} 637 638// BaseImageTriggerUpdateParameters the properties for updating base image dependency trigger. 639type BaseImageTriggerUpdateParameters struct { 640 // BaseImageTriggerType - The type of the auto trigger for base image dependency updates. Possible values include: 'All', 'Runtime' 641 BaseImageTriggerType BaseImageTriggerType `json:"baseImageTriggerType,omitempty"` 642 // UpdateTriggerEndpoint - The endpoint URL for receiving update triggers. 643 UpdateTriggerEndpoint *string `json:"updateTriggerEndpoint,omitempty"` 644 // UpdateTriggerPayloadType - Type of Payload body for Base image update triggers. Possible values include: 'Default', 'Token' 645 UpdateTriggerPayloadType UpdateTriggerPayloadType `json:"updateTriggerPayloadType,omitempty"` 646 // Status - The current status of trigger. Possible values include: 'TriggerStatusDisabled', 'TriggerStatusEnabled' 647 Status TriggerStatus `json:"status,omitempty"` 648 // Name - The name of the trigger. 649 Name *string `json:"name,omitempty"` 650} 651 652// CallbackConfig the configuration of service URI and custom headers for the webhook. 653type CallbackConfig struct { 654 autorest.Response `json:"-"` 655 // ServiceURI - The service URI for the webhook to post notifications. 656 ServiceURI *string `json:"serviceUri,omitempty"` 657 // CustomHeaders - Custom headers that will be added to the webhook notifications. 658 CustomHeaders map[string]*string `json:"customHeaders"` 659} 660 661// MarshalJSON is the custom marshaler for CallbackConfig. 662func (cc CallbackConfig) MarshalJSON() ([]byte, error) { 663 objectMap := make(map[string]interface{}) 664 if cc.ServiceURI != nil { 665 objectMap["serviceUri"] = cc.ServiceURI 666 } 667 if cc.CustomHeaders != nil { 668 objectMap["customHeaders"] = cc.CustomHeaders 669 } 670 return json.Marshal(objectMap) 671} 672 673// Credentials the parameters that describes a set of credentials that will be used when a run is invoked. 674type Credentials struct { 675 // SourceRegistry - Describes the credential parameters for accessing the source registry. 676 SourceRegistry *SourceRegistryCredentials `json:"sourceRegistry,omitempty"` 677 // CustomRegistries - Describes the credential parameters for accessing other custom registries. The key 678 // for the dictionary item will be the registry login server (myregistry.azurecr.io) and 679 // the value of the item will be the registry credentials for accessing the registry. 680 CustomRegistries map[string]*CustomRegistryCredentials `json:"customRegistries"` 681} 682 683// MarshalJSON is the custom marshaler for Credentials. 684func (c Credentials) MarshalJSON() ([]byte, error) { 685 objectMap := make(map[string]interface{}) 686 if c.SourceRegistry != nil { 687 objectMap["sourceRegistry"] = c.SourceRegistry 688 } 689 if c.CustomRegistries != nil { 690 objectMap["customRegistries"] = c.CustomRegistries 691 } 692 return json.Marshal(objectMap) 693} 694 695// CustomRegistryCredentials describes the credentials that will be used to access a custom registry during 696// a run. 697type CustomRegistryCredentials struct { 698 // UserName - The username for logging into the custom registry. 699 UserName *SecretObject `json:"userName,omitempty"` 700 // Password - The password for logging into the custom registry. The password is a secret 701 // object that allows multiple ways of providing the value for it. 702 Password *SecretObject `json:"password,omitempty"` 703 // Identity - Indicates the managed identity assigned to the custom credential. If a user-assigned identity 704 // this value is the Client ID. If a system-assigned identity, the value will be `system`. In 705 // the case of a system-assigned identity, the Client ID will be determined by the runner. This 706 // identity may be used to authenticate to key vault to retrieve credentials or it may be the only 707 // source of authentication used for accessing the registry. 708 Identity *string `json:"identity,omitempty"` 709} 710 711// DockerBuildRequest the parameters for a docker quick build. 712type DockerBuildRequest struct { 713 // ImageNames - The fully qualified image names including the repository and tag. 714 ImageNames *[]string `json:"imageNames,omitempty"` 715 // IsPushEnabled - The value of this property indicates whether the image built should be pushed to the registry or not. 716 IsPushEnabled *bool `json:"isPushEnabled,omitempty"` 717 // NoCache - The value of this property indicates whether the image cache is enabled or not. 718 NoCache *bool `json:"noCache,omitempty"` 719 // DockerFilePath - The Docker file path relative to the source location. 720 DockerFilePath *string `json:"dockerFilePath,omitempty"` 721 // Target - The name of the target build stage for the docker build. 722 Target *string `json:"target,omitempty"` 723 // Arguments - The collection of override arguments to be used when executing the run. 724 Arguments *[]Argument `json:"arguments,omitempty"` 725 // Timeout - Run timeout in seconds. 726 Timeout *int32 `json:"timeout,omitempty"` 727 // Platform - The platform properties against which the run has to happen. 728 Platform *PlatformProperties `json:"platform,omitempty"` 729 // AgentConfiguration - The machine configuration of the run agent. 730 AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` 731 // SourceLocation - The URL(absolute or relative) of the source context. It can be an URL to a tar or git repository. 732 // If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. 733 SourceLocation *string `json:"sourceLocation,omitempty"` 734 // Credentials - The properties that describes a set of credentials that will be used when this run is invoked. 735 Credentials *Credentials `json:"credentials,omitempty"` 736 // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. 737 IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` 738 // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' 739 Type Type `json:"type,omitempty"` 740} 741 742// MarshalJSON is the custom marshaler for DockerBuildRequest. 743func (dbr DockerBuildRequest) MarshalJSON() ([]byte, error) { 744 dbr.Type = TypeDockerBuildRequest 745 objectMap := make(map[string]interface{}) 746 if dbr.ImageNames != nil { 747 objectMap["imageNames"] = dbr.ImageNames 748 } 749 if dbr.IsPushEnabled != nil { 750 objectMap["isPushEnabled"] = dbr.IsPushEnabled 751 } 752 if dbr.NoCache != nil { 753 objectMap["noCache"] = dbr.NoCache 754 } 755 if dbr.DockerFilePath != nil { 756 objectMap["dockerFilePath"] = dbr.DockerFilePath 757 } 758 if dbr.Target != nil { 759 objectMap["target"] = dbr.Target 760 } 761 if dbr.Arguments != nil { 762 objectMap["arguments"] = dbr.Arguments 763 } 764 if dbr.Timeout != nil { 765 objectMap["timeout"] = dbr.Timeout 766 } 767 if dbr.Platform != nil { 768 objectMap["platform"] = dbr.Platform 769 } 770 if dbr.AgentConfiguration != nil { 771 objectMap["agentConfiguration"] = dbr.AgentConfiguration 772 } 773 if dbr.SourceLocation != nil { 774 objectMap["sourceLocation"] = dbr.SourceLocation 775 } 776 if dbr.Credentials != nil { 777 objectMap["credentials"] = dbr.Credentials 778 } 779 if dbr.IsArchiveEnabled != nil { 780 objectMap["isArchiveEnabled"] = dbr.IsArchiveEnabled 781 } 782 if dbr.Type != "" { 783 objectMap["type"] = dbr.Type 784 } 785 return json.Marshal(objectMap) 786} 787 788// AsDockerBuildRequest is the BasicRunRequest implementation for DockerBuildRequest. 789func (dbr DockerBuildRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { 790 return &dbr, true 791} 792 793// AsFileTaskRunRequest is the BasicRunRequest implementation for DockerBuildRequest. 794func (dbr DockerBuildRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { 795 return nil, false 796} 797 798// AsTaskRunRequest is the BasicRunRequest implementation for DockerBuildRequest. 799func (dbr DockerBuildRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { 800 return nil, false 801} 802 803// AsEncodedTaskRunRequest is the BasicRunRequest implementation for DockerBuildRequest. 804func (dbr DockerBuildRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { 805 return nil, false 806} 807 808// AsRunRequest is the BasicRunRequest implementation for DockerBuildRequest. 809func (dbr DockerBuildRequest) AsRunRequest() (*RunRequest, bool) { 810 return nil, false 811} 812 813// AsBasicRunRequest is the BasicRunRequest implementation for DockerBuildRequest. 814func (dbr DockerBuildRequest) AsBasicRunRequest() (BasicRunRequest, bool) { 815 return &dbr, true 816} 817 818// DockerBuildStep the Docker build step. 819type DockerBuildStep struct { 820 // ImageNames - The fully qualified image names including the repository and tag. 821 ImageNames *[]string `json:"imageNames,omitempty"` 822 // IsPushEnabled - The value of this property indicates whether the image built should be pushed to the registry or not. 823 IsPushEnabled *bool `json:"isPushEnabled,omitempty"` 824 // NoCache - The value of this property indicates whether the image cache is enabled or not. 825 NoCache *bool `json:"noCache,omitempty"` 826 // DockerFilePath - The Docker file path relative to the source context. 827 DockerFilePath *string `json:"dockerFilePath,omitempty"` 828 // Target - The name of the target build stage for the docker build. 829 Target *string `json:"target,omitempty"` 830 // Arguments - The collection of override arguments to be used when executing this build step. 831 Arguments *[]Argument `json:"arguments,omitempty"` 832 // BaseImageDependencies - READ-ONLY; List of base image dependencies for a step. 833 BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` 834 // ContextPath - The URL(absolute or relative) of the source context for the task step. 835 ContextPath *string `json:"contextPath,omitempty"` 836 // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. 837 ContextAccessToken *string `json:"contextAccessToken,omitempty"` 838 // Type - Possible values include: 'TypeTaskStepProperties', 'TypeDocker', 'TypeFileTask', 'TypeEncodedTask' 839 Type TypeBasicTaskStepProperties `json:"type,omitempty"` 840} 841 842// MarshalJSON is the custom marshaler for DockerBuildStep. 843func (dbs DockerBuildStep) MarshalJSON() ([]byte, error) { 844 dbs.Type = TypeDocker 845 objectMap := make(map[string]interface{}) 846 if dbs.ImageNames != nil { 847 objectMap["imageNames"] = dbs.ImageNames 848 } 849 if dbs.IsPushEnabled != nil { 850 objectMap["isPushEnabled"] = dbs.IsPushEnabled 851 } 852 if dbs.NoCache != nil { 853 objectMap["noCache"] = dbs.NoCache 854 } 855 if dbs.DockerFilePath != nil { 856 objectMap["dockerFilePath"] = dbs.DockerFilePath 857 } 858 if dbs.Target != nil { 859 objectMap["target"] = dbs.Target 860 } 861 if dbs.Arguments != nil { 862 objectMap["arguments"] = dbs.Arguments 863 } 864 if dbs.ContextPath != nil { 865 objectMap["contextPath"] = dbs.ContextPath 866 } 867 if dbs.ContextAccessToken != nil { 868 objectMap["contextAccessToken"] = dbs.ContextAccessToken 869 } 870 if dbs.Type != "" { 871 objectMap["type"] = dbs.Type 872 } 873 return json.Marshal(objectMap) 874} 875 876// AsDockerBuildStep is the BasicTaskStepProperties implementation for DockerBuildStep. 877func (dbs DockerBuildStep) AsDockerBuildStep() (*DockerBuildStep, bool) { 878 return &dbs, true 879} 880 881// AsFileTaskStep is the BasicTaskStepProperties implementation for DockerBuildStep. 882func (dbs DockerBuildStep) AsFileTaskStep() (*FileTaskStep, bool) { 883 return nil, false 884} 885 886// AsEncodedTaskStep is the BasicTaskStepProperties implementation for DockerBuildStep. 887func (dbs DockerBuildStep) AsEncodedTaskStep() (*EncodedTaskStep, bool) { 888 return nil, false 889} 890 891// AsTaskStepProperties is the BasicTaskStepProperties implementation for DockerBuildStep. 892func (dbs DockerBuildStep) AsTaskStepProperties() (*TaskStepProperties, bool) { 893 return nil, false 894} 895 896// AsBasicTaskStepProperties is the BasicTaskStepProperties implementation for DockerBuildStep. 897func (dbs DockerBuildStep) AsBasicTaskStepProperties() (BasicTaskStepProperties, bool) { 898 return &dbs, true 899} 900 901// DockerBuildStepUpdateParameters the properties for updating a docker build step. 902type DockerBuildStepUpdateParameters struct { 903 // ImageNames - The fully qualified image names including the repository and tag. 904 ImageNames *[]string `json:"imageNames,omitempty"` 905 // IsPushEnabled - The value of this property indicates whether the image built should be pushed to the registry or not. 906 IsPushEnabled *bool `json:"isPushEnabled,omitempty"` 907 // NoCache - The value of this property indicates whether the image cache is enabled or not. 908 NoCache *bool `json:"noCache,omitempty"` 909 // DockerFilePath - The Docker file path relative to the source context. 910 DockerFilePath *string `json:"dockerFilePath,omitempty"` 911 // Arguments - The collection of override arguments to be used when executing this build step. 912 Arguments *[]Argument `json:"arguments,omitempty"` 913 // Target - The name of the target build stage for the docker build. 914 Target *string `json:"target,omitempty"` 915 // ContextPath - The URL(absolute or relative) of the source context for the task step. 916 ContextPath *string `json:"contextPath,omitempty"` 917 // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. 918 ContextAccessToken *string `json:"contextAccessToken,omitempty"` 919 // Type - Possible values include: 'TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters', 'TypeBasicTaskStepUpdateParametersTypeDocker', 'TypeBasicTaskStepUpdateParametersTypeFileTask', 'TypeBasicTaskStepUpdateParametersTypeEncodedTask' 920 Type TypeBasicTaskStepUpdateParameters `json:"type,omitempty"` 921} 922 923// MarshalJSON is the custom marshaler for DockerBuildStepUpdateParameters. 924func (dbsup DockerBuildStepUpdateParameters) MarshalJSON() ([]byte, error) { 925 dbsup.Type = TypeBasicTaskStepUpdateParametersTypeDocker 926 objectMap := make(map[string]interface{}) 927 if dbsup.ImageNames != nil { 928 objectMap["imageNames"] = dbsup.ImageNames 929 } 930 if dbsup.IsPushEnabled != nil { 931 objectMap["isPushEnabled"] = dbsup.IsPushEnabled 932 } 933 if dbsup.NoCache != nil { 934 objectMap["noCache"] = dbsup.NoCache 935 } 936 if dbsup.DockerFilePath != nil { 937 objectMap["dockerFilePath"] = dbsup.DockerFilePath 938 } 939 if dbsup.Arguments != nil { 940 objectMap["arguments"] = dbsup.Arguments 941 } 942 if dbsup.Target != nil { 943 objectMap["target"] = dbsup.Target 944 } 945 if dbsup.ContextPath != nil { 946 objectMap["contextPath"] = dbsup.ContextPath 947 } 948 if dbsup.ContextAccessToken != nil { 949 objectMap["contextAccessToken"] = dbsup.ContextAccessToken 950 } 951 if dbsup.Type != "" { 952 objectMap["type"] = dbsup.Type 953 } 954 return json.Marshal(objectMap) 955} 956 957// AsDockerBuildStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. 958func (dbsup DockerBuildStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { 959 return &dbsup, true 960} 961 962// AsFileTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. 963func (dbsup DockerBuildStepUpdateParameters) AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) { 964 return nil, false 965} 966 967// AsEncodedTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. 968func (dbsup DockerBuildStepUpdateParameters) AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) { 969 return nil, false 970} 971 972// AsTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. 973func (dbsup DockerBuildStepUpdateParameters) AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) { 974 return nil, false 975} 976 977// AsBasicTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. 978func (dbsup DockerBuildStepUpdateParameters) AsBasicTaskStepUpdateParameters() (BasicTaskStepUpdateParameters, bool) { 979 return &dbsup, true 980} 981 982// EncodedTaskRunRequest the parameters for a quick task run request. 983type EncodedTaskRunRequest struct { 984 // EncodedTaskContent - Base64 encoded value of the template/definition file content. 985 EncodedTaskContent *string `json:"encodedTaskContent,omitempty"` 986 // EncodedValuesContent - Base64 encoded value of the parameters/values file content. 987 EncodedValuesContent *string `json:"encodedValuesContent,omitempty"` 988 // Values - The collection of overridable values that can be passed when running a task. 989 Values *[]SetValue `json:"values,omitempty"` 990 // Timeout - Run timeout in seconds. 991 Timeout *int32 `json:"timeout,omitempty"` 992 // Platform - The platform properties against which the run has to happen. 993 Platform *PlatformProperties `json:"platform,omitempty"` 994 // AgentConfiguration - The machine configuration of the run agent. 995 AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` 996 // SourceLocation - The URL(absolute or relative) of the source context. It can be an URL to a tar or git repository. 997 // If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. 998 SourceLocation *string `json:"sourceLocation,omitempty"` 999 // Credentials - The properties that describes a set of credentials that will be used when this run is invoked. 1000 Credentials *Credentials `json:"credentials,omitempty"` 1001 // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. 1002 IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` 1003 // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' 1004 Type Type `json:"type,omitempty"` 1005} 1006 1007// MarshalJSON is the custom marshaler for EncodedTaskRunRequest. 1008func (etrr EncodedTaskRunRequest) MarshalJSON() ([]byte, error) { 1009 etrr.Type = TypeEncodedTaskRunRequest 1010 objectMap := make(map[string]interface{}) 1011 if etrr.EncodedTaskContent != nil { 1012 objectMap["encodedTaskContent"] = etrr.EncodedTaskContent 1013 } 1014 if etrr.EncodedValuesContent != nil { 1015 objectMap["encodedValuesContent"] = etrr.EncodedValuesContent 1016 } 1017 if etrr.Values != nil { 1018 objectMap["values"] = etrr.Values 1019 } 1020 if etrr.Timeout != nil { 1021 objectMap["timeout"] = etrr.Timeout 1022 } 1023 if etrr.Platform != nil { 1024 objectMap["platform"] = etrr.Platform 1025 } 1026 if etrr.AgentConfiguration != nil { 1027 objectMap["agentConfiguration"] = etrr.AgentConfiguration 1028 } 1029 if etrr.SourceLocation != nil { 1030 objectMap["sourceLocation"] = etrr.SourceLocation 1031 } 1032 if etrr.Credentials != nil { 1033 objectMap["credentials"] = etrr.Credentials 1034 } 1035 if etrr.IsArchiveEnabled != nil { 1036 objectMap["isArchiveEnabled"] = etrr.IsArchiveEnabled 1037 } 1038 if etrr.Type != "" { 1039 objectMap["type"] = etrr.Type 1040 } 1041 return json.Marshal(objectMap) 1042} 1043 1044// AsDockerBuildRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. 1045func (etrr EncodedTaskRunRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { 1046 return nil, false 1047} 1048 1049// AsFileTaskRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. 1050func (etrr EncodedTaskRunRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { 1051 return nil, false 1052} 1053 1054// AsTaskRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. 1055func (etrr EncodedTaskRunRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { 1056 return nil, false 1057} 1058 1059// AsEncodedTaskRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. 1060func (etrr EncodedTaskRunRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { 1061 return &etrr, true 1062} 1063 1064// AsRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. 1065func (etrr EncodedTaskRunRequest) AsRunRequest() (*RunRequest, bool) { 1066 return nil, false 1067} 1068 1069// AsBasicRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. 1070func (etrr EncodedTaskRunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { 1071 return &etrr, true 1072} 1073 1074// EncodedTaskStep the properties of a encoded task step. 1075type EncodedTaskStep struct { 1076 // EncodedTaskContent - Base64 encoded value of the template/definition file content. 1077 EncodedTaskContent *string `json:"encodedTaskContent,omitempty"` 1078 // EncodedValuesContent - Base64 encoded value of the parameters/values file content. 1079 EncodedValuesContent *string `json:"encodedValuesContent,omitempty"` 1080 // Values - The collection of overridable values that can be passed when running a task. 1081 Values *[]SetValue `json:"values,omitempty"` 1082 // BaseImageDependencies - READ-ONLY; List of base image dependencies for a step. 1083 BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` 1084 // ContextPath - The URL(absolute or relative) of the source context for the task step. 1085 ContextPath *string `json:"contextPath,omitempty"` 1086 // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. 1087 ContextAccessToken *string `json:"contextAccessToken,omitempty"` 1088 // Type - Possible values include: 'TypeTaskStepProperties', 'TypeDocker', 'TypeFileTask', 'TypeEncodedTask' 1089 Type TypeBasicTaskStepProperties `json:"type,omitempty"` 1090} 1091 1092// MarshalJSON is the custom marshaler for EncodedTaskStep. 1093func (ets EncodedTaskStep) MarshalJSON() ([]byte, error) { 1094 ets.Type = TypeEncodedTask 1095 objectMap := make(map[string]interface{}) 1096 if ets.EncodedTaskContent != nil { 1097 objectMap["encodedTaskContent"] = ets.EncodedTaskContent 1098 } 1099 if ets.EncodedValuesContent != nil { 1100 objectMap["encodedValuesContent"] = ets.EncodedValuesContent 1101 } 1102 if ets.Values != nil { 1103 objectMap["values"] = ets.Values 1104 } 1105 if ets.ContextPath != nil { 1106 objectMap["contextPath"] = ets.ContextPath 1107 } 1108 if ets.ContextAccessToken != nil { 1109 objectMap["contextAccessToken"] = ets.ContextAccessToken 1110 } 1111 if ets.Type != "" { 1112 objectMap["type"] = ets.Type 1113 } 1114 return json.Marshal(objectMap) 1115} 1116 1117// AsDockerBuildStep is the BasicTaskStepProperties implementation for EncodedTaskStep. 1118func (ets EncodedTaskStep) AsDockerBuildStep() (*DockerBuildStep, bool) { 1119 return nil, false 1120} 1121 1122// AsFileTaskStep is the BasicTaskStepProperties implementation for EncodedTaskStep. 1123func (ets EncodedTaskStep) AsFileTaskStep() (*FileTaskStep, bool) { 1124 return nil, false 1125} 1126 1127// AsEncodedTaskStep is the BasicTaskStepProperties implementation for EncodedTaskStep. 1128func (ets EncodedTaskStep) AsEncodedTaskStep() (*EncodedTaskStep, bool) { 1129 return &ets, true 1130} 1131 1132// AsTaskStepProperties is the BasicTaskStepProperties implementation for EncodedTaskStep. 1133func (ets EncodedTaskStep) AsTaskStepProperties() (*TaskStepProperties, bool) { 1134 return nil, false 1135} 1136 1137// AsBasicTaskStepProperties is the BasicTaskStepProperties implementation for EncodedTaskStep. 1138func (ets EncodedTaskStep) AsBasicTaskStepProperties() (BasicTaskStepProperties, bool) { 1139 return &ets, true 1140} 1141 1142// EncodedTaskStepUpdateParameters the properties for updating encoded task step. 1143type EncodedTaskStepUpdateParameters struct { 1144 // EncodedTaskContent - Base64 encoded value of the template/definition file content. 1145 EncodedTaskContent *string `json:"encodedTaskContent,omitempty"` 1146 // EncodedValuesContent - Base64 encoded value of the parameters/values file content. 1147 EncodedValuesContent *string `json:"encodedValuesContent,omitempty"` 1148 // Values - The collection of overridable values that can be passed when running a task. 1149 Values *[]SetValue `json:"values,omitempty"` 1150 // ContextPath - The URL(absolute or relative) of the source context for the task step. 1151 ContextPath *string `json:"contextPath,omitempty"` 1152 // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. 1153 ContextAccessToken *string `json:"contextAccessToken,omitempty"` 1154 // Type - Possible values include: 'TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters', 'TypeBasicTaskStepUpdateParametersTypeDocker', 'TypeBasicTaskStepUpdateParametersTypeFileTask', 'TypeBasicTaskStepUpdateParametersTypeEncodedTask' 1155 Type TypeBasicTaskStepUpdateParameters `json:"type,omitempty"` 1156} 1157 1158// MarshalJSON is the custom marshaler for EncodedTaskStepUpdateParameters. 1159func (etsup EncodedTaskStepUpdateParameters) MarshalJSON() ([]byte, error) { 1160 etsup.Type = TypeBasicTaskStepUpdateParametersTypeEncodedTask 1161 objectMap := make(map[string]interface{}) 1162 if etsup.EncodedTaskContent != nil { 1163 objectMap["encodedTaskContent"] = etsup.EncodedTaskContent 1164 } 1165 if etsup.EncodedValuesContent != nil { 1166 objectMap["encodedValuesContent"] = etsup.EncodedValuesContent 1167 } 1168 if etsup.Values != nil { 1169 objectMap["values"] = etsup.Values 1170 } 1171 if etsup.ContextPath != nil { 1172 objectMap["contextPath"] = etsup.ContextPath 1173 } 1174 if etsup.ContextAccessToken != nil { 1175 objectMap["contextAccessToken"] = etsup.ContextAccessToken 1176 } 1177 if etsup.Type != "" { 1178 objectMap["type"] = etsup.Type 1179 } 1180 return json.Marshal(objectMap) 1181} 1182 1183// AsDockerBuildStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. 1184func (etsup EncodedTaskStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { 1185 return nil, false 1186} 1187 1188// AsFileTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. 1189func (etsup EncodedTaskStepUpdateParameters) AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) { 1190 return nil, false 1191} 1192 1193// AsEncodedTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. 1194func (etsup EncodedTaskStepUpdateParameters) AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) { 1195 return &etsup, true 1196} 1197 1198// AsTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. 1199func (etsup EncodedTaskStepUpdateParameters) AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) { 1200 return nil, false 1201} 1202 1203// AsBasicTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. 1204func (etsup EncodedTaskStepUpdateParameters) AsBasicTaskStepUpdateParameters() (BasicTaskStepUpdateParameters, bool) { 1205 return &etsup, true 1206} 1207 1208// Event the event for a webhook. 1209type Event struct { 1210 // EventRequestMessage - The event request message sent to the service URI. 1211 EventRequestMessage *EventRequestMessage `json:"eventRequestMessage,omitempty"` 1212 // EventResponseMessage - The event response message received from the service URI. 1213 EventResponseMessage *EventResponseMessage `json:"eventResponseMessage,omitempty"` 1214 // ID - The event ID. 1215 ID *string `json:"id,omitempty"` 1216} 1217 1218// EventContent the content of the event request message. 1219type EventContent struct { 1220 // ID - The event ID. 1221 ID *string `json:"id,omitempty"` 1222 // Timestamp - The time at which the event occurred. 1223 Timestamp *date.Time `json:"timestamp,omitempty"` 1224 // Action - The action that encompasses the provided event. 1225 Action *string `json:"action,omitempty"` 1226 // Target - The target of the event. 1227 Target *Target `json:"target,omitempty"` 1228 // Request - The request that generated the event. 1229 Request *Request `json:"request,omitempty"` 1230 // Actor - The agent that initiated the event. For most situations, this could be from the authorization context of the request. 1231 Actor *Actor `json:"actor,omitempty"` 1232 // Source - The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. 1233 Source *Source `json:"source,omitempty"` 1234} 1235 1236// EventInfo the basic information of an event. 1237type EventInfo struct { 1238 autorest.Response `json:"-"` 1239 // ID - The event ID. 1240 ID *string `json:"id,omitempty"` 1241} 1242 1243// EventListResult the result of a request to list events for a webhook. 1244type EventListResult struct { 1245 autorest.Response `json:"-"` 1246 // Value - The list of events. Since this list may be incomplete, the nextLink field should be used to request the next list of events. 1247 Value *[]Event `json:"value,omitempty"` 1248 // NextLink - The URI that can be used to request the next list of events. 1249 NextLink *string `json:"nextLink,omitempty"` 1250} 1251 1252// EventListResultIterator provides access to a complete listing of Event values. 1253type EventListResultIterator struct { 1254 i int 1255 page EventListResultPage 1256} 1257 1258// NextWithContext advances to the next value. If there was an error making 1259// the request the iterator does not advance and the error is returned. 1260func (iter *EventListResultIterator) NextWithContext(ctx context.Context) (err error) { 1261 if tracing.IsEnabled() { 1262 ctx = tracing.StartSpan(ctx, fqdn+"/EventListResultIterator.NextWithContext") 1263 defer func() { 1264 sc := -1 1265 if iter.Response().Response.Response != nil { 1266 sc = iter.Response().Response.Response.StatusCode 1267 } 1268 tracing.EndSpan(ctx, sc, err) 1269 }() 1270 } 1271 iter.i++ 1272 if iter.i < len(iter.page.Values()) { 1273 return nil 1274 } 1275 err = iter.page.NextWithContext(ctx) 1276 if err != nil { 1277 iter.i-- 1278 return err 1279 } 1280 iter.i = 0 1281 return nil 1282} 1283 1284// Next advances to the next value. If there was an error making 1285// the request the iterator does not advance and the error is returned. 1286// Deprecated: Use NextWithContext() instead. 1287func (iter *EventListResultIterator) Next() error { 1288 return iter.NextWithContext(context.Background()) 1289} 1290 1291// NotDone returns true if the enumeration should be started or is not yet complete. 1292func (iter EventListResultIterator) NotDone() bool { 1293 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1294} 1295 1296// Response returns the raw server response from the last page request. 1297func (iter EventListResultIterator) Response() EventListResult { 1298 return iter.page.Response() 1299} 1300 1301// Value returns the current value or a zero-initialized value if the 1302// iterator has advanced beyond the end of the collection. 1303func (iter EventListResultIterator) Value() Event { 1304 if !iter.page.NotDone() { 1305 return Event{} 1306 } 1307 return iter.page.Values()[iter.i] 1308} 1309 1310// Creates a new instance of the EventListResultIterator type. 1311func NewEventListResultIterator(page EventListResultPage) EventListResultIterator { 1312 return EventListResultIterator{page: page} 1313} 1314 1315// IsEmpty returns true if the ListResult contains no values. 1316func (elr EventListResult) IsEmpty() bool { 1317 return elr.Value == nil || len(*elr.Value) == 0 1318} 1319 1320// eventListResultPreparer prepares a request to retrieve the next set of results. 1321// It returns nil if no more results exist. 1322func (elr EventListResult) eventListResultPreparer(ctx context.Context) (*http.Request, error) { 1323 if elr.NextLink == nil || len(to.String(elr.NextLink)) < 1 { 1324 return nil, nil 1325 } 1326 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1327 autorest.AsJSON(), 1328 autorest.AsGet(), 1329 autorest.WithBaseURL(to.String(elr.NextLink))) 1330} 1331 1332// EventListResultPage contains a page of Event values. 1333type EventListResultPage struct { 1334 fn func(context.Context, EventListResult) (EventListResult, error) 1335 elr EventListResult 1336} 1337 1338// NextWithContext advances to the next page of values. If there was an error making 1339// the request the page does not advance and the error is returned. 1340func (page *EventListResultPage) NextWithContext(ctx context.Context) (err error) { 1341 if tracing.IsEnabled() { 1342 ctx = tracing.StartSpan(ctx, fqdn+"/EventListResultPage.NextWithContext") 1343 defer func() { 1344 sc := -1 1345 if page.Response().Response.Response != nil { 1346 sc = page.Response().Response.Response.StatusCode 1347 } 1348 tracing.EndSpan(ctx, sc, err) 1349 }() 1350 } 1351 next, err := page.fn(ctx, page.elr) 1352 if err != nil { 1353 return err 1354 } 1355 page.elr = next 1356 return nil 1357} 1358 1359// Next advances to the next page of values. If there was an error making 1360// the request the page does not advance and the error is returned. 1361// Deprecated: Use NextWithContext() instead. 1362func (page *EventListResultPage) Next() error { 1363 return page.NextWithContext(context.Background()) 1364} 1365 1366// NotDone returns true if the page enumeration should be started or is not yet complete. 1367func (page EventListResultPage) NotDone() bool { 1368 return !page.elr.IsEmpty() 1369} 1370 1371// Response returns the raw server response from the last page request. 1372func (page EventListResultPage) Response() EventListResult { 1373 return page.elr 1374} 1375 1376// Values returns the slice of values for the current page or nil if there are no values. 1377func (page EventListResultPage) Values() []Event { 1378 if page.elr.IsEmpty() { 1379 return nil 1380 } 1381 return *page.elr.Value 1382} 1383 1384// Creates a new instance of the EventListResultPage type. 1385func NewEventListResultPage(getNextPage func(context.Context, EventListResult) (EventListResult, error)) EventListResultPage { 1386 return EventListResultPage{fn: getNextPage} 1387} 1388 1389// EventRequestMessage the event request message sent to the service URI. 1390type EventRequestMessage struct { 1391 // Content - The content of the event request message. 1392 Content *EventContent `json:"content,omitempty"` 1393 // Headers - The headers of the event request message. 1394 Headers map[string]*string `json:"headers"` 1395 // Method - The HTTP method used to send the event request message. 1396 Method *string `json:"method,omitempty"` 1397 // RequestURI - The URI used to send the event request message. 1398 RequestURI *string `json:"requestUri,omitempty"` 1399 // Version - The HTTP message version. 1400 Version *string `json:"version,omitempty"` 1401} 1402 1403// MarshalJSON is the custom marshaler for EventRequestMessage. 1404func (erm EventRequestMessage) MarshalJSON() ([]byte, error) { 1405 objectMap := make(map[string]interface{}) 1406 if erm.Content != nil { 1407 objectMap["content"] = erm.Content 1408 } 1409 if erm.Headers != nil { 1410 objectMap["headers"] = erm.Headers 1411 } 1412 if erm.Method != nil { 1413 objectMap["method"] = erm.Method 1414 } 1415 if erm.RequestURI != nil { 1416 objectMap["requestUri"] = erm.RequestURI 1417 } 1418 if erm.Version != nil { 1419 objectMap["version"] = erm.Version 1420 } 1421 return json.Marshal(objectMap) 1422} 1423 1424// EventResponseMessage the event response message received from the service URI. 1425type EventResponseMessage struct { 1426 // Content - The content of the event response message. 1427 Content *string `json:"content,omitempty"` 1428 // Headers - The headers of the event response message. 1429 Headers map[string]*string `json:"headers"` 1430 // ReasonPhrase - The reason phrase of the event response message. 1431 ReasonPhrase *string `json:"reasonPhrase,omitempty"` 1432 // StatusCode - The status code of the event response message. 1433 StatusCode *string `json:"statusCode,omitempty"` 1434 // Version - The HTTP message version. 1435 Version *string `json:"version,omitempty"` 1436} 1437 1438// MarshalJSON is the custom marshaler for EventResponseMessage. 1439func (erm EventResponseMessage) MarshalJSON() ([]byte, error) { 1440 objectMap := make(map[string]interface{}) 1441 if erm.Content != nil { 1442 objectMap["content"] = erm.Content 1443 } 1444 if erm.Headers != nil { 1445 objectMap["headers"] = erm.Headers 1446 } 1447 if erm.ReasonPhrase != nil { 1448 objectMap["reasonPhrase"] = erm.ReasonPhrase 1449 } 1450 if erm.StatusCode != nil { 1451 objectMap["statusCode"] = erm.StatusCode 1452 } 1453 if erm.Version != nil { 1454 objectMap["version"] = erm.Version 1455 } 1456 return json.Marshal(objectMap) 1457} 1458 1459// FileTaskRunRequest the request parameters for a scheduling run against a task file. 1460type FileTaskRunRequest struct { 1461 // TaskFilePath - The template/definition file path relative to the source. 1462 TaskFilePath *string `json:"taskFilePath,omitempty"` 1463 // ValuesFilePath - The values/parameters file path relative to the source. 1464 ValuesFilePath *string `json:"valuesFilePath,omitempty"` 1465 // Values - The collection of overridable values that can be passed when running a task. 1466 Values *[]SetValue `json:"values,omitempty"` 1467 // Timeout - Run timeout in seconds. 1468 Timeout *int32 `json:"timeout,omitempty"` 1469 // Platform - The platform properties against which the run has to happen. 1470 Platform *PlatformProperties `json:"platform,omitempty"` 1471 // AgentConfiguration - The machine configuration of the run agent. 1472 AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` 1473 // SourceLocation - The URL(absolute or relative) of the source context. It can be an URL to a tar or git repository. 1474 // If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. 1475 SourceLocation *string `json:"sourceLocation,omitempty"` 1476 // Credentials - The properties that describes a set of credentials that will be used when this run is invoked. 1477 Credentials *Credentials `json:"credentials,omitempty"` 1478 // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. 1479 IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` 1480 // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' 1481 Type Type `json:"type,omitempty"` 1482} 1483 1484// MarshalJSON is the custom marshaler for FileTaskRunRequest. 1485func (ftrr FileTaskRunRequest) MarshalJSON() ([]byte, error) { 1486 ftrr.Type = TypeFileTaskRunRequest 1487 objectMap := make(map[string]interface{}) 1488 if ftrr.TaskFilePath != nil { 1489 objectMap["taskFilePath"] = ftrr.TaskFilePath 1490 } 1491 if ftrr.ValuesFilePath != nil { 1492 objectMap["valuesFilePath"] = ftrr.ValuesFilePath 1493 } 1494 if ftrr.Values != nil { 1495 objectMap["values"] = ftrr.Values 1496 } 1497 if ftrr.Timeout != nil { 1498 objectMap["timeout"] = ftrr.Timeout 1499 } 1500 if ftrr.Platform != nil { 1501 objectMap["platform"] = ftrr.Platform 1502 } 1503 if ftrr.AgentConfiguration != nil { 1504 objectMap["agentConfiguration"] = ftrr.AgentConfiguration 1505 } 1506 if ftrr.SourceLocation != nil { 1507 objectMap["sourceLocation"] = ftrr.SourceLocation 1508 } 1509 if ftrr.Credentials != nil { 1510 objectMap["credentials"] = ftrr.Credentials 1511 } 1512 if ftrr.IsArchiveEnabled != nil { 1513 objectMap["isArchiveEnabled"] = ftrr.IsArchiveEnabled 1514 } 1515 if ftrr.Type != "" { 1516 objectMap["type"] = ftrr.Type 1517 } 1518 return json.Marshal(objectMap) 1519} 1520 1521// AsDockerBuildRequest is the BasicRunRequest implementation for FileTaskRunRequest. 1522func (ftrr FileTaskRunRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { 1523 return nil, false 1524} 1525 1526// AsFileTaskRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. 1527func (ftrr FileTaskRunRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { 1528 return &ftrr, true 1529} 1530 1531// AsTaskRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. 1532func (ftrr FileTaskRunRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { 1533 return nil, false 1534} 1535 1536// AsEncodedTaskRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. 1537func (ftrr FileTaskRunRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { 1538 return nil, false 1539} 1540 1541// AsRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. 1542func (ftrr FileTaskRunRequest) AsRunRequest() (*RunRequest, bool) { 1543 return nil, false 1544} 1545 1546// AsBasicRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. 1547func (ftrr FileTaskRunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { 1548 return &ftrr, true 1549} 1550 1551// FileTaskStep the properties of a task step. 1552type FileTaskStep struct { 1553 // TaskFilePath - The task template/definition file path relative to the source context. 1554 TaskFilePath *string `json:"taskFilePath,omitempty"` 1555 // ValuesFilePath - The task values/parameters file path relative to the source context. 1556 ValuesFilePath *string `json:"valuesFilePath,omitempty"` 1557 // Values - The collection of overridable values that can be passed when running a task. 1558 Values *[]SetValue `json:"values,omitempty"` 1559 // BaseImageDependencies - READ-ONLY; List of base image dependencies for a step. 1560 BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` 1561 // ContextPath - The URL(absolute or relative) of the source context for the task step. 1562 ContextPath *string `json:"contextPath,omitempty"` 1563 // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. 1564 ContextAccessToken *string `json:"contextAccessToken,omitempty"` 1565 // Type - Possible values include: 'TypeTaskStepProperties', 'TypeDocker', 'TypeFileTask', 'TypeEncodedTask' 1566 Type TypeBasicTaskStepProperties `json:"type,omitempty"` 1567} 1568 1569// MarshalJSON is the custom marshaler for FileTaskStep. 1570func (fts FileTaskStep) MarshalJSON() ([]byte, error) { 1571 fts.Type = TypeFileTask 1572 objectMap := make(map[string]interface{}) 1573 if fts.TaskFilePath != nil { 1574 objectMap["taskFilePath"] = fts.TaskFilePath 1575 } 1576 if fts.ValuesFilePath != nil { 1577 objectMap["valuesFilePath"] = fts.ValuesFilePath 1578 } 1579 if fts.Values != nil { 1580 objectMap["values"] = fts.Values 1581 } 1582 if fts.ContextPath != nil { 1583 objectMap["contextPath"] = fts.ContextPath 1584 } 1585 if fts.ContextAccessToken != nil { 1586 objectMap["contextAccessToken"] = fts.ContextAccessToken 1587 } 1588 if fts.Type != "" { 1589 objectMap["type"] = fts.Type 1590 } 1591 return json.Marshal(objectMap) 1592} 1593 1594// AsDockerBuildStep is the BasicTaskStepProperties implementation for FileTaskStep. 1595func (fts FileTaskStep) AsDockerBuildStep() (*DockerBuildStep, bool) { 1596 return nil, false 1597} 1598 1599// AsFileTaskStep is the BasicTaskStepProperties implementation for FileTaskStep. 1600func (fts FileTaskStep) AsFileTaskStep() (*FileTaskStep, bool) { 1601 return &fts, true 1602} 1603 1604// AsEncodedTaskStep is the BasicTaskStepProperties implementation for FileTaskStep. 1605func (fts FileTaskStep) AsEncodedTaskStep() (*EncodedTaskStep, bool) { 1606 return nil, false 1607} 1608 1609// AsTaskStepProperties is the BasicTaskStepProperties implementation for FileTaskStep. 1610func (fts FileTaskStep) AsTaskStepProperties() (*TaskStepProperties, bool) { 1611 return nil, false 1612} 1613 1614// AsBasicTaskStepProperties is the BasicTaskStepProperties implementation for FileTaskStep. 1615func (fts FileTaskStep) AsBasicTaskStepProperties() (BasicTaskStepProperties, bool) { 1616 return &fts, true 1617} 1618 1619// FileTaskStepUpdateParameters the properties of updating a task step. 1620type FileTaskStepUpdateParameters struct { 1621 // TaskFilePath - The task template/definition file path relative to the source context. 1622 TaskFilePath *string `json:"taskFilePath,omitempty"` 1623 // ValuesFilePath - The values/parameters file path relative to the source context. 1624 ValuesFilePath *string `json:"valuesFilePath,omitempty"` 1625 // Values - The collection of overridable values that can be passed when running a task. 1626 Values *[]SetValue `json:"values,omitempty"` 1627 // ContextPath - The URL(absolute or relative) of the source context for the task step. 1628 ContextPath *string `json:"contextPath,omitempty"` 1629 // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. 1630 ContextAccessToken *string `json:"contextAccessToken,omitempty"` 1631 // Type - Possible values include: 'TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters', 'TypeBasicTaskStepUpdateParametersTypeDocker', 'TypeBasicTaskStepUpdateParametersTypeFileTask', 'TypeBasicTaskStepUpdateParametersTypeEncodedTask' 1632 Type TypeBasicTaskStepUpdateParameters `json:"type,omitempty"` 1633} 1634 1635// MarshalJSON is the custom marshaler for FileTaskStepUpdateParameters. 1636func (ftsup FileTaskStepUpdateParameters) MarshalJSON() ([]byte, error) { 1637 ftsup.Type = TypeBasicTaskStepUpdateParametersTypeFileTask 1638 objectMap := make(map[string]interface{}) 1639 if ftsup.TaskFilePath != nil { 1640 objectMap["taskFilePath"] = ftsup.TaskFilePath 1641 } 1642 if ftsup.ValuesFilePath != nil { 1643 objectMap["valuesFilePath"] = ftsup.ValuesFilePath 1644 } 1645 if ftsup.Values != nil { 1646 objectMap["values"] = ftsup.Values 1647 } 1648 if ftsup.ContextPath != nil { 1649 objectMap["contextPath"] = ftsup.ContextPath 1650 } 1651 if ftsup.ContextAccessToken != nil { 1652 objectMap["contextAccessToken"] = ftsup.ContextAccessToken 1653 } 1654 if ftsup.Type != "" { 1655 objectMap["type"] = ftsup.Type 1656 } 1657 return json.Marshal(objectMap) 1658} 1659 1660// AsDockerBuildStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. 1661func (ftsup FileTaskStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { 1662 return nil, false 1663} 1664 1665// AsFileTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. 1666func (ftsup FileTaskStepUpdateParameters) AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) { 1667 return &ftsup, true 1668} 1669 1670// AsEncodedTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. 1671func (ftsup FileTaskStepUpdateParameters) AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) { 1672 return nil, false 1673} 1674 1675// AsTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. 1676func (ftsup FileTaskStepUpdateParameters) AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) { 1677 return nil, false 1678} 1679 1680// AsBasicTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. 1681func (ftsup FileTaskStepUpdateParameters) AsBasicTaskStepUpdateParameters() (BasicTaskStepUpdateParameters, bool) { 1682 return &ftsup, true 1683} 1684 1685// IdentityProperties managed identity for the resource. 1686type IdentityProperties struct { 1687 // PrincipalID - The principal ID of resource identity. 1688 PrincipalID *string `json:"principalId,omitempty"` 1689 // TenantID - The tenant ID of resource. 1690 TenantID *string `json:"tenantId,omitempty"` 1691 // Type - The identity type. Possible values include: 'SystemAssigned', 'UserAssigned', 'SystemAssignedUserAssigned', 'None' 1692 Type ResourceIdentityType `json:"type,omitempty"` 1693 // UserAssignedIdentities - The list of user identities associated with the resource. The user identity 1694 // dictionary key references will be ARM resource ids in the form: 1695 // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ 1696 // providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. 1697 UserAssignedIdentities map[string]*UserIdentityProperties `json:"userAssignedIdentities"` 1698} 1699 1700// MarshalJSON is the custom marshaler for IdentityProperties. 1701func (IP IdentityProperties) MarshalJSON() ([]byte, error) { 1702 objectMap := make(map[string]interface{}) 1703 if IP.PrincipalID != nil { 1704 objectMap["principalId"] = IP.PrincipalID 1705 } 1706 if IP.TenantID != nil { 1707 objectMap["tenantId"] = IP.TenantID 1708 } 1709 if IP.Type != "" { 1710 objectMap["type"] = IP.Type 1711 } 1712 if IP.UserAssignedIdentities != nil { 1713 objectMap["userAssignedIdentities"] = IP.UserAssignedIdentities 1714 } 1715 return json.Marshal(objectMap) 1716} 1717 1718// ImageDescriptor properties for a registry image. 1719type ImageDescriptor struct { 1720 // Registry - The registry login server. 1721 Registry *string `json:"registry,omitempty"` 1722 // Repository - The repository name. 1723 Repository *string `json:"repository,omitempty"` 1724 // Tag - The tag name. 1725 Tag *string `json:"tag,omitempty"` 1726 // Digest - The sha256-based digest of the image manifest. 1727 Digest *string `json:"digest,omitempty"` 1728} 1729 1730// ImageUpdateTrigger the image update trigger that caused a build. 1731type ImageUpdateTrigger struct { 1732 // ID - The unique ID of the trigger. 1733 ID *string `json:"id,omitempty"` 1734 // Timestamp - The timestamp when the image update happened. 1735 Timestamp *date.Time `json:"timestamp,omitempty"` 1736 // Images - The list of image updates that caused the build. 1737 Images *[]ImageDescriptor `json:"images,omitempty"` 1738} 1739 1740// ImportImageParameters ... 1741type ImportImageParameters struct { 1742 // Source - The source of the image. 1743 Source *ImportSource `json:"source,omitempty"` 1744 // TargetTags - List of strings of the form repo[:tag]. When tag is omitted the source will be used (or 'latest' if source tag is also omitted). 1745 TargetTags *[]string `json:"targetTags,omitempty"` 1746 // UntaggedTargetRepositories - List of strings of repository names to do a manifest only copy. No tag will be created. 1747 UntaggedTargetRepositories *[]string `json:"untaggedTargetRepositories,omitempty"` 1748 // Mode - When Force, any existing target tags will be overwritten. When NoForce, any existing target tags will fail the operation before any copying begins. Possible values include: 'NoForce', 'Force' 1749 Mode ImportMode `json:"mode,omitempty"` 1750} 1751 1752// ImportSource ... 1753type ImportSource struct { 1754 // ResourceID - The resource identifier of the source Azure Container Registry. 1755 ResourceID *string `json:"resourceId,omitempty"` 1756 // RegistryURI - The address of the source registry (e.g. 'mcr.microsoft.com'). 1757 RegistryURI *string `json:"registryUri,omitempty"` 1758 // Credentials - Credentials used when importing from a registry uri. 1759 Credentials *ImportSourceCredentials `json:"credentials,omitempty"` 1760 // SourceImage - Repository name of the source image. 1761 // Specify an image by repository ('hello-world'). This will use the 'latest' tag. 1762 // Specify an image by tag ('hello-world:latest'). 1763 // Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). 1764 SourceImage *string `json:"sourceImage,omitempty"` 1765} 1766 1767// ImportSourceCredentials ... 1768type ImportSourceCredentials struct { 1769 // Username - The username to authenticate with the source registry. 1770 Username *string `json:"username,omitempty"` 1771 // Password - The password used to authenticate with the source registry. 1772 Password *string `json:"password,omitempty"` 1773} 1774 1775// IPRule IP rule with specific IP or IP range in CIDR format. 1776type IPRule struct { 1777 // Action - The action of IP ACL rule. Possible values include: 'Allow' 1778 Action Action `json:"action,omitempty"` 1779 // IPAddressOrRange - Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. 1780 IPAddressOrRange *string `json:"value,omitempty"` 1781} 1782 1783// NetworkRuleSet the network rule set for a container registry. 1784type NetworkRuleSet struct { 1785 // DefaultAction - The default action of allow or deny when no other rules match. Possible values include: 'DefaultActionAllow', 'DefaultActionDeny' 1786 DefaultAction DefaultAction `json:"defaultAction,omitempty"` 1787 // VirtualNetworkRules - The virtual network rules. 1788 VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` 1789 // IPRules - The IP ACL rules. 1790 IPRules *[]IPRule `json:"ipRules,omitempty"` 1791} 1792 1793// OperationDefinition the definition of a container registry operation. 1794type OperationDefinition struct { 1795 // Origin - The origin information of the container registry operation. 1796 Origin *string `json:"origin,omitempty"` 1797 // Name - Operation name: {provider}/{resource}/{operation}. 1798 Name *string `json:"name,omitempty"` 1799 // Display - The display information for the container registry operation. 1800 Display *OperationDisplayDefinition `json:"display,omitempty"` 1801 // OperationPropertiesDefinition - The properties information for the container registry operation. 1802 *OperationPropertiesDefinition `json:"properties,omitempty"` 1803} 1804 1805// MarshalJSON is the custom marshaler for OperationDefinition. 1806func (od OperationDefinition) MarshalJSON() ([]byte, error) { 1807 objectMap := make(map[string]interface{}) 1808 if od.Origin != nil { 1809 objectMap["origin"] = od.Origin 1810 } 1811 if od.Name != nil { 1812 objectMap["name"] = od.Name 1813 } 1814 if od.Display != nil { 1815 objectMap["display"] = od.Display 1816 } 1817 if od.OperationPropertiesDefinition != nil { 1818 objectMap["properties"] = od.OperationPropertiesDefinition 1819 } 1820 return json.Marshal(objectMap) 1821} 1822 1823// UnmarshalJSON is the custom unmarshaler for OperationDefinition struct. 1824func (od *OperationDefinition) UnmarshalJSON(body []byte) error { 1825 var m map[string]*json.RawMessage 1826 err := json.Unmarshal(body, &m) 1827 if err != nil { 1828 return err 1829 } 1830 for k, v := range m { 1831 switch k { 1832 case "origin": 1833 if v != nil { 1834 var origin string 1835 err = json.Unmarshal(*v, &origin) 1836 if err != nil { 1837 return err 1838 } 1839 od.Origin = &origin 1840 } 1841 case "name": 1842 if v != nil { 1843 var name string 1844 err = json.Unmarshal(*v, &name) 1845 if err != nil { 1846 return err 1847 } 1848 od.Name = &name 1849 } 1850 case "display": 1851 if v != nil { 1852 var display OperationDisplayDefinition 1853 err = json.Unmarshal(*v, &display) 1854 if err != nil { 1855 return err 1856 } 1857 od.Display = &display 1858 } 1859 case "properties": 1860 if v != nil { 1861 var operationPropertiesDefinition OperationPropertiesDefinition 1862 err = json.Unmarshal(*v, &operationPropertiesDefinition) 1863 if err != nil { 1864 return err 1865 } 1866 od.OperationPropertiesDefinition = &operationPropertiesDefinition 1867 } 1868 } 1869 } 1870 1871 return nil 1872} 1873 1874// OperationDisplayDefinition the display information for a container registry operation. 1875type OperationDisplayDefinition struct { 1876 // Provider - The resource provider name: Microsoft.ContainerRegistry. 1877 Provider *string `json:"provider,omitempty"` 1878 // Resource - The resource on which the operation is performed. 1879 Resource *string `json:"resource,omitempty"` 1880 // Operation - The operation that users can perform. 1881 Operation *string `json:"operation,omitempty"` 1882 // Description - The description for the operation. 1883 Description *string `json:"description,omitempty"` 1884} 1885 1886// OperationListResult the result of a request to list container registry operations. 1887type OperationListResult struct { 1888 autorest.Response `json:"-"` 1889 // Value - The list of container registry operations. Since this list may be incomplete, the nextLink field should be used to request the next list of operations. 1890 Value *[]OperationDefinition `json:"value,omitempty"` 1891 // NextLink - The URI that can be used to request the next list of container registry operations. 1892 NextLink *string `json:"nextLink,omitempty"` 1893} 1894 1895// OperationListResultIterator provides access to a complete listing of OperationDefinition values. 1896type OperationListResultIterator struct { 1897 i int 1898 page OperationListResultPage 1899} 1900 1901// NextWithContext advances to the next value. If there was an error making 1902// the request the iterator does not advance and the error is returned. 1903func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { 1904 if tracing.IsEnabled() { 1905 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") 1906 defer func() { 1907 sc := -1 1908 if iter.Response().Response.Response != nil { 1909 sc = iter.Response().Response.Response.StatusCode 1910 } 1911 tracing.EndSpan(ctx, sc, err) 1912 }() 1913 } 1914 iter.i++ 1915 if iter.i < len(iter.page.Values()) { 1916 return nil 1917 } 1918 err = iter.page.NextWithContext(ctx) 1919 if err != nil { 1920 iter.i-- 1921 return err 1922 } 1923 iter.i = 0 1924 return nil 1925} 1926 1927// Next advances to the next value. If there was an error making 1928// the request the iterator does not advance and the error is returned. 1929// Deprecated: Use NextWithContext() instead. 1930func (iter *OperationListResultIterator) Next() error { 1931 return iter.NextWithContext(context.Background()) 1932} 1933 1934// NotDone returns true if the enumeration should be started or is not yet complete. 1935func (iter OperationListResultIterator) NotDone() bool { 1936 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1937} 1938 1939// Response returns the raw server response from the last page request. 1940func (iter OperationListResultIterator) Response() OperationListResult { 1941 return iter.page.Response() 1942} 1943 1944// Value returns the current value or a zero-initialized value if the 1945// iterator has advanced beyond the end of the collection. 1946func (iter OperationListResultIterator) Value() OperationDefinition { 1947 if !iter.page.NotDone() { 1948 return OperationDefinition{} 1949 } 1950 return iter.page.Values()[iter.i] 1951} 1952 1953// Creates a new instance of the OperationListResultIterator type. 1954func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { 1955 return OperationListResultIterator{page: page} 1956} 1957 1958// IsEmpty returns true if the ListResult contains no values. 1959func (olr OperationListResult) IsEmpty() bool { 1960 return olr.Value == nil || len(*olr.Value) == 0 1961} 1962 1963// operationListResultPreparer prepares a request to retrieve the next set of results. 1964// It returns nil if no more results exist. 1965func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { 1966 if olr.NextLink == nil || len(to.String(olr.NextLink)) < 1 { 1967 return nil, nil 1968 } 1969 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1970 autorest.AsJSON(), 1971 autorest.AsGet(), 1972 autorest.WithBaseURL(to.String(olr.NextLink))) 1973} 1974 1975// OperationListResultPage contains a page of OperationDefinition values. 1976type OperationListResultPage struct { 1977 fn func(context.Context, OperationListResult) (OperationListResult, error) 1978 olr OperationListResult 1979} 1980 1981// NextWithContext advances to the next page of values. If there was an error making 1982// the request the page does not advance and the error is returned. 1983func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { 1984 if tracing.IsEnabled() { 1985 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") 1986 defer func() { 1987 sc := -1 1988 if page.Response().Response.Response != nil { 1989 sc = page.Response().Response.Response.StatusCode 1990 } 1991 tracing.EndSpan(ctx, sc, err) 1992 }() 1993 } 1994 next, err := page.fn(ctx, page.olr) 1995 if err != nil { 1996 return err 1997 } 1998 page.olr = next 1999 return nil 2000} 2001 2002// Next advances to the next page of values. If there was an error making 2003// the request the page does not advance and the error is returned. 2004// Deprecated: Use NextWithContext() instead. 2005func (page *OperationListResultPage) Next() error { 2006 return page.NextWithContext(context.Background()) 2007} 2008 2009// NotDone returns true if the page enumeration should be started or is not yet complete. 2010func (page OperationListResultPage) NotDone() bool { 2011 return !page.olr.IsEmpty() 2012} 2013 2014// Response returns the raw server response from the last page request. 2015func (page OperationListResultPage) Response() OperationListResult { 2016 return page.olr 2017} 2018 2019// Values returns the slice of values for the current page or nil if there are no values. 2020func (page OperationListResultPage) Values() []OperationDefinition { 2021 if page.olr.IsEmpty() { 2022 return nil 2023 } 2024 return *page.olr.Value 2025} 2026 2027// Creates a new instance of the OperationListResultPage type. 2028func NewOperationListResultPage(getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { 2029 return OperationListResultPage{fn: getNextPage} 2030} 2031 2032// OperationMetricSpecificationDefinition the definition of Azure Monitoring metric. 2033type OperationMetricSpecificationDefinition struct { 2034 // Name - Metric name. 2035 Name *string `json:"name,omitempty"` 2036 // DisplayName - Metric display name. 2037 DisplayName *string `json:"displayName,omitempty"` 2038 // DisplayDescription - Metric description. 2039 DisplayDescription *string `json:"displayDescription,omitempty"` 2040 // Unit - Metric unit. 2041 Unit *string `json:"unit,omitempty"` 2042 // AggregationType - Metric aggregation type. 2043 AggregationType *string `json:"aggregationType,omitempty"` 2044 // InternalMetricName - Internal metric name. 2045 InternalMetricName *string `json:"internalMetricName,omitempty"` 2046} 2047 2048// OperationPropertiesDefinition the definition of Azure Monitoring properties. 2049type OperationPropertiesDefinition struct { 2050 // ServiceSpecification - The definition of Azure Monitoring service. 2051 ServiceSpecification *OperationServiceSpecificationDefinition `json:"serviceSpecification,omitempty"` 2052} 2053 2054// OperationServiceSpecificationDefinition the definition of Azure Monitoring metrics list. 2055type OperationServiceSpecificationDefinition struct { 2056 // MetricSpecifications - A list of Azure Monitoring metrics definition. 2057 MetricSpecifications *[]OperationMetricSpecificationDefinition `json:"metricSpecifications,omitempty"` 2058} 2059 2060// OverrideTaskStepProperties ... 2061type OverrideTaskStepProperties struct { 2062 // ContextPath - The source context against which run has to be queued. 2063 ContextPath *string `json:"contextPath,omitempty"` 2064 // File - The file against which run has to be queued. 2065 File *string `json:"file,omitempty"` 2066 // Arguments - Gets or sets the collection of override arguments to be used when 2067 // executing a build step. 2068 Arguments *[]Argument `json:"arguments,omitempty"` 2069 // Target - The name of the target build stage for the docker build. 2070 Target *string `json:"target,omitempty"` 2071 // Values - The collection of overridable values that can be passed when running a Task. 2072 Values *[]SetValue `json:"values,omitempty"` 2073 // UpdateTriggerToken - Base64 encoded update trigger token that will be attached with the base image trigger webhook. 2074 UpdateTriggerToken *string `json:"updateTriggerToken,omitempty"` 2075} 2076 2077// PlatformProperties the platform properties against which the run has to happen. 2078type PlatformProperties struct { 2079 // Os - The operating system type required for the run. Possible values include: 'Windows', 'Linux' 2080 Os OS `json:"os,omitempty"` 2081 // Architecture - The OS architecture. Possible values include: 'Amd64', 'X86', 'ThreeEightSix', 'Arm', 'Arm64' 2082 Architecture Architecture `json:"architecture,omitempty"` 2083 // Variant - Variant of the CPU. Possible values include: 'V6', 'V7', 'V8' 2084 Variant Variant `json:"variant,omitempty"` 2085} 2086 2087// PlatformUpdateParameters the properties for updating the platform configuration. 2088type PlatformUpdateParameters struct { 2089 // Os - The operating system type required for the run. Possible values include: 'Windows', 'Linux' 2090 Os OS `json:"os,omitempty"` 2091 // Architecture - The OS architecture. Possible values include: 'Amd64', 'X86', 'ThreeEightSix', 'Arm', 'Arm64' 2092 Architecture Architecture `json:"architecture,omitempty"` 2093 // Variant - Variant of the CPU. Possible values include: 'V6', 'V7', 'V8' 2094 Variant Variant `json:"variant,omitempty"` 2095} 2096 2097// Policies the policies for a container registry. 2098type Policies struct { 2099 // QuarantinePolicy - The quarantine policy for a container registry. 2100 QuarantinePolicy *QuarantinePolicy `json:"quarantinePolicy,omitempty"` 2101 // TrustPolicy - The content trust policy for a container registry. 2102 TrustPolicy *TrustPolicy `json:"trustPolicy,omitempty"` 2103 // RetentionPolicy - The retention policy for a container registry. 2104 RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` 2105} 2106 2107// ProxyResource the resource model definition for a ARM proxy resource. It will have everything other than 2108// required location and tags. 2109type ProxyResource struct { 2110 // ID - READ-ONLY; The resource ID. 2111 ID *string `json:"id,omitempty"` 2112 // Name - READ-ONLY; The name of the resource. 2113 Name *string `json:"name,omitempty"` 2114 // Type - READ-ONLY; The type of the resource. 2115 Type *string `json:"type,omitempty"` 2116} 2117 2118// QuarantinePolicy the quarantine policy for a container registry. 2119type QuarantinePolicy struct { 2120 // Status - The value that indicates whether the policy is enabled or not. Possible values include: 'Enabled', 'Disabled' 2121 Status PolicyStatus `json:"status,omitempty"` 2122} 2123 2124// RegenerateCredentialParameters the parameters used to regenerate the login credential. 2125type RegenerateCredentialParameters struct { 2126 // Name - Specifies name of the password which should be regenerated -- password or password2. Possible values include: 'Password', 'Password2' 2127 Name PasswordName `json:"name,omitempty"` 2128} 2129 2130// RegistriesCreateFuture an abstraction for monitoring and retrieving the results of a long-running 2131// operation. 2132type RegistriesCreateFuture struct { 2133 azure.Future 2134} 2135 2136// Result returns the result of the asynchronous operation. 2137// If the operation has not completed it will return an error. 2138func (future *RegistriesCreateFuture) Result(client RegistriesClient) (r Registry, err error) { 2139 var done bool 2140 done, err = future.DoneWithContext(context.Background(), client) 2141 if err != nil { 2142 err = autorest.NewErrorWithError(err, "containerregistry.RegistriesCreateFuture", "Result", future.Response(), "Polling failure") 2143 return 2144 } 2145 if !done { 2146 err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesCreateFuture") 2147 return 2148 } 2149 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2150 if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent { 2151 r, err = client.CreateResponder(r.Response.Response) 2152 if err != nil { 2153 err = autorest.NewErrorWithError(err, "containerregistry.RegistriesCreateFuture", "Result", r.Response.Response, "Failure responding to request") 2154 } 2155 } 2156 return 2157} 2158 2159// RegistriesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 2160// operation. 2161type RegistriesDeleteFuture struct { 2162 azure.Future 2163} 2164 2165// Result returns the result of the asynchronous operation. 2166// If the operation has not completed it will return an error. 2167func (future *RegistriesDeleteFuture) Result(client RegistriesClient) (ar autorest.Response, err error) { 2168 var done bool 2169 done, err = future.DoneWithContext(context.Background(), client) 2170 if err != nil { 2171 err = autorest.NewErrorWithError(err, "containerregistry.RegistriesDeleteFuture", "Result", future.Response(), "Polling failure") 2172 return 2173 } 2174 if !done { 2175 err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesDeleteFuture") 2176 return 2177 } 2178 ar.Response = future.Response() 2179 return 2180} 2181 2182// RegistriesImportImageFuture an abstraction for monitoring and retrieving the results of a long-running 2183// operation. 2184type RegistriesImportImageFuture struct { 2185 azure.Future 2186} 2187 2188// Result returns the result of the asynchronous operation. 2189// If the operation has not completed it will return an error. 2190func (future *RegistriesImportImageFuture) Result(client RegistriesClient) (ar autorest.Response, err error) { 2191 var done bool 2192 done, err = future.DoneWithContext(context.Background(), client) 2193 if err != nil { 2194 err = autorest.NewErrorWithError(err, "containerregistry.RegistriesImportImageFuture", "Result", future.Response(), "Polling failure") 2195 return 2196 } 2197 if !done { 2198 err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesImportImageFuture") 2199 return 2200 } 2201 ar.Response = future.Response() 2202 return 2203} 2204 2205// RegistriesScheduleRunFuture an abstraction for monitoring and retrieving the results of a long-running 2206// operation. 2207type RegistriesScheduleRunFuture struct { 2208 azure.Future 2209} 2210 2211// Result returns the result of the asynchronous operation. 2212// If the operation has not completed it will return an error. 2213func (future *RegistriesScheduleRunFuture) Result(client RegistriesClient) (r Run, err error) { 2214 var done bool 2215 done, err = future.DoneWithContext(context.Background(), client) 2216 if err != nil { 2217 err = autorest.NewErrorWithError(err, "containerregistry.RegistriesScheduleRunFuture", "Result", future.Response(), "Polling failure") 2218 return 2219 } 2220 if !done { 2221 err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesScheduleRunFuture") 2222 return 2223 } 2224 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2225 if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent { 2226 r, err = client.ScheduleRunResponder(r.Response.Response) 2227 if err != nil { 2228 err = autorest.NewErrorWithError(err, "containerregistry.RegistriesScheduleRunFuture", "Result", r.Response.Response, "Failure responding to request") 2229 } 2230 } 2231 return 2232} 2233 2234// RegistriesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 2235// operation. 2236type RegistriesUpdateFuture struct { 2237 azure.Future 2238} 2239 2240// Result returns the result of the asynchronous operation. 2241// If the operation has not completed it will return an error. 2242func (future *RegistriesUpdateFuture) Result(client RegistriesClient) (r Registry, err error) { 2243 var done bool 2244 done, err = future.DoneWithContext(context.Background(), client) 2245 if err != nil { 2246 err = autorest.NewErrorWithError(err, "containerregistry.RegistriesUpdateFuture", "Result", future.Response(), "Polling failure") 2247 return 2248 } 2249 if !done { 2250 err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesUpdateFuture") 2251 return 2252 } 2253 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2254 if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent { 2255 r, err = client.UpdateResponder(r.Response.Response) 2256 if err != nil { 2257 err = autorest.NewErrorWithError(err, "containerregistry.RegistriesUpdateFuture", "Result", r.Response.Response, "Failure responding to request") 2258 } 2259 } 2260 return 2261} 2262 2263// Registry an object that represents a container registry. 2264type Registry struct { 2265 autorest.Response `json:"-"` 2266 // Sku - The SKU of the container registry. 2267 Sku *Sku `json:"sku,omitempty"` 2268 // RegistryProperties - The properties of the container registry. 2269 *RegistryProperties `json:"properties,omitempty"` 2270 // ID - READ-ONLY; The resource ID. 2271 ID *string `json:"id,omitempty"` 2272 // Name - READ-ONLY; The name of the resource. 2273 Name *string `json:"name,omitempty"` 2274 // Type - READ-ONLY; The type of the resource. 2275 Type *string `json:"type,omitempty"` 2276 // Location - The location of the resource. This cannot be changed after the resource is created. 2277 Location *string `json:"location,omitempty"` 2278 // Tags - The tags of the resource. 2279 Tags map[string]*string `json:"tags"` 2280} 2281 2282// MarshalJSON is the custom marshaler for Registry. 2283func (r Registry) MarshalJSON() ([]byte, error) { 2284 objectMap := make(map[string]interface{}) 2285 if r.Sku != nil { 2286 objectMap["sku"] = r.Sku 2287 } 2288 if r.RegistryProperties != nil { 2289 objectMap["properties"] = r.RegistryProperties 2290 } 2291 if r.Location != nil { 2292 objectMap["location"] = r.Location 2293 } 2294 if r.Tags != nil { 2295 objectMap["tags"] = r.Tags 2296 } 2297 return json.Marshal(objectMap) 2298} 2299 2300// UnmarshalJSON is the custom unmarshaler for Registry struct. 2301func (r *Registry) UnmarshalJSON(body []byte) error { 2302 var m map[string]*json.RawMessage 2303 err := json.Unmarshal(body, &m) 2304 if err != nil { 2305 return err 2306 } 2307 for k, v := range m { 2308 switch k { 2309 case "sku": 2310 if v != nil { 2311 var sku Sku 2312 err = json.Unmarshal(*v, &sku) 2313 if err != nil { 2314 return err 2315 } 2316 r.Sku = &sku 2317 } 2318 case "properties": 2319 if v != nil { 2320 var registryProperties RegistryProperties 2321 err = json.Unmarshal(*v, ®istryProperties) 2322 if err != nil { 2323 return err 2324 } 2325 r.RegistryProperties = ®istryProperties 2326 } 2327 case "id": 2328 if v != nil { 2329 var ID string 2330 err = json.Unmarshal(*v, &ID) 2331 if err != nil { 2332 return err 2333 } 2334 r.ID = &ID 2335 } 2336 case "name": 2337 if v != nil { 2338 var name string 2339 err = json.Unmarshal(*v, &name) 2340 if err != nil { 2341 return err 2342 } 2343 r.Name = &name 2344 } 2345 case "type": 2346 if v != nil { 2347 var typeVar string 2348 err = json.Unmarshal(*v, &typeVar) 2349 if err != nil { 2350 return err 2351 } 2352 r.Type = &typeVar 2353 } 2354 case "location": 2355 if v != nil { 2356 var location string 2357 err = json.Unmarshal(*v, &location) 2358 if err != nil { 2359 return err 2360 } 2361 r.Location = &location 2362 } 2363 case "tags": 2364 if v != nil { 2365 var tags map[string]*string 2366 err = json.Unmarshal(*v, &tags) 2367 if err != nil { 2368 return err 2369 } 2370 r.Tags = tags 2371 } 2372 } 2373 } 2374 2375 return nil 2376} 2377 2378// RegistryListCredentialsResult the response from the ListCredentials operation. 2379type RegistryListCredentialsResult struct { 2380 autorest.Response `json:"-"` 2381 // Username - The username for a container registry. 2382 Username *string `json:"username,omitempty"` 2383 // Passwords - The list of passwords for a container registry. 2384 Passwords *[]RegistryPassword `json:"passwords,omitempty"` 2385} 2386 2387// RegistryListResult the result of a request to list container registries. 2388type RegistryListResult struct { 2389 autorest.Response `json:"-"` 2390 // Value - The list of container registries. Since this list may be incomplete, the nextLink field should be used to request the next list of container registries. 2391 Value *[]Registry `json:"value,omitempty"` 2392 // NextLink - The URI that can be used to request the next list of container registries. 2393 NextLink *string `json:"nextLink,omitempty"` 2394} 2395 2396// RegistryListResultIterator provides access to a complete listing of Registry values. 2397type RegistryListResultIterator struct { 2398 i int 2399 page RegistryListResultPage 2400} 2401 2402// NextWithContext advances to the next value. If there was an error making 2403// the request the iterator does not advance and the error is returned. 2404func (iter *RegistryListResultIterator) NextWithContext(ctx context.Context) (err error) { 2405 if tracing.IsEnabled() { 2406 ctx = tracing.StartSpan(ctx, fqdn+"/RegistryListResultIterator.NextWithContext") 2407 defer func() { 2408 sc := -1 2409 if iter.Response().Response.Response != nil { 2410 sc = iter.Response().Response.Response.StatusCode 2411 } 2412 tracing.EndSpan(ctx, sc, err) 2413 }() 2414 } 2415 iter.i++ 2416 if iter.i < len(iter.page.Values()) { 2417 return nil 2418 } 2419 err = iter.page.NextWithContext(ctx) 2420 if err != nil { 2421 iter.i-- 2422 return err 2423 } 2424 iter.i = 0 2425 return nil 2426} 2427 2428// Next advances to the next value. If there was an error making 2429// the request the iterator does not advance and the error is returned. 2430// Deprecated: Use NextWithContext() instead. 2431func (iter *RegistryListResultIterator) Next() error { 2432 return iter.NextWithContext(context.Background()) 2433} 2434 2435// NotDone returns true if the enumeration should be started or is not yet complete. 2436func (iter RegistryListResultIterator) NotDone() bool { 2437 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2438} 2439 2440// Response returns the raw server response from the last page request. 2441func (iter RegistryListResultIterator) Response() RegistryListResult { 2442 return iter.page.Response() 2443} 2444 2445// Value returns the current value or a zero-initialized value if the 2446// iterator has advanced beyond the end of the collection. 2447func (iter RegistryListResultIterator) Value() Registry { 2448 if !iter.page.NotDone() { 2449 return Registry{} 2450 } 2451 return iter.page.Values()[iter.i] 2452} 2453 2454// Creates a new instance of the RegistryListResultIterator type. 2455func NewRegistryListResultIterator(page RegistryListResultPage) RegistryListResultIterator { 2456 return RegistryListResultIterator{page: page} 2457} 2458 2459// IsEmpty returns true if the ListResult contains no values. 2460func (rlr RegistryListResult) IsEmpty() bool { 2461 return rlr.Value == nil || len(*rlr.Value) == 0 2462} 2463 2464// registryListResultPreparer prepares a request to retrieve the next set of results. 2465// It returns nil if no more results exist. 2466func (rlr RegistryListResult) registryListResultPreparer(ctx context.Context) (*http.Request, error) { 2467 if rlr.NextLink == nil || len(to.String(rlr.NextLink)) < 1 { 2468 return nil, nil 2469 } 2470 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2471 autorest.AsJSON(), 2472 autorest.AsGet(), 2473 autorest.WithBaseURL(to.String(rlr.NextLink))) 2474} 2475 2476// RegistryListResultPage contains a page of Registry values. 2477type RegistryListResultPage struct { 2478 fn func(context.Context, RegistryListResult) (RegistryListResult, error) 2479 rlr RegistryListResult 2480} 2481 2482// NextWithContext advances to the next page of values. If there was an error making 2483// the request the page does not advance and the error is returned. 2484func (page *RegistryListResultPage) NextWithContext(ctx context.Context) (err error) { 2485 if tracing.IsEnabled() { 2486 ctx = tracing.StartSpan(ctx, fqdn+"/RegistryListResultPage.NextWithContext") 2487 defer func() { 2488 sc := -1 2489 if page.Response().Response.Response != nil { 2490 sc = page.Response().Response.Response.StatusCode 2491 } 2492 tracing.EndSpan(ctx, sc, err) 2493 }() 2494 } 2495 next, err := page.fn(ctx, page.rlr) 2496 if err != nil { 2497 return err 2498 } 2499 page.rlr = next 2500 return nil 2501} 2502 2503// Next advances to the next page of values. If there was an error making 2504// the request the page does not advance and the error is returned. 2505// Deprecated: Use NextWithContext() instead. 2506func (page *RegistryListResultPage) Next() error { 2507 return page.NextWithContext(context.Background()) 2508} 2509 2510// NotDone returns true if the page enumeration should be started or is not yet complete. 2511func (page RegistryListResultPage) NotDone() bool { 2512 return !page.rlr.IsEmpty() 2513} 2514 2515// Response returns the raw server response from the last page request. 2516func (page RegistryListResultPage) Response() RegistryListResult { 2517 return page.rlr 2518} 2519 2520// Values returns the slice of values for the current page or nil if there are no values. 2521func (page RegistryListResultPage) Values() []Registry { 2522 if page.rlr.IsEmpty() { 2523 return nil 2524 } 2525 return *page.rlr.Value 2526} 2527 2528// Creates a new instance of the RegistryListResultPage type. 2529func NewRegistryListResultPage(getNextPage func(context.Context, RegistryListResult) (RegistryListResult, error)) RegistryListResultPage { 2530 return RegistryListResultPage{fn: getNextPage} 2531} 2532 2533// RegistryNameCheckRequest a request to check whether a container registry name is available. 2534type RegistryNameCheckRequest struct { 2535 // Name - The name of the container registry. 2536 Name *string `json:"name,omitempty"` 2537 // Type - The resource type of the container registry. This field must be set to 'Microsoft.ContainerRegistry/registries'. 2538 Type *string `json:"type,omitempty"` 2539} 2540 2541// RegistryNameStatus the result of a request to check the availability of a container registry name. 2542type RegistryNameStatus struct { 2543 autorest.Response `json:"-"` 2544 // NameAvailable - The value that indicates whether the name is available. 2545 NameAvailable *bool `json:"nameAvailable,omitempty"` 2546 // Reason - If any, the reason that the name is not available. 2547 Reason *string `json:"reason,omitempty"` 2548 // Message - If any, the error message that provides more detail for the reason that the name is not available. 2549 Message *string `json:"message,omitempty"` 2550} 2551 2552// RegistryPassword the login password for the container registry. 2553type RegistryPassword struct { 2554 // Name - The password name. Possible values include: 'Password', 'Password2' 2555 Name PasswordName `json:"name,omitempty"` 2556 // Value - The password value. 2557 Value *string `json:"value,omitempty"` 2558} 2559 2560// RegistryProperties the properties of a container registry. 2561type RegistryProperties struct { 2562 // LoginServer - READ-ONLY; The URL that can be used to log into the container registry. 2563 LoginServer *string `json:"loginServer,omitempty"` 2564 // CreationDate - READ-ONLY; The creation date of the container registry in ISO8601 format. 2565 CreationDate *date.Time `json:"creationDate,omitempty"` 2566 // ProvisioningState - READ-ONLY; The provisioning state of the container registry at the time the operation was called. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' 2567 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 2568 // Status - READ-ONLY; The status of the container registry at the time the operation was called. 2569 Status *Status `json:"status,omitempty"` 2570 // AdminUserEnabled - The value that indicates whether the admin user is enabled. 2571 AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"` 2572 // StorageAccount - The properties of the storage account for the container registry. Only applicable to Classic SKU. 2573 StorageAccount *StorageAccountProperties `json:"storageAccount,omitempty"` 2574 // NetworkRuleSet - The network rule set for a container registry. 2575 NetworkRuleSet *NetworkRuleSet `json:"networkRuleSet,omitempty"` 2576 // Policies - The policies for a container registry. 2577 Policies *Policies `json:"policies,omitempty"` 2578} 2579 2580// RegistryPropertiesUpdateParameters the parameters for updating the properties of a container registry. 2581type RegistryPropertiesUpdateParameters struct { 2582 // AdminUserEnabled - The value that indicates whether the admin user is enabled. 2583 AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"` 2584 // NetworkRuleSet - The network rule set for a container registry. 2585 NetworkRuleSet *NetworkRuleSet `json:"networkRuleSet,omitempty"` 2586 // Policies - The policies for a container registry. 2587 Policies *Policies `json:"policies,omitempty"` 2588} 2589 2590// RegistryUpdateParameters the parameters for updating a container registry. 2591type RegistryUpdateParameters struct { 2592 // Tags - The tags for the container registry. 2593 Tags map[string]*string `json:"tags"` 2594 // Sku - The SKU of the container registry. 2595 Sku *Sku `json:"sku,omitempty"` 2596 // RegistryPropertiesUpdateParameters - The properties that the container registry will be updated with. 2597 *RegistryPropertiesUpdateParameters `json:"properties,omitempty"` 2598} 2599 2600// MarshalJSON is the custom marshaler for RegistryUpdateParameters. 2601func (rup RegistryUpdateParameters) MarshalJSON() ([]byte, error) { 2602 objectMap := make(map[string]interface{}) 2603 if rup.Tags != nil { 2604 objectMap["tags"] = rup.Tags 2605 } 2606 if rup.Sku != nil { 2607 objectMap["sku"] = rup.Sku 2608 } 2609 if rup.RegistryPropertiesUpdateParameters != nil { 2610 objectMap["properties"] = rup.RegistryPropertiesUpdateParameters 2611 } 2612 return json.Marshal(objectMap) 2613} 2614 2615// UnmarshalJSON is the custom unmarshaler for RegistryUpdateParameters struct. 2616func (rup *RegistryUpdateParameters) UnmarshalJSON(body []byte) error { 2617 var m map[string]*json.RawMessage 2618 err := json.Unmarshal(body, &m) 2619 if err != nil { 2620 return err 2621 } 2622 for k, v := range m { 2623 switch k { 2624 case "tags": 2625 if v != nil { 2626 var tags map[string]*string 2627 err = json.Unmarshal(*v, &tags) 2628 if err != nil { 2629 return err 2630 } 2631 rup.Tags = tags 2632 } 2633 case "sku": 2634 if v != nil { 2635 var sku Sku 2636 err = json.Unmarshal(*v, &sku) 2637 if err != nil { 2638 return err 2639 } 2640 rup.Sku = &sku 2641 } 2642 case "properties": 2643 if v != nil { 2644 var registryPropertiesUpdateParameters RegistryPropertiesUpdateParameters 2645 err = json.Unmarshal(*v, ®istryPropertiesUpdateParameters) 2646 if err != nil { 2647 return err 2648 } 2649 rup.RegistryPropertiesUpdateParameters = ®istryPropertiesUpdateParameters 2650 } 2651 } 2652 } 2653 2654 return nil 2655} 2656 2657// RegistryUsage the quota usage for a container registry. 2658type RegistryUsage struct { 2659 // Name - The name of the usage. 2660 Name *string `json:"name,omitempty"` 2661 // Limit - The limit of the usage. 2662 Limit *int64 `json:"limit,omitempty"` 2663 // CurrentValue - The current value of the usage. 2664 CurrentValue *int64 `json:"currentValue,omitempty"` 2665 // Unit - The unit of measurement. Possible values include: 'Count', 'Bytes' 2666 Unit RegistryUsageUnit `json:"unit,omitempty"` 2667} 2668 2669// RegistryUsageListResult the result of a request to get container registry quota usages. 2670type RegistryUsageListResult struct { 2671 autorest.Response `json:"-"` 2672 // Value - The list of container registry quota usages. 2673 Value *[]RegistryUsage `json:"value,omitempty"` 2674} 2675 2676// Replication an object that represents a replication for a container registry. 2677type Replication struct { 2678 autorest.Response `json:"-"` 2679 // ReplicationProperties - The properties of the replication. 2680 *ReplicationProperties `json:"properties,omitempty"` 2681 // ID - READ-ONLY; The resource ID. 2682 ID *string `json:"id,omitempty"` 2683 // Name - READ-ONLY; The name of the resource. 2684 Name *string `json:"name,omitempty"` 2685 // Type - READ-ONLY; The type of the resource. 2686 Type *string `json:"type,omitempty"` 2687 // Location - The location of the resource. This cannot be changed after the resource is created. 2688 Location *string `json:"location,omitempty"` 2689 // Tags - The tags of the resource. 2690 Tags map[string]*string `json:"tags"` 2691} 2692 2693// MarshalJSON is the custom marshaler for Replication. 2694func (r Replication) MarshalJSON() ([]byte, error) { 2695 objectMap := make(map[string]interface{}) 2696 if r.ReplicationProperties != nil { 2697 objectMap["properties"] = r.ReplicationProperties 2698 } 2699 if r.Location != nil { 2700 objectMap["location"] = r.Location 2701 } 2702 if r.Tags != nil { 2703 objectMap["tags"] = r.Tags 2704 } 2705 return json.Marshal(objectMap) 2706} 2707 2708// UnmarshalJSON is the custom unmarshaler for Replication struct. 2709func (r *Replication) UnmarshalJSON(body []byte) error { 2710 var m map[string]*json.RawMessage 2711 err := json.Unmarshal(body, &m) 2712 if err != nil { 2713 return err 2714 } 2715 for k, v := range m { 2716 switch k { 2717 case "properties": 2718 if v != nil { 2719 var replicationProperties ReplicationProperties 2720 err = json.Unmarshal(*v, &replicationProperties) 2721 if err != nil { 2722 return err 2723 } 2724 r.ReplicationProperties = &replicationProperties 2725 } 2726 case "id": 2727 if v != nil { 2728 var ID string 2729 err = json.Unmarshal(*v, &ID) 2730 if err != nil { 2731 return err 2732 } 2733 r.ID = &ID 2734 } 2735 case "name": 2736 if v != nil { 2737 var name string 2738 err = json.Unmarshal(*v, &name) 2739 if err != nil { 2740 return err 2741 } 2742 r.Name = &name 2743 } 2744 case "type": 2745 if v != nil { 2746 var typeVar string 2747 err = json.Unmarshal(*v, &typeVar) 2748 if err != nil { 2749 return err 2750 } 2751 r.Type = &typeVar 2752 } 2753 case "location": 2754 if v != nil { 2755 var location string 2756 err = json.Unmarshal(*v, &location) 2757 if err != nil { 2758 return err 2759 } 2760 r.Location = &location 2761 } 2762 case "tags": 2763 if v != nil { 2764 var tags map[string]*string 2765 err = json.Unmarshal(*v, &tags) 2766 if err != nil { 2767 return err 2768 } 2769 r.Tags = tags 2770 } 2771 } 2772 } 2773 2774 return nil 2775} 2776 2777// ReplicationListResult the result of a request to list replications for a container registry. 2778type ReplicationListResult struct { 2779 autorest.Response `json:"-"` 2780 // Value - The list of replications. Since this list may be incomplete, the nextLink field should be used to request the next list of replications. 2781 Value *[]Replication `json:"value,omitempty"` 2782 // NextLink - The URI that can be used to request the next list of replications. 2783 NextLink *string `json:"nextLink,omitempty"` 2784} 2785 2786// ReplicationListResultIterator provides access to a complete listing of Replication values. 2787type ReplicationListResultIterator struct { 2788 i int 2789 page ReplicationListResultPage 2790} 2791 2792// NextWithContext advances to the next value. If there was an error making 2793// the request the iterator does not advance and the error is returned. 2794func (iter *ReplicationListResultIterator) NextWithContext(ctx context.Context) (err error) { 2795 if tracing.IsEnabled() { 2796 ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationListResultIterator.NextWithContext") 2797 defer func() { 2798 sc := -1 2799 if iter.Response().Response.Response != nil { 2800 sc = iter.Response().Response.Response.StatusCode 2801 } 2802 tracing.EndSpan(ctx, sc, err) 2803 }() 2804 } 2805 iter.i++ 2806 if iter.i < len(iter.page.Values()) { 2807 return nil 2808 } 2809 err = iter.page.NextWithContext(ctx) 2810 if err != nil { 2811 iter.i-- 2812 return err 2813 } 2814 iter.i = 0 2815 return nil 2816} 2817 2818// Next advances to the next value. If there was an error making 2819// the request the iterator does not advance and the error is returned. 2820// Deprecated: Use NextWithContext() instead. 2821func (iter *ReplicationListResultIterator) Next() error { 2822 return iter.NextWithContext(context.Background()) 2823} 2824 2825// NotDone returns true if the enumeration should be started or is not yet complete. 2826func (iter ReplicationListResultIterator) NotDone() bool { 2827 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2828} 2829 2830// Response returns the raw server response from the last page request. 2831func (iter ReplicationListResultIterator) Response() ReplicationListResult { 2832 return iter.page.Response() 2833} 2834 2835// Value returns the current value or a zero-initialized value if the 2836// iterator has advanced beyond the end of the collection. 2837func (iter ReplicationListResultIterator) Value() Replication { 2838 if !iter.page.NotDone() { 2839 return Replication{} 2840 } 2841 return iter.page.Values()[iter.i] 2842} 2843 2844// Creates a new instance of the ReplicationListResultIterator type. 2845func NewReplicationListResultIterator(page ReplicationListResultPage) ReplicationListResultIterator { 2846 return ReplicationListResultIterator{page: page} 2847} 2848 2849// IsEmpty returns true if the ListResult contains no values. 2850func (rlr ReplicationListResult) IsEmpty() bool { 2851 return rlr.Value == nil || len(*rlr.Value) == 0 2852} 2853 2854// replicationListResultPreparer prepares a request to retrieve the next set of results. 2855// It returns nil if no more results exist. 2856func (rlr ReplicationListResult) replicationListResultPreparer(ctx context.Context) (*http.Request, error) { 2857 if rlr.NextLink == nil || len(to.String(rlr.NextLink)) < 1 { 2858 return nil, nil 2859 } 2860 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2861 autorest.AsJSON(), 2862 autorest.AsGet(), 2863 autorest.WithBaseURL(to.String(rlr.NextLink))) 2864} 2865 2866// ReplicationListResultPage contains a page of Replication values. 2867type ReplicationListResultPage struct { 2868 fn func(context.Context, ReplicationListResult) (ReplicationListResult, error) 2869 rlr ReplicationListResult 2870} 2871 2872// NextWithContext advances to the next page of values. If there was an error making 2873// the request the page does not advance and the error is returned. 2874func (page *ReplicationListResultPage) NextWithContext(ctx context.Context) (err error) { 2875 if tracing.IsEnabled() { 2876 ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationListResultPage.NextWithContext") 2877 defer func() { 2878 sc := -1 2879 if page.Response().Response.Response != nil { 2880 sc = page.Response().Response.Response.StatusCode 2881 } 2882 tracing.EndSpan(ctx, sc, err) 2883 }() 2884 } 2885 next, err := page.fn(ctx, page.rlr) 2886 if err != nil { 2887 return err 2888 } 2889 page.rlr = next 2890 return nil 2891} 2892 2893// Next advances to the next page of values. If there was an error making 2894// the request the page does not advance and the error is returned. 2895// Deprecated: Use NextWithContext() instead. 2896func (page *ReplicationListResultPage) Next() error { 2897 return page.NextWithContext(context.Background()) 2898} 2899 2900// NotDone returns true if the page enumeration should be started or is not yet complete. 2901func (page ReplicationListResultPage) NotDone() bool { 2902 return !page.rlr.IsEmpty() 2903} 2904 2905// Response returns the raw server response from the last page request. 2906func (page ReplicationListResultPage) Response() ReplicationListResult { 2907 return page.rlr 2908} 2909 2910// Values returns the slice of values for the current page or nil if there are no values. 2911func (page ReplicationListResultPage) Values() []Replication { 2912 if page.rlr.IsEmpty() { 2913 return nil 2914 } 2915 return *page.rlr.Value 2916} 2917 2918// Creates a new instance of the ReplicationListResultPage type. 2919func NewReplicationListResultPage(getNextPage func(context.Context, ReplicationListResult) (ReplicationListResult, error)) ReplicationListResultPage { 2920 return ReplicationListResultPage{fn: getNextPage} 2921} 2922 2923// ReplicationProperties the properties of a replication. 2924type ReplicationProperties struct { 2925 // ProvisioningState - READ-ONLY; The provisioning state of the replication at the time the operation was called. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' 2926 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 2927 // Status - READ-ONLY; The status of the replication at the time the operation was called. 2928 Status *Status `json:"status,omitempty"` 2929} 2930 2931// ReplicationsCreateFuture an abstraction for monitoring and retrieving the results of a long-running 2932// operation. 2933type ReplicationsCreateFuture struct { 2934 azure.Future 2935} 2936 2937// Result returns the result of the asynchronous operation. 2938// If the operation has not completed it will return an error. 2939func (future *ReplicationsCreateFuture) Result(client ReplicationsClient) (r Replication, err error) { 2940 var done bool 2941 done, err = future.DoneWithContext(context.Background(), client) 2942 if err != nil { 2943 err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsCreateFuture", "Result", future.Response(), "Polling failure") 2944 return 2945 } 2946 if !done { 2947 err = azure.NewAsyncOpIncompleteError("containerregistry.ReplicationsCreateFuture") 2948 return 2949 } 2950 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2951 if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent { 2952 r, err = client.CreateResponder(r.Response.Response) 2953 if err != nil { 2954 err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsCreateFuture", "Result", r.Response.Response, "Failure responding to request") 2955 } 2956 } 2957 return 2958} 2959 2960// ReplicationsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 2961// operation. 2962type ReplicationsDeleteFuture struct { 2963 azure.Future 2964} 2965 2966// Result returns the result of the asynchronous operation. 2967// If the operation has not completed it will return an error. 2968func (future *ReplicationsDeleteFuture) Result(client ReplicationsClient) (ar autorest.Response, err error) { 2969 var done bool 2970 done, err = future.DoneWithContext(context.Background(), client) 2971 if err != nil { 2972 err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsDeleteFuture", "Result", future.Response(), "Polling failure") 2973 return 2974 } 2975 if !done { 2976 err = azure.NewAsyncOpIncompleteError("containerregistry.ReplicationsDeleteFuture") 2977 return 2978 } 2979 ar.Response = future.Response() 2980 return 2981} 2982 2983// ReplicationsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 2984// operation. 2985type ReplicationsUpdateFuture struct { 2986 azure.Future 2987} 2988 2989// Result returns the result of the asynchronous operation. 2990// If the operation has not completed it will return an error. 2991func (future *ReplicationsUpdateFuture) Result(client ReplicationsClient) (r Replication, err error) { 2992 var done bool 2993 done, err = future.DoneWithContext(context.Background(), client) 2994 if err != nil { 2995 err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsUpdateFuture", "Result", future.Response(), "Polling failure") 2996 return 2997 } 2998 if !done { 2999 err = azure.NewAsyncOpIncompleteError("containerregistry.ReplicationsUpdateFuture") 3000 return 3001 } 3002 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3003 if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent { 3004 r, err = client.UpdateResponder(r.Response.Response) 3005 if err != nil { 3006 err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsUpdateFuture", "Result", r.Response.Response, "Failure responding to request") 3007 } 3008 } 3009 return 3010} 3011 3012// ReplicationUpdateParameters the parameters for updating a replication. 3013type ReplicationUpdateParameters struct { 3014 // Tags - The tags for the replication. 3015 Tags map[string]*string `json:"tags"` 3016} 3017 3018// MarshalJSON is the custom marshaler for ReplicationUpdateParameters. 3019func (rup ReplicationUpdateParameters) MarshalJSON() ([]byte, error) { 3020 objectMap := make(map[string]interface{}) 3021 if rup.Tags != nil { 3022 objectMap["tags"] = rup.Tags 3023 } 3024 return json.Marshal(objectMap) 3025} 3026 3027// Request the request that generated the event. 3028type Request struct { 3029 // ID - The ID of the request that initiated the event. 3030 ID *string `json:"id,omitempty"` 3031 // Addr - The IP or hostname and possibly port of the client connection that initiated the event. This is the RemoteAddr from the standard http request. 3032 Addr *string `json:"addr,omitempty"` 3033 // Host - The externally accessible hostname of the registry instance, as specified by the http host header on incoming requests. 3034 Host *string `json:"host,omitempty"` 3035 // Method - The request method that generated the event. 3036 Method *string `json:"method,omitempty"` 3037 // Useragent - The user agent header of the request. 3038 Useragent *string `json:"useragent,omitempty"` 3039} 3040 3041// Resource an Azure resource. 3042type Resource struct { 3043 // ID - READ-ONLY; The resource ID. 3044 ID *string `json:"id,omitempty"` 3045 // Name - READ-ONLY; The name of the resource. 3046 Name *string `json:"name,omitempty"` 3047 // Type - READ-ONLY; The type of the resource. 3048 Type *string `json:"type,omitempty"` 3049 // Location - The location of the resource. This cannot be changed after the resource is created. 3050 Location *string `json:"location,omitempty"` 3051 // Tags - The tags of the resource. 3052 Tags map[string]*string `json:"tags"` 3053} 3054 3055// MarshalJSON is the custom marshaler for Resource. 3056func (r Resource) MarshalJSON() ([]byte, error) { 3057 objectMap := make(map[string]interface{}) 3058 if r.Location != nil { 3059 objectMap["location"] = r.Location 3060 } 3061 if r.Tags != nil { 3062 objectMap["tags"] = r.Tags 3063 } 3064 return json.Marshal(objectMap) 3065} 3066 3067// RetentionPolicy the retention policy for a container registry. 3068type RetentionPolicy struct { 3069 // Days - The number of days to retain manifest before it expires. 3070 Days *int32 `json:"days,omitempty"` 3071 // LastUpdatedTime - READ-ONLY; The timestamp when the policy was last updated. 3072 LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` 3073 // Status - The value that indicates whether the policy is enabled or not. Possible values include: 'Enabled', 'Disabled' 3074 Status PolicyStatus `json:"status,omitempty"` 3075} 3076 3077// Run run resource properties 3078type Run struct { 3079 autorest.Response `json:"-"` 3080 // RunProperties - The properties of a run. 3081 *RunProperties `json:"properties,omitempty"` 3082 // ID - READ-ONLY; The resource ID. 3083 ID *string `json:"id,omitempty"` 3084 // Name - READ-ONLY; The name of the resource. 3085 Name *string `json:"name,omitempty"` 3086 // Type - READ-ONLY; The type of the resource. 3087 Type *string `json:"type,omitempty"` 3088} 3089 3090// MarshalJSON is the custom marshaler for Run. 3091func (r Run) MarshalJSON() ([]byte, error) { 3092 objectMap := make(map[string]interface{}) 3093 if r.RunProperties != nil { 3094 objectMap["properties"] = r.RunProperties 3095 } 3096 return json.Marshal(objectMap) 3097} 3098 3099// UnmarshalJSON is the custom unmarshaler for Run struct. 3100func (r *Run) UnmarshalJSON(body []byte) error { 3101 var m map[string]*json.RawMessage 3102 err := json.Unmarshal(body, &m) 3103 if err != nil { 3104 return err 3105 } 3106 for k, v := range m { 3107 switch k { 3108 case "properties": 3109 if v != nil { 3110 var runProperties RunProperties 3111 err = json.Unmarshal(*v, &runProperties) 3112 if err != nil { 3113 return err 3114 } 3115 r.RunProperties = &runProperties 3116 } 3117 case "id": 3118 if v != nil { 3119 var ID string 3120 err = json.Unmarshal(*v, &ID) 3121 if err != nil { 3122 return err 3123 } 3124 r.ID = &ID 3125 } 3126 case "name": 3127 if v != nil { 3128 var name string 3129 err = json.Unmarshal(*v, &name) 3130 if err != nil { 3131 return err 3132 } 3133 r.Name = &name 3134 } 3135 case "type": 3136 if v != nil { 3137 var typeVar string 3138 err = json.Unmarshal(*v, &typeVar) 3139 if err != nil { 3140 return err 3141 } 3142 r.Type = &typeVar 3143 } 3144 } 3145 } 3146 3147 return nil 3148} 3149 3150// RunFilter properties that are enabled for Odata querying on runs. 3151type RunFilter struct { 3152 // RunID - The unique identifier for the run. 3153 RunID *string `json:"runId,omitempty"` 3154 // RunType - The type of run. Possible values include: 'QuickBuild', 'QuickRun', 'AutoBuild', 'AutoRun' 3155 RunType RunType `json:"runType,omitempty"` 3156 // Status - The current status of the run. Possible values include: 'RunStatusQueued', 'RunStatusStarted', 'RunStatusRunning', 'RunStatusSucceeded', 'RunStatusFailed', 'RunStatusCanceled', 'RunStatusError', 'RunStatusTimeout' 3157 Status RunStatus `json:"status,omitempty"` 3158 // CreateTime - The create time for a run. 3159 CreateTime *date.Time `json:"createTime,omitempty"` 3160 // FinishTime - The time the run finished. 3161 FinishTime *date.Time `json:"finishTime,omitempty"` 3162 // OutputImageManifests - The list of comma-separated image manifests that were generated from the run. This is applicable if the run is of 3163 // build type. 3164 OutputImageManifests *string `json:"outputImageManifests,omitempty"` 3165 // IsArchiveEnabled - The value that indicates whether archiving is enabled or not. 3166 IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` 3167 // TaskName - The name of the task that the run corresponds to. 3168 TaskName *string `json:"taskName,omitempty"` 3169} 3170 3171// RunGetLogResult the result of get log link operation. 3172type RunGetLogResult struct { 3173 autorest.Response `json:"-"` 3174 // LogLink - The link to logs for a run on a azure container registry. 3175 LogLink *string `json:"logLink,omitempty"` 3176} 3177 3178// RunListResult collection of runs. 3179type RunListResult struct { 3180 autorest.Response `json:"-"` 3181 // Value - The collection value. 3182 Value *[]Run `json:"value,omitempty"` 3183 // NextLink - The URI that can be used to request the next set of paged results. 3184 NextLink *string `json:"nextLink,omitempty"` 3185} 3186 3187// RunListResultIterator provides access to a complete listing of Run values. 3188type RunListResultIterator struct { 3189 i int 3190 page RunListResultPage 3191} 3192 3193// NextWithContext advances to the next value. If there was an error making 3194// the request the iterator does not advance and the error is returned. 3195func (iter *RunListResultIterator) NextWithContext(ctx context.Context) (err error) { 3196 if tracing.IsEnabled() { 3197 ctx = tracing.StartSpan(ctx, fqdn+"/RunListResultIterator.NextWithContext") 3198 defer func() { 3199 sc := -1 3200 if iter.Response().Response.Response != nil { 3201 sc = iter.Response().Response.Response.StatusCode 3202 } 3203 tracing.EndSpan(ctx, sc, err) 3204 }() 3205 } 3206 iter.i++ 3207 if iter.i < len(iter.page.Values()) { 3208 return nil 3209 } 3210 err = iter.page.NextWithContext(ctx) 3211 if err != nil { 3212 iter.i-- 3213 return err 3214 } 3215 iter.i = 0 3216 return nil 3217} 3218 3219// Next advances to the next value. If there was an error making 3220// the request the iterator does not advance and the error is returned. 3221// Deprecated: Use NextWithContext() instead. 3222func (iter *RunListResultIterator) Next() error { 3223 return iter.NextWithContext(context.Background()) 3224} 3225 3226// NotDone returns true if the enumeration should be started or is not yet complete. 3227func (iter RunListResultIterator) NotDone() bool { 3228 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3229} 3230 3231// Response returns the raw server response from the last page request. 3232func (iter RunListResultIterator) Response() RunListResult { 3233 return iter.page.Response() 3234} 3235 3236// Value returns the current value or a zero-initialized value if the 3237// iterator has advanced beyond the end of the collection. 3238func (iter RunListResultIterator) Value() Run { 3239 if !iter.page.NotDone() { 3240 return Run{} 3241 } 3242 return iter.page.Values()[iter.i] 3243} 3244 3245// Creates a new instance of the RunListResultIterator type. 3246func NewRunListResultIterator(page RunListResultPage) RunListResultIterator { 3247 return RunListResultIterator{page: page} 3248} 3249 3250// IsEmpty returns true if the ListResult contains no values. 3251func (rlr RunListResult) IsEmpty() bool { 3252 return rlr.Value == nil || len(*rlr.Value) == 0 3253} 3254 3255// runListResultPreparer prepares a request to retrieve the next set of results. 3256// It returns nil if no more results exist. 3257func (rlr RunListResult) runListResultPreparer(ctx context.Context) (*http.Request, error) { 3258 if rlr.NextLink == nil || len(to.String(rlr.NextLink)) < 1 { 3259 return nil, nil 3260 } 3261 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3262 autorest.AsJSON(), 3263 autorest.AsGet(), 3264 autorest.WithBaseURL(to.String(rlr.NextLink))) 3265} 3266 3267// RunListResultPage contains a page of Run values. 3268type RunListResultPage struct { 3269 fn func(context.Context, RunListResult) (RunListResult, error) 3270 rlr RunListResult 3271} 3272 3273// NextWithContext advances to the next page of values. If there was an error making 3274// the request the page does not advance and the error is returned. 3275func (page *RunListResultPage) NextWithContext(ctx context.Context) (err error) { 3276 if tracing.IsEnabled() { 3277 ctx = tracing.StartSpan(ctx, fqdn+"/RunListResultPage.NextWithContext") 3278 defer func() { 3279 sc := -1 3280 if page.Response().Response.Response != nil { 3281 sc = page.Response().Response.Response.StatusCode 3282 } 3283 tracing.EndSpan(ctx, sc, err) 3284 }() 3285 } 3286 next, err := page.fn(ctx, page.rlr) 3287 if err != nil { 3288 return err 3289 } 3290 page.rlr = next 3291 return nil 3292} 3293 3294// Next advances to the next page of values. If there was an error making 3295// the request the page does not advance and the error is returned. 3296// Deprecated: Use NextWithContext() instead. 3297func (page *RunListResultPage) Next() error { 3298 return page.NextWithContext(context.Background()) 3299} 3300 3301// NotDone returns true if the page enumeration should be started or is not yet complete. 3302func (page RunListResultPage) NotDone() bool { 3303 return !page.rlr.IsEmpty() 3304} 3305 3306// Response returns the raw server response from the last page request. 3307func (page RunListResultPage) Response() RunListResult { 3308 return page.rlr 3309} 3310 3311// Values returns the slice of values for the current page or nil if there are no values. 3312func (page RunListResultPage) Values() []Run { 3313 if page.rlr.IsEmpty() { 3314 return nil 3315 } 3316 return *page.rlr.Value 3317} 3318 3319// Creates a new instance of the RunListResultPage type. 3320func NewRunListResultPage(getNextPage func(context.Context, RunListResult) (RunListResult, error)) RunListResultPage { 3321 return RunListResultPage{fn: getNextPage} 3322} 3323 3324// RunProperties the properties for a run. 3325type RunProperties struct { 3326 // RunID - The unique identifier for the run. 3327 RunID *string `json:"runId,omitempty"` 3328 // Status - The current status of the run. Possible values include: 'RunStatusQueued', 'RunStatusStarted', 'RunStatusRunning', 'RunStatusSucceeded', 'RunStatusFailed', 'RunStatusCanceled', 'RunStatusError', 'RunStatusTimeout' 3329 Status RunStatus `json:"status,omitempty"` 3330 // LastUpdatedTime - The last updated time for the run. 3331 LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` 3332 // RunType - The type of run. Possible values include: 'QuickBuild', 'QuickRun', 'AutoBuild', 'AutoRun' 3333 RunType RunType `json:"runType,omitempty"` 3334 // CreateTime - The time the run was scheduled. 3335 CreateTime *date.Time `json:"createTime,omitempty"` 3336 // StartTime - The time the run started. 3337 StartTime *date.Time `json:"startTime,omitempty"` 3338 // FinishTime - The time the run finished. 3339 FinishTime *date.Time `json:"finishTime,omitempty"` 3340 // OutputImages - The list of all images that were generated from the run. This is applicable if the run generates base image dependencies. 3341 OutputImages *[]ImageDescriptor `json:"outputImages,omitempty"` 3342 // Task - The task against which run was scheduled. 3343 Task *string `json:"task,omitempty"` 3344 // ImageUpdateTrigger - The image update trigger that caused the run. This is applicable if the task has base image trigger configured. 3345 ImageUpdateTrigger *ImageUpdateTrigger `json:"imageUpdateTrigger,omitempty"` 3346 // SourceTrigger - The source trigger that caused the run. 3347 SourceTrigger *SourceTriggerDescriptor `json:"sourceTrigger,omitempty"` 3348 // TimerTrigger - The timer trigger that caused the run. 3349 TimerTrigger *TimerTriggerDescriptor `json:"timerTrigger,omitempty"` 3350 // Platform - The platform properties against which the run will happen. 3351 Platform *PlatformProperties `json:"platform,omitempty"` 3352 // AgentConfiguration - The machine configuration of the run agent. 3353 AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` 3354 // SourceRegistryAuth - The scope of the credentials that were used to login to the source registry during this run. 3355 SourceRegistryAuth *string `json:"sourceRegistryAuth,omitempty"` 3356 // CustomRegistries - The list of custom registries that were logged in during this run. 3357 CustomRegistries *[]string `json:"customRegistries,omitempty"` 3358 // RunErrorMessage - READ-ONLY; The error message received from backend systems after the run is scheduled. 3359 RunErrorMessage *string `json:"runErrorMessage,omitempty"` 3360 // UpdateTriggerToken - The update trigger token passed for the Run. 3361 UpdateTriggerToken *string `json:"updateTriggerToken,omitempty"` 3362 // ProvisioningState - The provisioning state of a run. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' 3363 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 3364 // IsArchiveEnabled - The value that indicates whether archiving is enabled or not. 3365 IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` 3366} 3367 3368// BasicRunRequest the request parameters for scheduling a run. 3369type BasicRunRequest interface { 3370 AsDockerBuildRequest() (*DockerBuildRequest, bool) 3371 AsFileTaskRunRequest() (*FileTaskRunRequest, bool) 3372 AsTaskRunRequest() (*TaskRunRequest, bool) 3373 AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) 3374 AsRunRequest() (*RunRequest, bool) 3375} 3376 3377// RunRequest the request parameters for scheduling a run. 3378type RunRequest struct { 3379 // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. 3380 IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` 3381 // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' 3382 Type Type `json:"type,omitempty"` 3383} 3384 3385func unmarshalBasicRunRequest(body []byte) (BasicRunRequest, error) { 3386 var m map[string]interface{} 3387 err := json.Unmarshal(body, &m) 3388 if err != nil { 3389 return nil, err 3390 } 3391 3392 switch m["type"] { 3393 case string(TypeDockerBuildRequest): 3394 var dbr DockerBuildRequest 3395 err := json.Unmarshal(body, &dbr) 3396 return dbr, err 3397 case string(TypeFileTaskRunRequest): 3398 var ftrr FileTaskRunRequest 3399 err := json.Unmarshal(body, &ftrr) 3400 return ftrr, err 3401 case string(TypeTaskRunRequest): 3402 var trr TaskRunRequest 3403 err := json.Unmarshal(body, &trr) 3404 return trr, err 3405 case string(TypeEncodedTaskRunRequest): 3406 var etrr EncodedTaskRunRequest 3407 err := json.Unmarshal(body, &etrr) 3408 return etrr, err 3409 default: 3410 var rr RunRequest 3411 err := json.Unmarshal(body, &rr) 3412 return rr, err 3413 } 3414} 3415func unmarshalBasicRunRequestArray(body []byte) ([]BasicRunRequest, error) { 3416 var rawMessages []*json.RawMessage 3417 err := json.Unmarshal(body, &rawMessages) 3418 if err != nil { 3419 return nil, err 3420 } 3421 3422 rrArray := make([]BasicRunRequest, len(rawMessages)) 3423 3424 for index, rawMessage := range rawMessages { 3425 rr, err := unmarshalBasicRunRequest(*rawMessage) 3426 if err != nil { 3427 return nil, err 3428 } 3429 rrArray[index] = rr 3430 } 3431 return rrArray, nil 3432} 3433 3434// MarshalJSON is the custom marshaler for RunRequest. 3435func (rr RunRequest) MarshalJSON() ([]byte, error) { 3436 rr.Type = TypeRunRequest 3437 objectMap := make(map[string]interface{}) 3438 if rr.IsArchiveEnabled != nil { 3439 objectMap["isArchiveEnabled"] = rr.IsArchiveEnabled 3440 } 3441 if rr.Type != "" { 3442 objectMap["type"] = rr.Type 3443 } 3444 return json.Marshal(objectMap) 3445} 3446 3447// AsDockerBuildRequest is the BasicRunRequest implementation for RunRequest. 3448func (rr RunRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { 3449 return nil, false 3450} 3451 3452// AsFileTaskRunRequest is the BasicRunRequest implementation for RunRequest. 3453func (rr RunRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { 3454 return nil, false 3455} 3456 3457// AsTaskRunRequest is the BasicRunRequest implementation for RunRequest. 3458func (rr RunRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { 3459 return nil, false 3460} 3461 3462// AsEncodedTaskRunRequest is the BasicRunRequest implementation for RunRequest. 3463func (rr RunRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { 3464 return nil, false 3465} 3466 3467// AsRunRequest is the BasicRunRequest implementation for RunRequest. 3468func (rr RunRequest) AsRunRequest() (*RunRequest, bool) { 3469 return &rr, true 3470} 3471 3472// AsBasicRunRequest is the BasicRunRequest implementation for RunRequest. 3473func (rr RunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { 3474 return &rr, true 3475} 3476 3477// RunsCancelFuture an abstraction for monitoring and retrieving the results of a long-running operation. 3478type RunsCancelFuture struct { 3479 azure.Future 3480} 3481 3482// Result returns the result of the asynchronous operation. 3483// If the operation has not completed it will return an error. 3484func (future *RunsCancelFuture) Result(client RunsClient) (ar autorest.Response, err error) { 3485 var done bool 3486 done, err = future.DoneWithContext(context.Background(), client) 3487 if err != nil { 3488 err = autorest.NewErrorWithError(err, "containerregistry.RunsCancelFuture", "Result", future.Response(), "Polling failure") 3489 return 3490 } 3491 if !done { 3492 err = azure.NewAsyncOpIncompleteError("containerregistry.RunsCancelFuture") 3493 return 3494 } 3495 ar.Response = future.Response() 3496 return 3497} 3498 3499// RunsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 3500type RunsUpdateFuture struct { 3501 azure.Future 3502} 3503 3504// Result returns the result of the asynchronous operation. 3505// If the operation has not completed it will return an error. 3506func (future *RunsUpdateFuture) Result(client RunsClient) (r Run, err error) { 3507 var done bool 3508 done, err = future.DoneWithContext(context.Background(), client) 3509 if err != nil { 3510 err = autorest.NewErrorWithError(err, "containerregistry.RunsUpdateFuture", "Result", future.Response(), "Polling failure") 3511 return 3512 } 3513 if !done { 3514 err = azure.NewAsyncOpIncompleteError("containerregistry.RunsUpdateFuture") 3515 return 3516 } 3517 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3518 if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent { 3519 r, err = client.UpdateResponder(r.Response.Response) 3520 if err != nil { 3521 err = autorest.NewErrorWithError(err, "containerregistry.RunsUpdateFuture", "Result", r.Response.Response, "Failure responding to request") 3522 } 3523 } 3524 return 3525} 3526 3527// RunUpdateParameters the set of run properties that can be updated. 3528type RunUpdateParameters struct { 3529 // IsArchiveEnabled - The value that indicates whether archiving is enabled or not. 3530 IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` 3531} 3532 3533// SecretObject describes the properties of a secret object value. 3534type SecretObject struct { 3535 // Value - The value of the secret. The format of this value will be determined 3536 // based on the type of the secret object. If the type is Opaque, the value will be 3537 // used as is without any modification. 3538 Value *string `json:"value,omitempty"` 3539 // Type - The type of the secret object which determines how the value of the secret object has to be 3540 // interpreted. Possible values include: 'Opaque', 'Vaultsecret' 3541 Type SecretObjectType `json:"type,omitempty"` 3542} 3543 3544// SetValue the properties of a overridable value that can be passed to a task template. 3545type SetValue struct { 3546 // Name - The name of the overridable value. 3547 Name *string `json:"name,omitempty"` 3548 // Value - The overridable value. 3549 Value *string `json:"value,omitempty"` 3550 // IsSecret - Flag to indicate whether the value represents a secret or not. 3551 IsSecret *bool `json:"isSecret,omitempty"` 3552} 3553 3554// Sku the SKU of a container registry. 3555type Sku struct { 3556 // Name - The SKU name of the container registry. Required for registry creation. Possible values include: 'Classic', 'Basic', 'Standard', 'Premium' 3557 Name SkuName `json:"name,omitempty"` 3558 // Tier - READ-ONLY; The SKU tier based on the SKU name. Possible values include: 'SkuTierClassic', 'SkuTierBasic', 'SkuTierStandard', 'SkuTierPremium' 3559 Tier SkuTier `json:"tier,omitempty"` 3560} 3561 3562// Source the registry node that generated the event. Put differently, while the actor initiates the event, 3563// the source generates it. 3564type Source struct { 3565 // Addr - The IP or hostname and the port of the registry node that generated the event. Generally, this will be resolved by os.Hostname() along with the running port. 3566 Addr *string `json:"addr,omitempty"` 3567 // InstanceID - The running instance of an application. Changes after each restart. 3568 InstanceID *string `json:"instanceID,omitempty"` 3569} 3570 3571// SourceProperties the properties of the source code repository. 3572type SourceProperties struct { 3573 // SourceControlType - The type of source control service. Possible values include: 'Github', 'VisualStudioTeamService' 3574 SourceControlType SourceControlType `json:"sourceControlType,omitempty"` 3575 // RepositoryURL - The full URL to the source code repository 3576 RepositoryURL *string `json:"repositoryUrl,omitempty"` 3577 // Branch - The branch name of the source code. 3578 Branch *string `json:"branch,omitempty"` 3579 // SourceControlAuthProperties - The authorization properties for accessing the source code repository and to set up 3580 // webhooks for notifications. 3581 SourceControlAuthProperties *AuthInfo `json:"sourceControlAuthProperties,omitempty"` 3582} 3583 3584// SourceRegistryCredentials describes the credential parameters for accessing the source registry. 3585type SourceRegistryCredentials struct { 3586 // LoginMode - The authentication mode which determines the source registry login scope. The credentials for the source registry 3587 // will be generated using the given scope. These credentials will be used to login to 3588 // the source registry during the run. Possible values include: 'SourceRegistryLoginModeNone', 'SourceRegistryLoginModeDefault' 3589 LoginMode SourceRegistryLoginMode `json:"loginMode,omitempty"` 3590} 3591 3592// SourceTrigger the properties of a source based trigger. 3593type SourceTrigger struct { 3594 // SourceRepository - The properties that describes the source(code) for the task. 3595 SourceRepository *SourceProperties `json:"sourceRepository,omitempty"` 3596 // SourceTriggerEvents - The source event corresponding to the trigger. 3597 SourceTriggerEvents *[]SourceTriggerEvent `json:"sourceTriggerEvents,omitempty"` 3598 // Status - The current status of trigger. Possible values include: 'TriggerStatusDisabled', 'TriggerStatusEnabled' 3599 Status TriggerStatus `json:"status,omitempty"` 3600 // Name - The name of the trigger. 3601 Name *string `json:"name,omitempty"` 3602} 3603 3604// SourceTriggerDescriptor the source trigger that caused a run. 3605type SourceTriggerDescriptor struct { 3606 // ID - The unique ID of the trigger. 3607 ID *string `json:"id,omitempty"` 3608 // EventType - The event type of the trigger. 3609 EventType *string `json:"eventType,omitempty"` 3610 // CommitID - The unique ID that identifies a commit. 3611 CommitID *string `json:"commitId,omitempty"` 3612 // PullRequestID - The unique ID that identifies pull request. 3613 PullRequestID *string `json:"pullRequestId,omitempty"` 3614 // RepositoryURL - The repository URL. 3615 RepositoryURL *string `json:"repositoryUrl,omitempty"` 3616 // BranchName - The branch name in the repository. 3617 BranchName *string `json:"branchName,omitempty"` 3618 // ProviderType - The source control provider type. 3619 ProviderType *string `json:"providerType,omitempty"` 3620} 3621 3622// SourceTriggerUpdateParameters the properties for updating a source based trigger. 3623type SourceTriggerUpdateParameters struct { 3624 // SourceRepository - The properties that describes the source(code) for the task. 3625 SourceRepository *SourceUpdateParameters `json:"sourceRepository,omitempty"` 3626 // SourceTriggerEvents - The source event corresponding to the trigger. 3627 SourceTriggerEvents *[]SourceTriggerEvent `json:"sourceTriggerEvents,omitempty"` 3628 // Status - The current status of trigger. Possible values include: 'TriggerStatusDisabled', 'TriggerStatusEnabled' 3629 Status TriggerStatus `json:"status,omitempty"` 3630 // Name - The name of the trigger. 3631 Name *string `json:"name,omitempty"` 3632} 3633 3634// SourceUpdateParameters the properties for updating the source code repository. 3635type SourceUpdateParameters struct { 3636 // SourceControlType - The type of source control service. Possible values include: 'Github', 'VisualStudioTeamService' 3637 SourceControlType SourceControlType `json:"sourceControlType,omitempty"` 3638 // RepositoryURL - The full URL to the source code repository 3639 RepositoryURL *string `json:"repositoryUrl,omitempty"` 3640 // Branch - The branch name of the source code. 3641 Branch *string `json:"branch,omitempty"` 3642 // SourceControlAuthProperties - The authorization properties for accessing the source code repository and to set up 3643 // webhooks for notifications. 3644 SourceControlAuthProperties *AuthInfoUpdateParameters `json:"sourceControlAuthProperties,omitempty"` 3645} 3646 3647// SourceUploadDefinition the properties of a response to source upload request. 3648type SourceUploadDefinition struct { 3649 autorest.Response `json:"-"` 3650 // UploadURL - The URL where the client can upload the source. 3651 UploadURL *string `json:"uploadUrl,omitempty"` 3652 // RelativePath - The relative path to the source. This is used to submit the subsequent queue build request. 3653 RelativePath *string `json:"relativePath,omitempty"` 3654} 3655 3656// Status the status of an Azure resource at the time the operation was called. 3657type Status struct { 3658 // DisplayStatus - READ-ONLY; The short label for the status. 3659 DisplayStatus *string `json:"displayStatus,omitempty"` 3660 // Message - READ-ONLY; The detailed message for the status, including alerts and error messages. 3661 Message *string `json:"message,omitempty"` 3662 // Timestamp - READ-ONLY; The timestamp when the status was changed to the current value. 3663 Timestamp *date.Time `json:"timestamp,omitempty"` 3664} 3665 3666// StorageAccountProperties the properties of a storage account for a container registry. Only applicable 3667// to Classic SKU. 3668type StorageAccountProperties struct { 3669 // ID - The resource ID of the storage account. 3670 ID *string `json:"id,omitempty"` 3671} 3672 3673// Target the target of the event. 3674type Target struct { 3675 // MediaType - The MIME type of the referenced object. 3676 MediaType *string `json:"mediaType,omitempty"` 3677 // Size - The number of bytes of the content. Same as Length field. 3678 Size *int64 `json:"size,omitempty"` 3679 // Digest - The digest of the content, as defined by the Registry V2 HTTP API Specification. 3680 Digest *string `json:"digest,omitempty"` 3681 // Length - The number of bytes of the content. Same as Size field. 3682 Length *int64 `json:"length,omitempty"` 3683 // Repository - The repository name. 3684 Repository *string `json:"repository,omitempty"` 3685 // URL - The direct URL to the content. 3686 URL *string `json:"url,omitempty"` 3687 // Tag - The tag name. 3688 Tag *string `json:"tag,omitempty"` 3689 // Name - The name of the artifact. 3690 Name *string `json:"name,omitempty"` 3691 // Version - The version of the artifact. 3692 Version *string `json:"version,omitempty"` 3693} 3694 3695// Task the task that has the ARM resource and task properties. 3696// The task will have all information to schedule a run against it. 3697type Task struct { 3698 autorest.Response `json:"-"` 3699 // Identity - Identity for the resource. 3700 Identity *IdentityProperties `json:"identity,omitempty"` 3701 // TaskProperties - The properties of a task. 3702 *TaskProperties `json:"properties,omitempty"` 3703 // ID - READ-ONLY; The resource ID. 3704 ID *string `json:"id,omitempty"` 3705 // Name - READ-ONLY; The name of the resource. 3706 Name *string `json:"name,omitempty"` 3707 // Type - READ-ONLY; The type of the resource. 3708 Type *string `json:"type,omitempty"` 3709 // Location - The location of the resource. This cannot be changed after the resource is created. 3710 Location *string `json:"location,omitempty"` 3711 // Tags - The tags of the resource. 3712 Tags map[string]*string `json:"tags"` 3713} 3714 3715// MarshalJSON is the custom marshaler for Task. 3716func (t Task) MarshalJSON() ([]byte, error) { 3717 objectMap := make(map[string]interface{}) 3718 if t.Identity != nil { 3719 objectMap["identity"] = t.Identity 3720 } 3721 if t.TaskProperties != nil { 3722 objectMap["properties"] = t.TaskProperties 3723 } 3724 if t.Location != nil { 3725 objectMap["location"] = t.Location 3726 } 3727 if t.Tags != nil { 3728 objectMap["tags"] = t.Tags 3729 } 3730 return json.Marshal(objectMap) 3731} 3732 3733// UnmarshalJSON is the custom unmarshaler for Task struct. 3734func (t *Task) UnmarshalJSON(body []byte) error { 3735 var m map[string]*json.RawMessage 3736 err := json.Unmarshal(body, &m) 3737 if err != nil { 3738 return err 3739 } 3740 for k, v := range m { 3741 switch k { 3742 case "identity": 3743 if v != nil { 3744 var identity IdentityProperties 3745 err = json.Unmarshal(*v, &identity) 3746 if err != nil { 3747 return err 3748 } 3749 t.Identity = &identity 3750 } 3751 case "properties": 3752 if v != nil { 3753 var taskProperties TaskProperties 3754 err = json.Unmarshal(*v, &taskProperties) 3755 if err != nil { 3756 return err 3757 } 3758 t.TaskProperties = &taskProperties 3759 } 3760 case "id": 3761 if v != nil { 3762 var ID string 3763 err = json.Unmarshal(*v, &ID) 3764 if err != nil { 3765 return err 3766 } 3767 t.ID = &ID 3768 } 3769 case "name": 3770 if v != nil { 3771 var name string 3772 err = json.Unmarshal(*v, &name) 3773 if err != nil { 3774 return err 3775 } 3776 t.Name = &name 3777 } 3778 case "type": 3779 if v != nil { 3780 var typeVar string 3781 err = json.Unmarshal(*v, &typeVar) 3782 if err != nil { 3783 return err 3784 } 3785 t.Type = &typeVar 3786 } 3787 case "location": 3788 if v != nil { 3789 var location string 3790 err = json.Unmarshal(*v, &location) 3791 if err != nil { 3792 return err 3793 } 3794 t.Location = &location 3795 } 3796 case "tags": 3797 if v != nil { 3798 var tags map[string]*string 3799 err = json.Unmarshal(*v, &tags) 3800 if err != nil { 3801 return err 3802 } 3803 t.Tags = tags 3804 } 3805 } 3806 } 3807 3808 return nil 3809} 3810 3811// TaskListResult the collection of tasks. 3812type TaskListResult struct { 3813 autorest.Response `json:"-"` 3814 // Value - The collection value. 3815 Value *[]Task `json:"value,omitempty"` 3816 // NextLink - The URI that can be used to request the next set of paged results. 3817 NextLink *string `json:"nextLink,omitempty"` 3818} 3819 3820// TaskListResultIterator provides access to a complete listing of Task values. 3821type TaskListResultIterator struct { 3822 i int 3823 page TaskListResultPage 3824} 3825 3826// NextWithContext advances to the next value. If there was an error making 3827// the request the iterator does not advance and the error is returned. 3828func (iter *TaskListResultIterator) NextWithContext(ctx context.Context) (err error) { 3829 if tracing.IsEnabled() { 3830 ctx = tracing.StartSpan(ctx, fqdn+"/TaskListResultIterator.NextWithContext") 3831 defer func() { 3832 sc := -1 3833 if iter.Response().Response.Response != nil { 3834 sc = iter.Response().Response.Response.StatusCode 3835 } 3836 tracing.EndSpan(ctx, sc, err) 3837 }() 3838 } 3839 iter.i++ 3840 if iter.i < len(iter.page.Values()) { 3841 return nil 3842 } 3843 err = iter.page.NextWithContext(ctx) 3844 if err != nil { 3845 iter.i-- 3846 return err 3847 } 3848 iter.i = 0 3849 return nil 3850} 3851 3852// Next advances to the next value. If there was an error making 3853// the request the iterator does not advance and the error is returned. 3854// Deprecated: Use NextWithContext() instead. 3855func (iter *TaskListResultIterator) Next() error { 3856 return iter.NextWithContext(context.Background()) 3857} 3858 3859// NotDone returns true if the enumeration should be started or is not yet complete. 3860func (iter TaskListResultIterator) NotDone() bool { 3861 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3862} 3863 3864// Response returns the raw server response from the last page request. 3865func (iter TaskListResultIterator) Response() TaskListResult { 3866 return iter.page.Response() 3867} 3868 3869// Value returns the current value or a zero-initialized value if the 3870// iterator has advanced beyond the end of the collection. 3871func (iter TaskListResultIterator) Value() Task { 3872 if !iter.page.NotDone() { 3873 return Task{} 3874 } 3875 return iter.page.Values()[iter.i] 3876} 3877 3878// Creates a new instance of the TaskListResultIterator type. 3879func NewTaskListResultIterator(page TaskListResultPage) TaskListResultIterator { 3880 return TaskListResultIterator{page: page} 3881} 3882 3883// IsEmpty returns true if the ListResult contains no values. 3884func (tlr TaskListResult) IsEmpty() bool { 3885 return tlr.Value == nil || len(*tlr.Value) == 0 3886} 3887 3888// taskListResultPreparer prepares a request to retrieve the next set of results. 3889// It returns nil if no more results exist. 3890func (tlr TaskListResult) taskListResultPreparer(ctx context.Context) (*http.Request, error) { 3891 if tlr.NextLink == nil || len(to.String(tlr.NextLink)) < 1 { 3892 return nil, nil 3893 } 3894 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3895 autorest.AsJSON(), 3896 autorest.AsGet(), 3897 autorest.WithBaseURL(to.String(tlr.NextLink))) 3898} 3899 3900// TaskListResultPage contains a page of Task values. 3901type TaskListResultPage struct { 3902 fn func(context.Context, TaskListResult) (TaskListResult, error) 3903 tlr TaskListResult 3904} 3905 3906// NextWithContext advances to the next page of values. If there was an error making 3907// the request the page does not advance and the error is returned. 3908func (page *TaskListResultPage) NextWithContext(ctx context.Context) (err error) { 3909 if tracing.IsEnabled() { 3910 ctx = tracing.StartSpan(ctx, fqdn+"/TaskListResultPage.NextWithContext") 3911 defer func() { 3912 sc := -1 3913 if page.Response().Response.Response != nil { 3914 sc = page.Response().Response.Response.StatusCode 3915 } 3916 tracing.EndSpan(ctx, sc, err) 3917 }() 3918 } 3919 next, err := page.fn(ctx, page.tlr) 3920 if err != nil { 3921 return err 3922 } 3923 page.tlr = next 3924 return nil 3925} 3926 3927// Next advances to the next page of values. If there was an error making 3928// the request the page does not advance and the error is returned. 3929// Deprecated: Use NextWithContext() instead. 3930func (page *TaskListResultPage) Next() error { 3931 return page.NextWithContext(context.Background()) 3932} 3933 3934// NotDone returns true if the page enumeration should be started or is not yet complete. 3935func (page TaskListResultPage) NotDone() bool { 3936 return !page.tlr.IsEmpty() 3937} 3938 3939// Response returns the raw server response from the last page request. 3940func (page TaskListResultPage) Response() TaskListResult { 3941 return page.tlr 3942} 3943 3944// Values returns the slice of values for the current page or nil if there are no values. 3945func (page TaskListResultPage) Values() []Task { 3946 if page.tlr.IsEmpty() { 3947 return nil 3948 } 3949 return *page.tlr.Value 3950} 3951 3952// Creates a new instance of the TaskListResultPage type. 3953func NewTaskListResultPage(getNextPage func(context.Context, TaskListResult) (TaskListResult, error)) TaskListResultPage { 3954 return TaskListResultPage{fn: getNextPage} 3955} 3956 3957// TaskProperties the properties of a task. 3958type TaskProperties struct { 3959 // ProvisioningState - READ-ONLY; The provisioning state of the task. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' 3960 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 3961 // CreationDate - READ-ONLY; The creation date of task. 3962 CreationDate *date.Time `json:"creationDate,omitempty"` 3963 // Status - The current status of task. Possible values include: 'TaskStatusDisabled', 'TaskStatusEnabled' 3964 Status TaskStatus `json:"status,omitempty"` 3965 // Platform - The platform properties against which the run has to happen. 3966 Platform *PlatformProperties `json:"platform,omitempty"` 3967 // AgentConfiguration - The machine configuration of the run agent. 3968 AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` 3969 // Timeout - Run timeout in seconds. 3970 Timeout *int32 `json:"timeout,omitempty"` 3971 // Step - The properties of a task step. 3972 Step BasicTaskStepProperties `json:"step,omitempty"` 3973 // Trigger - The properties that describe all triggers for the task. 3974 Trigger *TriggerProperties `json:"trigger,omitempty"` 3975 // Credentials - The properties that describes a set of credentials that will be used when this run is invoked. 3976 Credentials *Credentials `json:"credentials,omitempty"` 3977} 3978 3979// UnmarshalJSON is the custom unmarshaler for TaskProperties struct. 3980func (tp *TaskProperties) UnmarshalJSON(body []byte) error { 3981 var m map[string]*json.RawMessage 3982 err := json.Unmarshal(body, &m) 3983 if err != nil { 3984 return err 3985 } 3986 for k, v := range m { 3987 switch k { 3988 case "provisioningState": 3989 if v != nil { 3990 var provisioningState ProvisioningState 3991 err = json.Unmarshal(*v, &provisioningState) 3992 if err != nil { 3993 return err 3994 } 3995 tp.ProvisioningState = provisioningState 3996 } 3997 case "creationDate": 3998 if v != nil { 3999 var creationDate date.Time 4000 err = json.Unmarshal(*v, &creationDate) 4001 if err != nil { 4002 return err 4003 } 4004 tp.CreationDate = &creationDate 4005 } 4006 case "status": 4007 if v != nil { 4008 var status TaskStatus 4009 err = json.Unmarshal(*v, &status) 4010 if err != nil { 4011 return err 4012 } 4013 tp.Status = status 4014 } 4015 case "platform": 4016 if v != nil { 4017 var platform PlatformProperties 4018 err = json.Unmarshal(*v, &platform) 4019 if err != nil { 4020 return err 4021 } 4022 tp.Platform = &platform 4023 } 4024 case "agentConfiguration": 4025 if v != nil { 4026 var agentConfiguration AgentProperties 4027 err = json.Unmarshal(*v, &agentConfiguration) 4028 if err != nil { 4029 return err 4030 } 4031 tp.AgentConfiguration = &agentConfiguration 4032 } 4033 case "timeout": 4034 if v != nil { 4035 var timeout int32 4036 err = json.Unmarshal(*v, &timeout) 4037 if err != nil { 4038 return err 4039 } 4040 tp.Timeout = &timeout 4041 } 4042 case "step": 4043 if v != nil { 4044 step, err := unmarshalBasicTaskStepProperties(*v) 4045 if err != nil { 4046 return err 4047 } 4048 tp.Step = step 4049 } 4050 case "trigger": 4051 if v != nil { 4052 var trigger TriggerProperties 4053 err = json.Unmarshal(*v, &trigger) 4054 if err != nil { 4055 return err 4056 } 4057 tp.Trigger = &trigger 4058 } 4059 case "credentials": 4060 if v != nil { 4061 var credentials Credentials 4062 err = json.Unmarshal(*v, &credentials) 4063 if err != nil { 4064 return err 4065 } 4066 tp.Credentials = &credentials 4067 } 4068 } 4069 } 4070 4071 return nil 4072} 4073 4074// TaskPropertiesUpdateParameters the properties for updating a task. 4075type TaskPropertiesUpdateParameters struct { 4076 // Status - The current status of task. Possible values include: 'TaskStatusDisabled', 'TaskStatusEnabled' 4077 Status TaskStatus `json:"status,omitempty"` 4078 // Platform - The platform properties against which the run has to happen. 4079 Platform *PlatformUpdateParameters `json:"platform,omitempty"` 4080 // AgentConfiguration - The machine configuration of the run agent. 4081 AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` 4082 // Timeout - Run timeout in seconds. 4083 Timeout *int32 `json:"timeout,omitempty"` 4084 // Step - The properties for updating a task step. 4085 Step BasicTaskStepUpdateParameters `json:"step,omitempty"` 4086 // Trigger - The properties for updating trigger properties. 4087 Trigger *TriggerUpdateParameters `json:"trigger,omitempty"` 4088 // Credentials - The parameters that describes a set of credentials that will be used when this run is invoked. 4089 Credentials *Credentials `json:"credentials,omitempty"` 4090} 4091 4092// UnmarshalJSON is the custom unmarshaler for TaskPropertiesUpdateParameters struct. 4093func (tpup *TaskPropertiesUpdateParameters) UnmarshalJSON(body []byte) error { 4094 var m map[string]*json.RawMessage 4095 err := json.Unmarshal(body, &m) 4096 if err != nil { 4097 return err 4098 } 4099 for k, v := range m { 4100 switch k { 4101 case "status": 4102 if v != nil { 4103 var status TaskStatus 4104 err = json.Unmarshal(*v, &status) 4105 if err != nil { 4106 return err 4107 } 4108 tpup.Status = status 4109 } 4110 case "platform": 4111 if v != nil { 4112 var platform PlatformUpdateParameters 4113 err = json.Unmarshal(*v, &platform) 4114 if err != nil { 4115 return err 4116 } 4117 tpup.Platform = &platform 4118 } 4119 case "agentConfiguration": 4120 if v != nil { 4121 var agentConfiguration AgentProperties 4122 err = json.Unmarshal(*v, &agentConfiguration) 4123 if err != nil { 4124 return err 4125 } 4126 tpup.AgentConfiguration = &agentConfiguration 4127 } 4128 case "timeout": 4129 if v != nil { 4130 var timeout int32 4131 err = json.Unmarshal(*v, &timeout) 4132 if err != nil { 4133 return err 4134 } 4135 tpup.Timeout = &timeout 4136 } 4137 case "step": 4138 if v != nil { 4139 step, err := unmarshalBasicTaskStepUpdateParameters(*v) 4140 if err != nil { 4141 return err 4142 } 4143 tpup.Step = step 4144 } 4145 case "trigger": 4146 if v != nil { 4147 var trigger TriggerUpdateParameters 4148 err = json.Unmarshal(*v, &trigger) 4149 if err != nil { 4150 return err 4151 } 4152 tpup.Trigger = &trigger 4153 } 4154 case "credentials": 4155 if v != nil { 4156 var credentials Credentials 4157 err = json.Unmarshal(*v, &credentials) 4158 if err != nil { 4159 return err 4160 } 4161 tpup.Credentials = &credentials 4162 } 4163 } 4164 } 4165 4166 return nil 4167} 4168 4169// TaskRunRequest the parameters for a task run request. 4170type TaskRunRequest struct { 4171 // TaskID - The resource ID of task against which run has to be queued. 4172 TaskID *string `json:"taskId,omitempty"` 4173 // OverrideTaskStepProperties - Set of overridable parameters that can be passed when running a Task. 4174 OverrideTaskStepProperties *OverrideTaskStepProperties `json:"overrideTaskStepProperties,omitempty"` 4175 // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. 4176 IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` 4177 // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' 4178 Type Type `json:"type,omitempty"` 4179} 4180 4181// MarshalJSON is the custom marshaler for TaskRunRequest. 4182func (trr TaskRunRequest) MarshalJSON() ([]byte, error) { 4183 trr.Type = TypeTaskRunRequest 4184 objectMap := make(map[string]interface{}) 4185 if trr.TaskID != nil { 4186 objectMap["taskId"] = trr.TaskID 4187 } 4188 if trr.OverrideTaskStepProperties != nil { 4189 objectMap["overrideTaskStepProperties"] = trr.OverrideTaskStepProperties 4190 } 4191 if trr.IsArchiveEnabled != nil { 4192 objectMap["isArchiveEnabled"] = trr.IsArchiveEnabled 4193 } 4194 if trr.Type != "" { 4195 objectMap["type"] = trr.Type 4196 } 4197 return json.Marshal(objectMap) 4198} 4199 4200// AsDockerBuildRequest is the BasicRunRequest implementation for TaskRunRequest. 4201func (trr TaskRunRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { 4202 return nil, false 4203} 4204 4205// AsFileTaskRunRequest is the BasicRunRequest implementation for TaskRunRequest. 4206func (trr TaskRunRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { 4207 return nil, false 4208} 4209 4210// AsTaskRunRequest is the BasicRunRequest implementation for TaskRunRequest. 4211func (trr TaskRunRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { 4212 return &trr, true 4213} 4214 4215// AsEncodedTaskRunRequest is the BasicRunRequest implementation for TaskRunRequest. 4216func (trr TaskRunRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { 4217 return nil, false 4218} 4219 4220// AsRunRequest is the BasicRunRequest implementation for TaskRunRequest. 4221func (trr TaskRunRequest) AsRunRequest() (*RunRequest, bool) { 4222 return nil, false 4223} 4224 4225// AsBasicRunRequest is the BasicRunRequest implementation for TaskRunRequest. 4226func (trr TaskRunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { 4227 return &trr, true 4228} 4229 4230// TasksCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 4231type TasksCreateFuture struct { 4232 azure.Future 4233} 4234 4235// Result returns the result of the asynchronous operation. 4236// If the operation has not completed it will return an error. 4237func (future *TasksCreateFuture) Result(client TasksClient) (t Task, err error) { 4238 var done bool 4239 done, err = future.DoneWithContext(context.Background(), client) 4240 if err != nil { 4241 err = autorest.NewErrorWithError(err, "containerregistry.TasksCreateFuture", "Result", future.Response(), "Polling failure") 4242 return 4243 } 4244 if !done { 4245 err = azure.NewAsyncOpIncompleteError("containerregistry.TasksCreateFuture") 4246 return 4247 } 4248 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4249 if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { 4250 t, err = client.CreateResponder(t.Response.Response) 4251 if err != nil { 4252 err = autorest.NewErrorWithError(err, "containerregistry.TasksCreateFuture", "Result", t.Response.Response, "Failure responding to request") 4253 } 4254 } 4255 return 4256} 4257 4258// TasksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. 4259type TasksDeleteFuture struct { 4260 azure.Future 4261} 4262 4263// Result returns the result of the asynchronous operation. 4264// If the operation has not completed it will return an error. 4265func (future *TasksDeleteFuture) Result(client TasksClient) (ar autorest.Response, err error) { 4266 var done bool 4267 done, err = future.DoneWithContext(context.Background(), client) 4268 if err != nil { 4269 err = autorest.NewErrorWithError(err, "containerregistry.TasksDeleteFuture", "Result", future.Response(), "Polling failure") 4270 return 4271 } 4272 if !done { 4273 err = azure.NewAsyncOpIncompleteError("containerregistry.TasksDeleteFuture") 4274 return 4275 } 4276 ar.Response = future.Response() 4277 return 4278} 4279 4280// BasicTaskStepProperties base properties for any task step. 4281type BasicTaskStepProperties interface { 4282 AsDockerBuildStep() (*DockerBuildStep, bool) 4283 AsFileTaskStep() (*FileTaskStep, bool) 4284 AsEncodedTaskStep() (*EncodedTaskStep, bool) 4285 AsTaskStepProperties() (*TaskStepProperties, bool) 4286} 4287 4288// TaskStepProperties base properties for any task step. 4289type TaskStepProperties struct { 4290 // BaseImageDependencies - READ-ONLY; List of base image dependencies for a step. 4291 BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` 4292 // ContextPath - The URL(absolute or relative) of the source context for the task step. 4293 ContextPath *string `json:"contextPath,omitempty"` 4294 // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. 4295 ContextAccessToken *string `json:"contextAccessToken,omitempty"` 4296 // Type - Possible values include: 'TypeTaskStepProperties', 'TypeDocker', 'TypeFileTask', 'TypeEncodedTask' 4297 Type TypeBasicTaskStepProperties `json:"type,omitempty"` 4298} 4299 4300func unmarshalBasicTaskStepProperties(body []byte) (BasicTaskStepProperties, error) { 4301 var m map[string]interface{} 4302 err := json.Unmarshal(body, &m) 4303 if err != nil { 4304 return nil, err 4305 } 4306 4307 switch m["type"] { 4308 case string(TypeDocker): 4309 var dbs DockerBuildStep 4310 err := json.Unmarshal(body, &dbs) 4311 return dbs, err 4312 case string(TypeFileTask): 4313 var fts FileTaskStep 4314 err := json.Unmarshal(body, &fts) 4315 return fts, err 4316 case string(TypeEncodedTask): 4317 var ets EncodedTaskStep 4318 err := json.Unmarshal(body, &ets) 4319 return ets, err 4320 default: 4321 var tsp TaskStepProperties 4322 err := json.Unmarshal(body, &tsp) 4323 return tsp, err 4324 } 4325} 4326func unmarshalBasicTaskStepPropertiesArray(body []byte) ([]BasicTaskStepProperties, error) { 4327 var rawMessages []*json.RawMessage 4328 err := json.Unmarshal(body, &rawMessages) 4329 if err != nil { 4330 return nil, err 4331 } 4332 4333 tspArray := make([]BasicTaskStepProperties, len(rawMessages)) 4334 4335 for index, rawMessage := range rawMessages { 4336 tsp, err := unmarshalBasicTaskStepProperties(*rawMessage) 4337 if err != nil { 4338 return nil, err 4339 } 4340 tspArray[index] = tsp 4341 } 4342 return tspArray, nil 4343} 4344 4345// MarshalJSON is the custom marshaler for TaskStepProperties. 4346func (tsp TaskStepProperties) MarshalJSON() ([]byte, error) { 4347 tsp.Type = TypeTaskStepProperties 4348 objectMap := make(map[string]interface{}) 4349 if tsp.ContextPath != nil { 4350 objectMap["contextPath"] = tsp.ContextPath 4351 } 4352 if tsp.ContextAccessToken != nil { 4353 objectMap["contextAccessToken"] = tsp.ContextAccessToken 4354 } 4355 if tsp.Type != "" { 4356 objectMap["type"] = tsp.Type 4357 } 4358 return json.Marshal(objectMap) 4359} 4360 4361// AsDockerBuildStep is the BasicTaskStepProperties implementation for TaskStepProperties. 4362func (tsp TaskStepProperties) AsDockerBuildStep() (*DockerBuildStep, bool) { 4363 return nil, false 4364} 4365 4366// AsFileTaskStep is the BasicTaskStepProperties implementation for TaskStepProperties. 4367func (tsp TaskStepProperties) AsFileTaskStep() (*FileTaskStep, bool) { 4368 return nil, false 4369} 4370 4371// AsEncodedTaskStep is the BasicTaskStepProperties implementation for TaskStepProperties. 4372func (tsp TaskStepProperties) AsEncodedTaskStep() (*EncodedTaskStep, bool) { 4373 return nil, false 4374} 4375 4376// AsTaskStepProperties is the BasicTaskStepProperties implementation for TaskStepProperties. 4377func (tsp TaskStepProperties) AsTaskStepProperties() (*TaskStepProperties, bool) { 4378 return &tsp, true 4379} 4380 4381// AsBasicTaskStepProperties is the BasicTaskStepProperties implementation for TaskStepProperties. 4382func (tsp TaskStepProperties) AsBasicTaskStepProperties() (BasicTaskStepProperties, bool) { 4383 return &tsp, true 4384} 4385 4386// BasicTaskStepUpdateParameters base properties for updating any task step. 4387type BasicTaskStepUpdateParameters interface { 4388 AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) 4389 AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) 4390 AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) 4391 AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) 4392} 4393 4394// TaskStepUpdateParameters base properties for updating any task step. 4395type TaskStepUpdateParameters struct { 4396 // ContextPath - The URL(absolute or relative) of the source context for the task step. 4397 ContextPath *string `json:"contextPath,omitempty"` 4398 // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. 4399 ContextAccessToken *string `json:"contextAccessToken,omitempty"` 4400 // Type - Possible values include: 'TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters', 'TypeBasicTaskStepUpdateParametersTypeDocker', 'TypeBasicTaskStepUpdateParametersTypeFileTask', 'TypeBasicTaskStepUpdateParametersTypeEncodedTask' 4401 Type TypeBasicTaskStepUpdateParameters `json:"type,omitempty"` 4402} 4403 4404func unmarshalBasicTaskStepUpdateParameters(body []byte) (BasicTaskStepUpdateParameters, error) { 4405 var m map[string]interface{} 4406 err := json.Unmarshal(body, &m) 4407 if err != nil { 4408 return nil, err 4409 } 4410 4411 switch m["type"] { 4412 case string(TypeBasicTaskStepUpdateParametersTypeDocker): 4413 var dbsup DockerBuildStepUpdateParameters 4414 err := json.Unmarshal(body, &dbsup) 4415 return dbsup, err 4416 case string(TypeBasicTaskStepUpdateParametersTypeFileTask): 4417 var ftsup FileTaskStepUpdateParameters 4418 err := json.Unmarshal(body, &ftsup) 4419 return ftsup, err 4420 case string(TypeBasicTaskStepUpdateParametersTypeEncodedTask): 4421 var etsup EncodedTaskStepUpdateParameters 4422 err := json.Unmarshal(body, &etsup) 4423 return etsup, err 4424 default: 4425 var tsup TaskStepUpdateParameters 4426 err := json.Unmarshal(body, &tsup) 4427 return tsup, err 4428 } 4429} 4430func unmarshalBasicTaskStepUpdateParametersArray(body []byte) ([]BasicTaskStepUpdateParameters, error) { 4431 var rawMessages []*json.RawMessage 4432 err := json.Unmarshal(body, &rawMessages) 4433 if err != nil { 4434 return nil, err 4435 } 4436 4437 tsupArray := make([]BasicTaskStepUpdateParameters, len(rawMessages)) 4438 4439 for index, rawMessage := range rawMessages { 4440 tsup, err := unmarshalBasicTaskStepUpdateParameters(*rawMessage) 4441 if err != nil { 4442 return nil, err 4443 } 4444 tsupArray[index] = tsup 4445 } 4446 return tsupArray, nil 4447} 4448 4449// MarshalJSON is the custom marshaler for TaskStepUpdateParameters. 4450func (tsup TaskStepUpdateParameters) MarshalJSON() ([]byte, error) { 4451 tsup.Type = TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters 4452 objectMap := make(map[string]interface{}) 4453 if tsup.ContextPath != nil { 4454 objectMap["contextPath"] = tsup.ContextPath 4455 } 4456 if tsup.ContextAccessToken != nil { 4457 objectMap["contextAccessToken"] = tsup.ContextAccessToken 4458 } 4459 if tsup.Type != "" { 4460 objectMap["type"] = tsup.Type 4461 } 4462 return json.Marshal(objectMap) 4463} 4464 4465// AsDockerBuildStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. 4466func (tsup TaskStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { 4467 return nil, false 4468} 4469 4470// AsFileTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. 4471func (tsup TaskStepUpdateParameters) AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) { 4472 return nil, false 4473} 4474 4475// AsEncodedTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. 4476func (tsup TaskStepUpdateParameters) AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) { 4477 return nil, false 4478} 4479 4480// AsTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. 4481func (tsup TaskStepUpdateParameters) AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) { 4482 return &tsup, true 4483} 4484 4485// AsBasicTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. 4486func (tsup TaskStepUpdateParameters) AsBasicTaskStepUpdateParameters() (BasicTaskStepUpdateParameters, bool) { 4487 return &tsup, true 4488} 4489 4490// TasksUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 4491type TasksUpdateFuture struct { 4492 azure.Future 4493} 4494 4495// Result returns the result of the asynchronous operation. 4496// If the operation has not completed it will return an error. 4497func (future *TasksUpdateFuture) Result(client TasksClient) (t Task, err error) { 4498 var done bool 4499 done, err = future.DoneWithContext(context.Background(), client) 4500 if err != nil { 4501 err = autorest.NewErrorWithError(err, "containerregistry.TasksUpdateFuture", "Result", future.Response(), "Polling failure") 4502 return 4503 } 4504 if !done { 4505 err = azure.NewAsyncOpIncompleteError("containerregistry.TasksUpdateFuture") 4506 return 4507 } 4508 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4509 if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { 4510 t, err = client.UpdateResponder(t.Response.Response) 4511 if err != nil { 4512 err = autorest.NewErrorWithError(err, "containerregistry.TasksUpdateFuture", "Result", t.Response.Response, "Failure responding to request") 4513 } 4514 } 4515 return 4516} 4517 4518// TaskUpdateParameters the parameters for updating a task. 4519type TaskUpdateParameters struct { 4520 // Identity - Identity for the resource. 4521 Identity *IdentityProperties `json:"identity,omitempty"` 4522 // TaskPropertiesUpdateParameters - The properties for updating a task. 4523 *TaskPropertiesUpdateParameters `json:"properties,omitempty"` 4524 // Tags - The ARM resource tags. 4525 Tags map[string]*string `json:"tags"` 4526} 4527 4528// MarshalJSON is the custom marshaler for TaskUpdateParameters. 4529func (tup TaskUpdateParameters) MarshalJSON() ([]byte, error) { 4530 objectMap := make(map[string]interface{}) 4531 if tup.Identity != nil { 4532 objectMap["identity"] = tup.Identity 4533 } 4534 if tup.TaskPropertiesUpdateParameters != nil { 4535 objectMap["properties"] = tup.TaskPropertiesUpdateParameters 4536 } 4537 if tup.Tags != nil { 4538 objectMap["tags"] = tup.Tags 4539 } 4540 return json.Marshal(objectMap) 4541} 4542 4543// UnmarshalJSON is the custom unmarshaler for TaskUpdateParameters struct. 4544func (tup *TaskUpdateParameters) UnmarshalJSON(body []byte) error { 4545 var m map[string]*json.RawMessage 4546 err := json.Unmarshal(body, &m) 4547 if err != nil { 4548 return err 4549 } 4550 for k, v := range m { 4551 switch k { 4552 case "identity": 4553 if v != nil { 4554 var identity IdentityProperties 4555 err = json.Unmarshal(*v, &identity) 4556 if err != nil { 4557 return err 4558 } 4559 tup.Identity = &identity 4560 } 4561 case "properties": 4562 if v != nil { 4563 var taskPropertiesUpdateParameters TaskPropertiesUpdateParameters 4564 err = json.Unmarshal(*v, &taskPropertiesUpdateParameters) 4565 if err != nil { 4566 return err 4567 } 4568 tup.TaskPropertiesUpdateParameters = &taskPropertiesUpdateParameters 4569 } 4570 case "tags": 4571 if v != nil { 4572 var tags map[string]*string 4573 err = json.Unmarshal(*v, &tags) 4574 if err != nil { 4575 return err 4576 } 4577 tup.Tags = tags 4578 } 4579 } 4580 } 4581 4582 return nil 4583} 4584 4585// TimerTrigger the properties of a timer trigger. 4586type TimerTrigger struct { 4587 // Schedule - The CRON expression for the task schedule 4588 Schedule *string `json:"schedule,omitempty"` 4589 // Status - The current status of trigger. Possible values include: 'TriggerStatusDisabled', 'TriggerStatusEnabled' 4590 Status TriggerStatus `json:"status,omitempty"` 4591 // Name - The name of the trigger. 4592 Name *string `json:"name,omitempty"` 4593} 4594 4595// TimerTriggerDescriptor ... 4596type TimerTriggerDescriptor struct { 4597 // TimerTriggerName - The timer trigger name that caused the run. 4598 TimerTriggerName *string `json:"timerTriggerName,omitempty"` 4599 // ScheduleOccurrence - The occurrence that triggered the run. 4600 ScheduleOccurrence *string `json:"scheduleOccurrence,omitempty"` 4601} 4602 4603// TimerTriggerUpdateParameters the properties for updating a timer trigger. 4604type TimerTriggerUpdateParameters struct { 4605 // Schedule - The CRON expression for the task schedule 4606 Schedule *string `json:"schedule,omitempty"` 4607 // Status - The current status of trigger. Possible values include: 'TriggerStatusDisabled', 'TriggerStatusEnabled' 4608 Status TriggerStatus `json:"status,omitempty"` 4609 // Name - The name of the trigger. 4610 Name *string `json:"name,omitempty"` 4611} 4612 4613// TriggerProperties the properties of a trigger. 4614type TriggerProperties struct { 4615 // TimerTriggers - The collection of timer triggers. 4616 TimerTriggers *[]TimerTrigger `json:"timerTriggers,omitempty"` 4617 // SourceTriggers - The collection of triggers based on source code repository. 4618 SourceTriggers *[]SourceTrigger `json:"sourceTriggers,omitempty"` 4619 // BaseImageTrigger - The trigger based on base image dependencies. 4620 BaseImageTrigger *BaseImageTrigger `json:"baseImageTrigger,omitempty"` 4621} 4622 4623// TriggerUpdateParameters the properties for updating triggers. 4624type TriggerUpdateParameters struct { 4625 // TimerTriggers - The collection of timer triggers. 4626 TimerTriggers *[]TimerTriggerUpdateParameters `json:"timerTriggers,omitempty"` 4627 // SourceTriggers - The collection of triggers based on source code repository. 4628 SourceTriggers *[]SourceTriggerUpdateParameters `json:"sourceTriggers,omitempty"` 4629 // BaseImageTrigger - The trigger based on base image dependencies. 4630 BaseImageTrigger *BaseImageTriggerUpdateParameters `json:"baseImageTrigger,omitempty"` 4631} 4632 4633// TrustPolicy the content trust policy for a container registry. 4634type TrustPolicy struct { 4635 // Type - The type of trust policy. Possible values include: 'Notary' 4636 Type TrustPolicyType `json:"type,omitempty"` 4637 // Status - The value that indicates whether the policy is enabled or not. Possible values include: 'Enabled', 'Disabled' 4638 Status PolicyStatus `json:"status,omitempty"` 4639} 4640 4641// UserIdentityProperties ... 4642type UserIdentityProperties struct { 4643 // PrincipalID - The principal id of user assigned identity. 4644 PrincipalID *string `json:"principalId,omitempty"` 4645 // ClientID - The client id of user assigned identity. 4646 ClientID *string `json:"clientId,omitempty"` 4647} 4648 4649// VirtualNetworkRule virtual network rule. 4650type VirtualNetworkRule struct { 4651 // Action - The action of virtual network rule. Possible values include: 'Allow' 4652 Action Action `json:"action,omitempty"` 4653 // VirtualNetworkResourceID - Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. 4654 VirtualNetworkResourceID *string `json:"id,omitempty"` 4655} 4656 4657// Webhook an object that represents a webhook for a container registry. 4658type Webhook struct { 4659 autorest.Response `json:"-"` 4660 // WebhookProperties - The properties of the webhook. 4661 *WebhookProperties `json:"properties,omitempty"` 4662 // ID - READ-ONLY; The resource ID. 4663 ID *string `json:"id,omitempty"` 4664 // Name - READ-ONLY; The name of the resource. 4665 Name *string `json:"name,omitempty"` 4666 // Type - READ-ONLY; The type of the resource. 4667 Type *string `json:"type,omitempty"` 4668 // Location - The location of the resource. This cannot be changed after the resource is created. 4669 Location *string `json:"location,omitempty"` 4670 // Tags - The tags of the resource. 4671 Tags map[string]*string `json:"tags"` 4672} 4673 4674// MarshalJSON is the custom marshaler for Webhook. 4675func (w Webhook) MarshalJSON() ([]byte, error) { 4676 objectMap := make(map[string]interface{}) 4677 if w.WebhookProperties != nil { 4678 objectMap["properties"] = w.WebhookProperties 4679 } 4680 if w.Location != nil { 4681 objectMap["location"] = w.Location 4682 } 4683 if w.Tags != nil { 4684 objectMap["tags"] = w.Tags 4685 } 4686 return json.Marshal(objectMap) 4687} 4688 4689// UnmarshalJSON is the custom unmarshaler for Webhook struct. 4690func (w *Webhook) UnmarshalJSON(body []byte) error { 4691 var m map[string]*json.RawMessage 4692 err := json.Unmarshal(body, &m) 4693 if err != nil { 4694 return err 4695 } 4696 for k, v := range m { 4697 switch k { 4698 case "properties": 4699 if v != nil { 4700 var webhookProperties WebhookProperties 4701 err = json.Unmarshal(*v, &webhookProperties) 4702 if err != nil { 4703 return err 4704 } 4705 w.WebhookProperties = &webhookProperties 4706 } 4707 case "id": 4708 if v != nil { 4709 var ID string 4710 err = json.Unmarshal(*v, &ID) 4711 if err != nil { 4712 return err 4713 } 4714 w.ID = &ID 4715 } 4716 case "name": 4717 if v != nil { 4718 var name string 4719 err = json.Unmarshal(*v, &name) 4720 if err != nil { 4721 return err 4722 } 4723 w.Name = &name 4724 } 4725 case "type": 4726 if v != nil { 4727 var typeVar string 4728 err = json.Unmarshal(*v, &typeVar) 4729 if err != nil { 4730 return err 4731 } 4732 w.Type = &typeVar 4733 } 4734 case "location": 4735 if v != nil { 4736 var location string 4737 err = json.Unmarshal(*v, &location) 4738 if err != nil { 4739 return err 4740 } 4741 w.Location = &location 4742 } 4743 case "tags": 4744 if v != nil { 4745 var tags map[string]*string 4746 err = json.Unmarshal(*v, &tags) 4747 if err != nil { 4748 return err 4749 } 4750 w.Tags = tags 4751 } 4752 } 4753 } 4754 4755 return nil 4756} 4757 4758// WebhookCreateParameters the parameters for creating a webhook. 4759type WebhookCreateParameters struct { 4760 // Tags - The tags for the webhook. 4761 Tags map[string]*string `json:"tags"` 4762 // Location - The location of the webhook. This cannot be changed after the resource is created. 4763 Location *string `json:"location,omitempty"` 4764 // WebhookPropertiesCreateParameters - The properties that the webhook will be created with. 4765 *WebhookPropertiesCreateParameters `json:"properties,omitempty"` 4766} 4767 4768// MarshalJSON is the custom marshaler for WebhookCreateParameters. 4769func (wcp WebhookCreateParameters) MarshalJSON() ([]byte, error) { 4770 objectMap := make(map[string]interface{}) 4771 if wcp.Tags != nil { 4772 objectMap["tags"] = wcp.Tags 4773 } 4774 if wcp.Location != nil { 4775 objectMap["location"] = wcp.Location 4776 } 4777 if wcp.WebhookPropertiesCreateParameters != nil { 4778 objectMap["properties"] = wcp.WebhookPropertiesCreateParameters 4779 } 4780 return json.Marshal(objectMap) 4781} 4782 4783// UnmarshalJSON is the custom unmarshaler for WebhookCreateParameters struct. 4784func (wcp *WebhookCreateParameters) UnmarshalJSON(body []byte) error { 4785 var m map[string]*json.RawMessage 4786 err := json.Unmarshal(body, &m) 4787 if err != nil { 4788 return err 4789 } 4790 for k, v := range m { 4791 switch k { 4792 case "tags": 4793 if v != nil { 4794 var tags map[string]*string 4795 err = json.Unmarshal(*v, &tags) 4796 if err != nil { 4797 return err 4798 } 4799 wcp.Tags = tags 4800 } 4801 case "location": 4802 if v != nil { 4803 var location string 4804 err = json.Unmarshal(*v, &location) 4805 if err != nil { 4806 return err 4807 } 4808 wcp.Location = &location 4809 } 4810 case "properties": 4811 if v != nil { 4812 var webhookPropertiesCreateParameters WebhookPropertiesCreateParameters 4813 err = json.Unmarshal(*v, &webhookPropertiesCreateParameters) 4814 if err != nil { 4815 return err 4816 } 4817 wcp.WebhookPropertiesCreateParameters = &webhookPropertiesCreateParameters 4818 } 4819 } 4820 } 4821 4822 return nil 4823} 4824 4825// WebhookListResult the result of a request to list webhooks for a container registry. 4826type WebhookListResult struct { 4827 autorest.Response `json:"-"` 4828 // Value - The list of webhooks. Since this list may be incomplete, the nextLink field should be used to request the next list of webhooks. 4829 Value *[]Webhook `json:"value,omitempty"` 4830 // NextLink - The URI that can be used to request the next list of webhooks. 4831 NextLink *string `json:"nextLink,omitempty"` 4832} 4833 4834// WebhookListResultIterator provides access to a complete listing of Webhook values. 4835type WebhookListResultIterator struct { 4836 i int 4837 page WebhookListResultPage 4838} 4839 4840// NextWithContext advances to the next value. If there was an error making 4841// the request the iterator does not advance and the error is returned. 4842func (iter *WebhookListResultIterator) NextWithContext(ctx context.Context) (err error) { 4843 if tracing.IsEnabled() { 4844 ctx = tracing.StartSpan(ctx, fqdn+"/WebhookListResultIterator.NextWithContext") 4845 defer func() { 4846 sc := -1 4847 if iter.Response().Response.Response != nil { 4848 sc = iter.Response().Response.Response.StatusCode 4849 } 4850 tracing.EndSpan(ctx, sc, err) 4851 }() 4852 } 4853 iter.i++ 4854 if iter.i < len(iter.page.Values()) { 4855 return nil 4856 } 4857 err = iter.page.NextWithContext(ctx) 4858 if err != nil { 4859 iter.i-- 4860 return err 4861 } 4862 iter.i = 0 4863 return nil 4864} 4865 4866// Next advances to the next value. If there was an error making 4867// the request the iterator does not advance and the error is returned. 4868// Deprecated: Use NextWithContext() instead. 4869func (iter *WebhookListResultIterator) Next() error { 4870 return iter.NextWithContext(context.Background()) 4871} 4872 4873// NotDone returns true if the enumeration should be started or is not yet complete. 4874func (iter WebhookListResultIterator) NotDone() bool { 4875 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 4876} 4877 4878// Response returns the raw server response from the last page request. 4879func (iter WebhookListResultIterator) Response() WebhookListResult { 4880 return iter.page.Response() 4881} 4882 4883// Value returns the current value or a zero-initialized value if the 4884// iterator has advanced beyond the end of the collection. 4885func (iter WebhookListResultIterator) Value() Webhook { 4886 if !iter.page.NotDone() { 4887 return Webhook{} 4888 } 4889 return iter.page.Values()[iter.i] 4890} 4891 4892// Creates a new instance of the WebhookListResultIterator type. 4893func NewWebhookListResultIterator(page WebhookListResultPage) WebhookListResultIterator { 4894 return WebhookListResultIterator{page: page} 4895} 4896 4897// IsEmpty returns true if the ListResult contains no values. 4898func (wlr WebhookListResult) IsEmpty() bool { 4899 return wlr.Value == nil || len(*wlr.Value) == 0 4900} 4901 4902// webhookListResultPreparer prepares a request to retrieve the next set of results. 4903// It returns nil if no more results exist. 4904func (wlr WebhookListResult) webhookListResultPreparer(ctx context.Context) (*http.Request, error) { 4905 if wlr.NextLink == nil || len(to.String(wlr.NextLink)) < 1 { 4906 return nil, nil 4907 } 4908 return autorest.Prepare((&http.Request{}).WithContext(ctx), 4909 autorest.AsJSON(), 4910 autorest.AsGet(), 4911 autorest.WithBaseURL(to.String(wlr.NextLink))) 4912} 4913 4914// WebhookListResultPage contains a page of Webhook values. 4915type WebhookListResultPage struct { 4916 fn func(context.Context, WebhookListResult) (WebhookListResult, error) 4917 wlr WebhookListResult 4918} 4919 4920// NextWithContext advances to the next page of values. If there was an error making 4921// the request the page does not advance and the error is returned. 4922func (page *WebhookListResultPage) NextWithContext(ctx context.Context) (err error) { 4923 if tracing.IsEnabled() { 4924 ctx = tracing.StartSpan(ctx, fqdn+"/WebhookListResultPage.NextWithContext") 4925 defer func() { 4926 sc := -1 4927 if page.Response().Response.Response != nil { 4928 sc = page.Response().Response.Response.StatusCode 4929 } 4930 tracing.EndSpan(ctx, sc, err) 4931 }() 4932 } 4933 next, err := page.fn(ctx, page.wlr) 4934 if err != nil { 4935 return err 4936 } 4937 page.wlr = next 4938 return nil 4939} 4940 4941// Next advances to the next page of values. If there was an error making 4942// the request the page does not advance and the error is returned. 4943// Deprecated: Use NextWithContext() instead. 4944func (page *WebhookListResultPage) Next() error { 4945 return page.NextWithContext(context.Background()) 4946} 4947 4948// NotDone returns true if the page enumeration should be started or is not yet complete. 4949func (page WebhookListResultPage) NotDone() bool { 4950 return !page.wlr.IsEmpty() 4951} 4952 4953// Response returns the raw server response from the last page request. 4954func (page WebhookListResultPage) Response() WebhookListResult { 4955 return page.wlr 4956} 4957 4958// Values returns the slice of values for the current page or nil if there are no values. 4959func (page WebhookListResultPage) Values() []Webhook { 4960 if page.wlr.IsEmpty() { 4961 return nil 4962 } 4963 return *page.wlr.Value 4964} 4965 4966// Creates a new instance of the WebhookListResultPage type. 4967func NewWebhookListResultPage(getNextPage func(context.Context, WebhookListResult) (WebhookListResult, error)) WebhookListResultPage { 4968 return WebhookListResultPage{fn: getNextPage} 4969} 4970 4971// WebhookProperties the properties of a webhook. 4972type WebhookProperties struct { 4973 // Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled' 4974 Status WebhookStatus `json:"status,omitempty"` 4975 // Scope - The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. 4976 Scope *string `json:"scope,omitempty"` 4977 // Actions - The list of actions that trigger the webhook to post notifications. 4978 Actions *[]WebhookAction `json:"actions,omitempty"` 4979 // ProvisioningState - READ-ONLY; The provisioning state of the webhook at the time the operation was called. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' 4980 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 4981} 4982 4983// WebhookPropertiesCreateParameters the parameters for creating the properties of a webhook. 4984type WebhookPropertiesCreateParameters struct { 4985 // ServiceURI - The service URI for the webhook to post notifications. 4986 ServiceURI *string `json:"serviceUri,omitempty"` 4987 // CustomHeaders - Custom headers that will be added to the webhook notifications. 4988 CustomHeaders map[string]*string `json:"customHeaders"` 4989 // Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled' 4990 Status WebhookStatus `json:"status,omitempty"` 4991 // Scope - The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. 4992 Scope *string `json:"scope,omitempty"` 4993 // Actions - The list of actions that trigger the webhook to post notifications. 4994 Actions *[]WebhookAction `json:"actions,omitempty"` 4995} 4996 4997// MarshalJSON is the custom marshaler for WebhookPropertiesCreateParameters. 4998func (wpcp WebhookPropertiesCreateParameters) MarshalJSON() ([]byte, error) { 4999 objectMap := make(map[string]interface{}) 5000 if wpcp.ServiceURI != nil { 5001 objectMap["serviceUri"] = wpcp.ServiceURI 5002 } 5003 if wpcp.CustomHeaders != nil { 5004 objectMap["customHeaders"] = wpcp.CustomHeaders 5005 } 5006 if wpcp.Status != "" { 5007 objectMap["status"] = wpcp.Status 5008 } 5009 if wpcp.Scope != nil { 5010 objectMap["scope"] = wpcp.Scope 5011 } 5012 if wpcp.Actions != nil { 5013 objectMap["actions"] = wpcp.Actions 5014 } 5015 return json.Marshal(objectMap) 5016} 5017 5018// WebhookPropertiesUpdateParameters the parameters for updating the properties of a webhook. 5019type WebhookPropertiesUpdateParameters struct { 5020 // ServiceURI - The service URI for the webhook to post notifications. 5021 ServiceURI *string `json:"serviceUri,omitempty"` 5022 // CustomHeaders - Custom headers that will be added to the webhook notifications. 5023 CustomHeaders map[string]*string `json:"customHeaders"` 5024 // Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled' 5025 Status WebhookStatus `json:"status,omitempty"` 5026 // Scope - The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. 5027 Scope *string `json:"scope,omitempty"` 5028 // Actions - The list of actions that trigger the webhook to post notifications. 5029 Actions *[]WebhookAction `json:"actions,omitempty"` 5030} 5031 5032// MarshalJSON is the custom marshaler for WebhookPropertiesUpdateParameters. 5033func (wpup WebhookPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { 5034 objectMap := make(map[string]interface{}) 5035 if wpup.ServiceURI != nil { 5036 objectMap["serviceUri"] = wpup.ServiceURI 5037 } 5038 if wpup.CustomHeaders != nil { 5039 objectMap["customHeaders"] = wpup.CustomHeaders 5040 } 5041 if wpup.Status != "" { 5042 objectMap["status"] = wpup.Status 5043 } 5044 if wpup.Scope != nil { 5045 objectMap["scope"] = wpup.Scope 5046 } 5047 if wpup.Actions != nil { 5048 objectMap["actions"] = wpup.Actions 5049 } 5050 return json.Marshal(objectMap) 5051} 5052 5053// WebhooksCreateFuture an abstraction for monitoring and retrieving the results of a long-running 5054// operation. 5055type WebhooksCreateFuture struct { 5056 azure.Future 5057} 5058 5059// Result returns the result of the asynchronous operation. 5060// If the operation has not completed it will return an error. 5061func (future *WebhooksCreateFuture) Result(client WebhooksClient) (w Webhook, err error) { 5062 var done bool 5063 done, err = future.DoneWithContext(context.Background(), client) 5064 if err != nil { 5065 err = autorest.NewErrorWithError(err, "containerregistry.WebhooksCreateFuture", "Result", future.Response(), "Polling failure") 5066 return 5067 } 5068 if !done { 5069 err = azure.NewAsyncOpIncompleteError("containerregistry.WebhooksCreateFuture") 5070 return 5071 } 5072 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5073 if w.Response.Response, err = future.GetResult(sender); err == nil && w.Response.Response.StatusCode != http.StatusNoContent { 5074 w, err = client.CreateResponder(w.Response.Response) 5075 if err != nil { 5076 err = autorest.NewErrorWithError(err, "containerregistry.WebhooksCreateFuture", "Result", w.Response.Response, "Failure responding to request") 5077 } 5078 } 5079 return 5080} 5081 5082// WebhooksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 5083// operation. 5084type WebhooksDeleteFuture struct { 5085 azure.Future 5086} 5087 5088// Result returns the result of the asynchronous operation. 5089// If the operation has not completed it will return an error. 5090func (future *WebhooksDeleteFuture) Result(client WebhooksClient) (ar autorest.Response, err error) { 5091 var done bool 5092 done, err = future.DoneWithContext(context.Background(), client) 5093 if err != nil { 5094 err = autorest.NewErrorWithError(err, "containerregistry.WebhooksDeleteFuture", "Result", future.Response(), "Polling failure") 5095 return 5096 } 5097 if !done { 5098 err = azure.NewAsyncOpIncompleteError("containerregistry.WebhooksDeleteFuture") 5099 return 5100 } 5101 ar.Response = future.Response() 5102 return 5103} 5104 5105// WebhooksUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 5106// operation. 5107type WebhooksUpdateFuture struct { 5108 azure.Future 5109} 5110 5111// Result returns the result of the asynchronous operation. 5112// If the operation has not completed it will return an error. 5113func (future *WebhooksUpdateFuture) Result(client WebhooksClient) (w Webhook, err error) { 5114 var done bool 5115 done, err = future.DoneWithContext(context.Background(), client) 5116 if err != nil { 5117 err = autorest.NewErrorWithError(err, "containerregistry.WebhooksUpdateFuture", "Result", future.Response(), "Polling failure") 5118 return 5119 } 5120 if !done { 5121 err = azure.NewAsyncOpIncompleteError("containerregistry.WebhooksUpdateFuture") 5122 return 5123 } 5124 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5125 if w.Response.Response, err = future.GetResult(sender); err == nil && w.Response.Response.StatusCode != http.StatusNoContent { 5126 w, err = client.UpdateResponder(w.Response.Response) 5127 if err != nil { 5128 err = autorest.NewErrorWithError(err, "containerregistry.WebhooksUpdateFuture", "Result", w.Response.Response, "Failure responding to request") 5129 } 5130 } 5131 return 5132} 5133 5134// WebhookUpdateParameters the parameters for updating a webhook. 5135type WebhookUpdateParameters struct { 5136 // Tags - The tags for the webhook. 5137 Tags map[string]*string `json:"tags"` 5138 // WebhookPropertiesUpdateParameters - The properties that the webhook will be updated with. 5139 *WebhookPropertiesUpdateParameters `json:"properties,omitempty"` 5140} 5141 5142// MarshalJSON is the custom marshaler for WebhookUpdateParameters. 5143func (wup WebhookUpdateParameters) MarshalJSON() ([]byte, error) { 5144 objectMap := make(map[string]interface{}) 5145 if wup.Tags != nil { 5146 objectMap["tags"] = wup.Tags 5147 } 5148 if wup.WebhookPropertiesUpdateParameters != nil { 5149 objectMap["properties"] = wup.WebhookPropertiesUpdateParameters 5150 } 5151 return json.Marshal(objectMap) 5152} 5153 5154// UnmarshalJSON is the custom unmarshaler for WebhookUpdateParameters struct. 5155func (wup *WebhookUpdateParameters) UnmarshalJSON(body []byte) error { 5156 var m map[string]*json.RawMessage 5157 err := json.Unmarshal(body, &m) 5158 if err != nil { 5159 return err 5160 } 5161 for k, v := range m { 5162 switch k { 5163 case "tags": 5164 if v != nil { 5165 var tags map[string]*string 5166 err = json.Unmarshal(*v, &tags) 5167 if err != nil { 5168 return err 5169 } 5170 wup.Tags = tags 5171 } 5172 case "properties": 5173 if v != nil { 5174 var webhookPropertiesUpdateParameters WebhookPropertiesUpdateParameters 5175 err = json.Unmarshal(*v, &webhookPropertiesUpdateParameters) 5176 if err != nil { 5177 return err 5178 } 5179 wup.WebhookPropertiesUpdateParameters = &webhookPropertiesUpdateParameters 5180 } 5181 } 5182 } 5183 5184 return nil 5185} 5186