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 "encoding/json" 22 "github.com/Azure/go-autorest/autorest" 23 "github.com/Azure/go-autorest/autorest/azure" 24 "github.com/Azure/go-autorest/autorest/date" 25 "github.com/Azure/go-autorest/autorest/to" 26 "net/http" 27) 28 29// BaseImageDependencyType enumerates the values for base image dependency type. 30type BaseImageDependencyType string 31 32const ( 33 // BuildTime ... 34 BuildTime BaseImageDependencyType = "BuildTime" 35 // RunTime ... 36 RunTime BaseImageDependencyType = "RunTime" 37) 38 39// PossibleBaseImageDependencyTypeValues returns an array of possible values for the BaseImageDependencyType const type. 40func PossibleBaseImageDependencyTypeValues() []BaseImageDependencyType { 41 return []BaseImageDependencyType{BuildTime, RunTime} 42} 43 44// BaseImageTriggerType enumerates the values for base image trigger type. 45type BaseImageTriggerType string 46 47const ( 48 // All ... 49 All BaseImageTriggerType = "All" 50 // None ... 51 None BaseImageTriggerType = "None" 52 // Runtime ... 53 Runtime BaseImageTriggerType = "Runtime" 54) 55 56// PossibleBaseImageTriggerTypeValues returns an array of possible values for the BaseImageTriggerType const type. 57func PossibleBaseImageTriggerTypeValues() []BaseImageTriggerType { 58 return []BaseImageTriggerType{All, None, Runtime} 59} 60 61// BuildStatus enumerates the values for build status. 62type BuildStatus string 63 64const ( 65 // Canceled ... 66 Canceled BuildStatus = "Canceled" 67 // Error ... 68 Error BuildStatus = "Error" 69 // Failed ... 70 Failed BuildStatus = "Failed" 71 // Queued ... 72 Queued BuildStatus = "Queued" 73 // Running ... 74 Running BuildStatus = "Running" 75 // Started ... 76 Started BuildStatus = "Started" 77 // Succeeded ... 78 Succeeded BuildStatus = "Succeeded" 79 // Timeout ... 80 Timeout BuildStatus = "Timeout" 81) 82 83// PossibleBuildStatusValues returns an array of possible values for the BuildStatus const type. 84func PossibleBuildStatusValues() []BuildStatus { 85 return []BuildStatus{Canceled, Error, Failed, Queued, Running, Started, Succeeded, Timeout} 86} 87 88// BuildTaskStatus enumerates the values for build task status. 89type BuildTaskStatus string 90 91const ( 92 // Disabled ... 93 Disabled BuildTaskStatus = "Disabled" 94 // Enabled ... 95 Enabled BuildTaskStatus = "Enabled" 96) 97 98// PossibleBuildTaskStatusValues returns an array of possible values for the BuildTaskStatus const type. 99func PossibleBuildTaskStatusValues() []BuildTaskStatus { 100 return []BuildTaskStatus{Disabled, Enabled} 101} 102 103// BuildType enumerates the values for build type. 104type BuildType string 105 106const ( 107 // AutoBuild ... 108 AutoBuild BuildType = "AutoBuild" 109 // QuickBuild ... 110 QuickBuild BuildType = "QuickBuild" 111) 112 113// PossibleBuildTypeValues returns an array of possible values for the BuildType const type. 114func PossibleBuildTypeValues() []BuildType { 115 return []BuildType{AutoBuild, QuickBuild} 116} 117 118// ImportMode enumerates the values for import mode. 119type ImportMode string 120 121const ( 122 // Force ... 123 Force ImportMode = "Force" 124 // NoForce ... 125 NoForce ImportMode = "NoForce" 126) 127 128// PossibleImportModeValues returns an array of possible values for the ImportMode const type. 129func PossibleImportModeValues() []ImportMode { 130 return []ImportMode{Force, NoForce} 131} 132 133// OsType enumerates the values for os type. 134type OsType string 135 136const ( 137 // Linux ... 138 Linux OsType = "Linux" 139 // Windows ... 140 Windows OsType = "Windows" 141) 142 143// PossibleOsTypeValues returns an array of possible values for the OsType const type. 144func PossibleOsTypeValues() []OsType { 145 return []OsType{Linux, Windows} 146} 147 148// PasswordName enumerates the values for password name. 149type PasswordName string 150 151const ( 152 // Password ... 153 Password PasswordName = "password" 154 // Password2 ... 155 Password2 PasswordName = "password2" 156) 157 158// PossiblePasswordNameValues returns an array of possible values for the PasswordName const type. 159func PossiblePasswordNameValues() []PasswordName { 160 return []PasswordName{Password, Password2} 161} 162 163// ProvisioningState enumerates the values for provisioning state. 164type ProvisioningState string 165 166const ( 167 // ProvisioningStateCanceled ... 168 ProvisioningStateCanceled ProvisioningState = "Canceled" 169 // ProvisioningStateCreating ... 170 ProvisioningStateCreating ProvisioningState = "Creating" 171 // ProvisioningStateDeleting ... 172 ProvisioningStateDeleting ProvisioningState = "Deleting" 173 // ProvisioningStateFailed ... 174 ProvisioningStateFailed ProvisioningState = "Failed" 175 // ProvisioningStateSucceeded ... 176 ProvisioningStateSucceeded ProvisioningState = "Succeeded" 177 // ProvisioningStateUpdating ... 178 ProvisioningStateUpdating ProvisioningState = "Updating" 179) 180 181// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. 182func PossibleProvisioningStateValues() []ProvisioningState { 183 return []ProvisioningState{ProvisioningStateCanceled, ProvisioningStateCreating, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateSucceeded, ProvisioningStateUpdating} 184} 185 186// RegistryUsageUnit enumerates the values for registry usage unit. 187type RegistryUsageUnit string 188 189const ( 190 // Bytes ... 191 Bytes RegistryUsageUnit = "Bytes" 192 // Count ... 193 Count RegistryUsageUnit = "Count" 194) 195 196// PossibleRegistryUsageUnitValues returns an array of possible values for the RegistryUsageUnit const type. 197func PossibleRegistryUsageUnitValues() []RegistryUsageUnit { 198 return []RegistryUsageUnit{Bytes, Count} 199} 200 201// SkuName enumerates the values for sku name. 202type SkuName string 203 204const ( 205 // Basic ... 206 Basic SkuName = "Basic" 207 // Classic ... 208 Classic SkuName = "Classic" 209 // Premium ... 210 Premium SkuName = "Premium" 211 // Standard ... 212 Standard SkuName = "Standard" 213) 214 215// PossibleSkuNameValues returns an array of possible values for the SkuName const type. 216func PossibleSkuNameValues() []SkuName { 217 return []SkuName{Basic, Classic, Premium, Standard} 218} 219 220// SkuTier enumerates the values for sku tier. 221type SkuTier string 222 223const ( 224 // SkuTierBasic ... 225 SkuTierBasic SkuTier = "Basic" 226 // SkuTierClassic ... 227 SkuTierClassic SkuTier = "Classic" 228 // SkuTierPremium ... 229 SkuTierPremium SkuTier = "Premium" 230 // SkuTierStandard ... 231 SkuTierStandard SkuTier = "Standard" 232) 233 234// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. 235func PossibleSkuTierValues() []SkuTier { 236 return []SkuTier{SkuTierBasic, SkuTierClassic, SkuTierPremium, SkuTierStandard} 237} 238 239// SourceControlType enumerates the values for source control type. 240type SourceControlType string 241 242const ( 243 // Github ... 244 Github SourceControlType = "Github" 245 // VisualStudioTeamService ... 246 VisualStudioTeamService SourceControlType = "VisualStudioTeamService" 247) 248 249// PossibleSourceControlTypeValues returns an array of possible values for the SourceControlType const type. 250func PossibleSourceControlTypeValues() []SourceControlType { 251 return []SourceControlType{Github, VisualStudioTeamService} 252} 253 254// TokenType enumerates the values for token type. 255type TokenType string 256 257const ( 258 // OAuth ... 259 OAuth TokenType = "OAuth" 260 // PAT ... 261 PAT TokenType = "PAT" 262) 263 264// PossibleTokenTypeValues returns an array of possible values for the TokenType const type. 265func PossibleTokenTypeValues() []TokenType { 266 return []TokenType{OAuth, PAT} 267} 268 269// Type enumerates the values for type. 270type Type string 271 272const ( 273 // TypeBuildStepProperties ... 274 TypeBuildStepProperties Type = "BuildStepProperties" 275 // TypeDocker ... 276 TypeDocker Type = "Docker" 277) 278 279// PossibleTypeValues returns an array of possible values for the Type const type. 280func PossibleTypeValues() []Type { 281 return []Type{TypeBuildStepProperties, TypeDocker} 282} 283 284// TypeBasicBuildStepPropertiesUpdateParameters enumerates the values for type basic build step properties 285// update parameters. 286type TypeBasicBuildStepPropertiesUpdateParameters string 287 288const ( 289 // TypeBasicBuildStepPropertiesUpdateParametersTypeBuildStepPropertiesUpdateParameters ... 290 TypeBasicBuildStepPropertiesUpdateParametersTypeBuildStepPropertiesUpdateParameters TypeBasicBuildStepPropertiesUpdateParameters = "BuildStepPropertiesUpdateParameters" 291 // TypeBasicBuildStepPropertiesUpdateParametersTypeDocker ... 292 TypeBasicBuildStepPropertiesUpdateParametersTypeDocker TypeBasicBuildStepPropertiesUpdateParameters = "Docker" 293) 294 295// PossibleTypeBasicBuildStepPropertiesUpdateParametersValues returns an array of possible values for the TypeBasicBuildStepPropertiesUpdateParameters const type. 296func PossibleTypeBasicBuildStepPropertiesUpdateParametersValues() []TypeBasicBuildStepPropertiesUpdateParameters { 297 return []TypeBasicBuildStepPropertiesUpdateParameters{TypeBasicBuildStepPropertiesUpdateParametersTypeBuildStepPropertiesUpdateParameters, TypeBasicBuildStepPropertiesUpdateParametersTypeDocker} 298} 299 300// TypeBasicQueueBuildRequest enumerates the values for type basic queue build request. 301type TypeBasicQueueBuildRequest string 302 303const ( 304 // TypeBuildTask ... 305 TypeBuildTask TypeBasicQueueBuildRequest = "BuildTask" 306 // TypeQueueBuildRequest ... 307 TypeQueueBuildRequest TypeBasicQueueBuildRequest = "QueueBuildRequest" 308 // TypeQuickBuild ... 309 TypeQuickBuild TypeBasicQueueBuildRequest = "QuickBuild" 310) 311 312// PossibleTypeBasicQueueBuildRequestValues returns an array of possible values for the TypeBasicQueueBuildRequest const type. 313func PossibleTypeBasicQueueBuildRequestValues() []TypeBasicQueueBuildRequest { 314 return []TypeBasicQueueBuildRequest{TypeBuildTask, TypeQueueBuildRequest, TypeQuickBuild} 315} 316 317// WebhookAction enumerates the values for webhook action. 318type WebhookAction string 319 320const ( 321 // Delete ... 322 Delete WebhookAction = "delete" 323 // Push ... 324 Push WebhookAction = "push" 325) 326 327// PossibleWebhookActionValues returns an array of possible values for the WebhookAction const type. 328func PossibleWebhookActionValues() []WebhookAction { 329 return []WebhookAction{Delete, Push} 330} 331 332// WebhookStatus enumerates the values for webhook status. 333type WebhookStatus string 334 335const ( 336 // WebhookStatusDisabled ... 337 WebhookStatusDisabled WebhookStatus = "disabled" 338 // WebhookStatusEnabled ... 339 WebhookStatusEnabled WebhookStatus = "enabled" 340) 341 342// PossibleWebhookStatusValues returns an array of possible values for the WebhookStatus const type. 343func PossibleWebhookStatusValues() []WebhookStatus { 344 return []WebhookStatus{WebhookStatusDisabled, WebhookStatusEnabled} 345} 346 347// Actor the agent that initiated the event. For most situations, this could be from the authorization context of 348// the request. 349type Actor struct { 350 // Name - The subject or username associated with the request context that generated the event. 351 Name *string `json:"name,omitempty"` 352} 353 354// BaseImageDependency properties that describe a base image dependency. 355type BaseImageDependency struct { 356 // Type - The type of the base image dependency. Possible values include: 'BuildTime', 'RunTime' 357 Type BaseImageDependencyType `json:"type,omitempty"` 358 // Registry - The registry login server. 359 Registry *string `json:"registry,omitempty"` 360 // Repository - The repository name. 361 Repository *string `json:"repository,omitempty"` 362 // Tag - The tag name. 363 Tag *string `json:"tag,omitempty"` 364 // Digest - The sha256-based digest of the image manifest. 365 Digest *string `json:"digest,omitempty"` 366} 367 368// Build build resource properties 369type Build struct { 370 autorest.Response `json:"-"` 371 // BuildProperties - The properties of a build. 372 *BuildProperties `json:"properties,omitempty"` 373 // ID - The resource ID. 374 ID *string `json:"id,omitempty"` 375 // Name - The name of the resource. 376 Name *string `json:"name,omitempty"` 377 // Type - The type of the resource. 378 Type *string `json:"type,omitempty"` 379} 380 381// MarshalJSON is the custom marshaler for Build. 382func (b Build) MarshalJSON() ([]byte, error) { 383 objectMap := make(map[string]interface{}) 384 if b.BuildProperties != nil { 385 objectMap["properties"] = b.BuildProperties 386 } 387 if b.ID != nil { 388 objectMap["id"] = b.ID 389 } 390 if b.Name != nil { 391 objectMap["name"] = b.Name 392 } 393 if b.Type != nil { 394 objectMap["type"] = b.Type 395 } 396 return json.Marshal(objectMap) 397} 398 399// UnmarshalJSON is the custom unmarshaler for Build struct. 400func (b *Build) UnmarshalJSON(body []byte) error { 401 var m map[string]*json.RawMessage 402 err := json.Unmarshal(body, &m) 403 if err != nil { 404 return err 405 } 406 for k, v := range m { 407 switch k { 408 case "properties": 409 if v != nil { 410 var buildProperties BuildProperties 411 err = json.Unmarshal(*v, &buildProperties) 412 if err != nil { 413 return err 414 } 415 b.BuildProperties = &buildProperties 416 } 417 case "id": 418 if v != nil { 419 var ID string 420 err = json.Unmarshal(*v, &ID) 421 if err != nil { 422 return err 423 } 424 b.ID = &ID 425 } 426 case "name": 427 if v != nil { 428 var name string 429 err = json.Unmarshal(*v, &name) 430 if err != nil { 431 return err 432 } 433 b.Name = &name 434 } 435 case "type": 436 if v != nil { 437 var typeVar string 438 err = json.Unmarshal(*v, &typeVar) 439 if err != nil { 440 return err 441 } 442 b.Type = &typeVar 443 } 444 } 445 } 446 447 return nil 448} 449 450// BuildArgument properties of a build argument. 451type BuildArgument struct { 452 // Type - The type of the argument. 453 Type *string `json:"type,omitempty"` 454 // Name - The name of the argument. 455 Name *string `json:"name,omitempty"` 456 // Value - The value of the argument. 457 Value *string `json:"value,omitempty"` 458 // IsSecret - Flag to indicate whether the argument represents a secret and want to be removed from build logs. 459 IsSecret *bool `json:"isSecret,omitempty"` 460} 461 462// BuildArgumentList the list of build arguments for a build step. 463type BuildArgumentList struct { 464 autorest.Response `json:"-"` 465 // Value - The collection value. 466 Value *[]BuildArgument `json:"value,omitempty"` 467 // NextLink - The URI that can be used to request the next set of paged results. 468 NextLink *string `json:"nextLink,omitempty"` 469} 470 471// BuildArgumentListIterator provides access to a complete listing of BuildArgument values. 472type BuildArgumentListIterator struct { 473 i int 474 page BuildArgumentListPage 475} 476 477// Next advances to the next value. If there was an error making 478// the request the iterator does not advance and the error is returned. 479func (iter *BuildArgumentListIterator) Next() error { 480 iter.i++ 481 if iter.i < len(iter.page.Values()) { 482 return nil 483 } 484 err := iter.page.Next() 485 if err != nil { 486 iter.i-- 487 return err 488 } 489 iter.i = 0 490 return nil 491} 492 493// NotDone returns true if the enumeration should be started or is not yet complete. 494func (iter BuildArgumentListIterator) NotDone() bool { 495 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 496} 497 498// Response returns the raw server response from the last page request. 499func (iter BuildArgumentListIterator) Response() BuildArgumentList { 500 return iter.page.Response() 501} 502 503// Value returns the current value or a zero-initialized value if the 504// iterator has advanced beyond the end of the collection. 505func (iter BuildArgumentListIterator) Value() BuildArgument { 506 if !iter.page.NotDone() { 507 return BuildArgument{} 508 } 509 return iter.page.Values()[iter.i] 510} 511 512// IsEmpty returns true if the ListResult contains no values. 513func (bal BuildArgumentList) IsEmpty() bool { 514 return bal.Value == nil || len(*bal.Value) == 0 515} 516 517// buildArgumentListPreparer prepares a request to retrieve the next set of results. 518// It returns nil if no more results exist. 519func (bal BuildArgumentList) buildArgumentListPreparer() (*http.Request, error) { 520 if bal.NextLink == nil || len(to.String(bal.NextLink)) < 1 { 521 return nil, nil 522 } 523 return autorest.Prepare(&http.Request{}, 524 autorest.AsJSON(), 525 autorest.AsGet(), 526 autorest.WithBaseURL(to.String(bal.NextLink))) 527} 528 529// BuildArgumentListPage contains a page of BuildArgument values. 530type BuildArgumentListPage struct { 531 fn func(BuildArgumentList) (BuildArgumentList, error) 532 bal BuildArgumentList 533} 534 535// Next advances to the next page of values. If there was an error making 536// the request the page does not advance and the error is returned. 537func (page *BuildArgumentListPage) Next() error { 538 next, err := page.fn(page.bal) 539 if err != nil { 540 return err 541 } 542 page.bal = next 543 return nil 544} 545 546// NotDone returns true if the page enumeration should be started or is not yet complete. 547func (page BuildArgumentListPage) NotDone() bool { 548 return !page.bal.IsEmpty() 549} 550 551// Response returns the raw server response from the last page request. 552func (page BuildArgumentListPage) Response() BuildArgumentList { 553 return page.bal 554} 555 556// Values returns the slice of values for the current page or nil if there are no values. 557func (page BuildArgumentListPage) Values() []BuildArgument { 558 if page.bal.IsEmpty() { 559 return nil 560 } 561 return *page.bal.Value 562} 563 564// BuildFilter properties that are enabled for Odata querying. 565type BuildFilter struct { 566 // BuildID - The unique identifier for the build. 567 BuildID *string `json:"buildId,omitempty"` 568 // BuildType - The type of build. Possible values include: 'AutoBuild', 'QuickBuild' 569 BuildType BuildType `json:"buildType,omitempty"` 570 // Status - The current status of the build. Possible values include: 'Queued', 'Started', 'Running', 'Succeeded', 'Failed', 'Canceled', 'Error', 'Timeout' 571 Status BuildStatus `json:"status,omitempty"` 572 // CreateTime - The create time for a build. 573 CreateTime *date.Time `json:"createTime,omitempty"` 574 // FinishTime - The time the build finished. 575 FinishTime *date.Time `json:"finishTime,omitempty"` 576 // OutputImageNames - The list of all images that were generated from the build. 577 OutputImageNames *[]string `json:"outputImageNames,omitempty"` 578 // IsArchiveEnabled - The value that indicates whether archiving is enabled or not. 579 IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` 580 // BuildTaskName - The name of the build task that the build corresponds to. 581 BuildTaskName *string `json:"buildTaskName,omitempty"` 582} 583 584// BuildGetLogResult the result of get log link operation. 585type BuildGetLogResult struct { 586 autorest.Response `json:"-"` 587 // LogLink - The link to logs for a azure container registry build. 588 LogLink *string `json:"logLink,omitempty"` 589} 590 591// BuildListResult collection of builds. 592type BuildListResult struct { 593 autorest.Response `json:"-"` 594 // Value - The collection value. 595 Value *[]Build `json:"value,omitempty"` 596 // NextLink - The URI that can be used to request the next set of paged results. 597 NextLink *string `json:"nextLink,omitempty"` 598} 599 600// BuildListResultIterator provides access to a complete listing of Build values. 601type BuildListResultIterator struct { 602 i int 603 page BuildListResultPage 604} 605 606// Next advances to the next value. If there was an error making 607// the request the iterator does not advance and the error is returned. 608func (iter *BuildListResultIterator) Next() error { 609 iter.i++ 610 if iter.i < len(iter.page.Values()) { 611 return nil 612 } 613 err := iter.page.Next() 614 if err != nil { 615 iter.i-- 616 return err 617 } 618 iter.i = 0 619 return nil 620} 621 622// NotDone returns true if the enumeration should be started or is not yet complete. 623func (iter BuildListResultIterator) NotDone() bool { 624 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 625} 626 627// Response returns the raw server response from the last page request. 628func (iter BuildListResultIterator) Response() BuildListResult { 629 return iter.page.Response() 630} 631 632// Value returns the current value or a zero-initialized value if the 633// iterator has advanced beyond the end of the collection. 634func (iter BuildListResultIterator) Value() Build { 635 if !iter.page.NotDone() { 636 return Build{} 637 } 638 return iter.page.Values()[iter.i] 639} 640 641// IsEmpty returns true if the ListResult contains no values. 642func (blr BuildListResult) IsEmpty() bool { 643 return blr.Value == nil || len(*blr.Value) == 0 644} 645 646// buildListResultPreparer prepares a request to retrieve the next set of results. 647// It returns nil if no more results exist. 648func (blr BuildListResult) buildListResultPreparer() (*http.Request, error) { 649 if blr.NextLink == nil || len(to.String(blr.NextLink)) < 1 { 650 return nil, nil 651 } 652 return autorest.Prepare(&http.Request{}, 653 autorest.AsJSON(), 654 autorest.AsGet(), 655 autorest.WithBaseURL(to.String(blr.NextLink))) 656} 657 658// BuildListResultPage contains a page of Build values. 659type BuildListResultPage struct { 660 fn func(BuildListResult) (BuildListResult, error) 661 blr BuildListResult 662} 663 664// Next advances to the next page of values. If there was an error making 665// the request the page does not advance and the error is returned. 666func (page *BuildListResultPage) Next() error { 667 next, err := page.fn(page.blr) 668 if err != nil { 669 return err 670 } 671 page.blr = next 672 return nil 673} 674 675// NotDone returns true if the page enumeration should be started or is not yet complete. 676func (page BuildListResultPage) NotDone() bool { 677 return !page.blr.IsEmpty() 678} 679 680// Response returns the raw server response from the last page request. 681func (page BuildListResultPage) Response() BuildListResult { 682 return page.blr 683} 684 685// Values returns the slice of values for the current page or nil if there are no values. 686func (page BuildListResultPage) Values() []Build { 687 if page.blr.IsEmpty() { 688 return nil 689 } 690 return *page.blr.Value 691} 692 693// BuildProperties the properties for a build. 694type BuildProperties struct { 695 // BuildID - The unique identifier for the build. 696 BuildID *string `json:"buildId,omitempty"` 697 // Status - The current status of the build. Possible values include: 'Queued', 'Started', 'Running', 'Succeeded', 'Failed', 'Canceled', 'Error', 'Timeout' 698 Status BuildStatus `json:"status,omitempty"` 699 // LastUpdatedTime - The last updated time for the build. 700 LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` 701 // BuildType - The type of build. Possible values include: 'AutoBuild', 'QuickBuild' 702 BuildType BuildType `json:"buildType,omitempty"` 703 // CreateTime - The time the build was created. 704 CreateTime *date.Time `json:"createTime,omitempty"` 705 // StartTime - The time the build started. 706 StartTime *date.Time `json:"startTime,omitempty"` 707 // FinishTime - The time the build finished. 708 FinishTime *date.Time `json:"finishTime,omitempty"` 709 // OutputImages - The list of all images that were generated from the build. 710 OutputImages *[]ImageDescriptor `json:"outputImages,omitempty"` 711 // BuildTask - The build task with which the build was started. 712 BuildTask *string `json:"buildTask,omitempty"` 713 // ImageUpdateTrigger - The image update trigger that caused the build. 714 ImageUpdateTrigger *ImageUpdateTrigger `json:"imageUpdateTrigger,omitempty"` 715 // GitCommitTrigger - The git commit trigger that caused the build. 716 GitCommitTrigger *GitCommitTrigger `json:"gitCommitTrigger,omitempty"` 717 // IsArchiveEnabled - The value that indicates whether archiving is enabled or not. 718 IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` 719 // Platform - The platform properties against which the build will happen. 720 Platform *PlatformProperties `json:"platform,omitempty"` 721 // ProvisioningState - The provisioning state of a build. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' 722 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 723} 724 725// BuildsCancelFuture an abstraction for monitoring and retrieving the results of a long-running operation. 726type BuildsCancelFuture struct { 727 azure.Future 728 req *http.Request 729} 730 731// Result returns the result of the asynchronous operation. 732// If the operation has not completed it will return an error. 733func (future BuildsCancelFuture) Result(client BuildsClient) (ar autorest.Response, err error) { 734 var done bool 735 done, err = future.Done(client) 736 if err != nil { 737 err = autorest.NewErrorWithError(err, "containerregistry.BuildsCancelFuture", "Result", future.Response(), "Polling failure") 738 return 739 } 740 if !done { 741 return ar, azure.NewAsyncOpIncompleteError("containerregistry.BuildsCancelFuture") 742 } 743 if future.PollingMethod() == azure.PollingLocation { 744 ar, err = client.CancelResponder(future.Response()) 745 if err != nil { 746 err = autorest.NewErrorWithError(err, "containerregistry.BuildsCancelFuture", "Result", future.Response(), "Failure responding to request") 747 } 748 return 749 } 750 var req *http.Request 751 var resp *http.Response 752 if future.PollingURL() != "" { 753 req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) 754 if err != nil { 755 return 756 } 757 } else { 758 req = autorest.ChangeToGet(future.req) 759 } 760 resp, err = autorest.SendWithSender(client, req, 761 autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 762 if err != nil { 763 err = autorest.NewErrorWithError(err, "containerregistry.BuildsCancelFuture", "Result", resp, "Failure sending request") 764 return 765 } 766 ar, err = client.CancelResponder(resp) 767 if err != nil { 768 err = autorest.NewErrorWithError(err, "containerregistry.BuildsCancelFuture", "Result", resp, "Failure responding to request") 769 } 770 return 771} 772 773// BuildStep build step resource properties 774type BuildStep struct { 775 autorest.Response `json:"-"` 776 // Properties - The properties of a build step. 777 Properties BasicBuildStepProperties `json:"properties,omitempty"` 778 // ID - The resource ID. 779 ID *string `json:"id,omitempty"` 780 // Name - The name of the resource. 781 Name *string `json:"name,omitempty"` 782 // Type - The type of the resource. 783 Type *string `json:"type,omitempty"` 784} 785 786// UnmarshalJSON is the custom unmarshaler for BuildStep struct. 787func (bs *BuildStep) UnmarshalJSON(body []byte) error { 788 var m map[string]*json.RawMessage 789 err := json.Unmarshal(body, &m) 790 if err != nil { 791 return err 792 } 793 for k, v := range m { 794 switch k { 795 case "properties": 796 if v != nil { 797 properties, err := unmarshalBasicBuildStepProperties(*v) 798 if err != nil { 799 return err 800 } 801 bs.Properties = properties 802 } 803 case "id": 804 if v != nil { 805 var ID string 806 err = json.Unmarshal(*v, &ID) 807 if err != nil { 808 return err 809 } 810 bs.ID = &ID 811 } 812 case "name": 813 if v != nil { 814 var name string 815 err = json.Unmarshal(*v, &name) 816 if err != nil { 817 return err 818 } 819 bs.Name = &name 820 } 821 case "type": 822 if v != nil { 823 var typeVar string 824 err = json.Unmarshal(*v, &typeVar) 825 if err != nil { 826 return err 827 } 828 bs.Type = &typeVar 829 } 830 } 831 } 832 833 return nil 834} 835 836// BuildStepList the collection of build items. 837type BuildStepList struct { 838 autorest.Response `json:"-"` 839 // Value - The collection value. 840 Value *[]BuildStep `json:"value,omitempty"` 841 // NextLink - The URI that can be used to request the next set of paged results. 842 NextLink *string `json:"nextLink,omitempty"` 843} 844 845// BuildStepListIterator provides access to a complete listing of BuildStep values. 846type BuildStepListIterator struct { 847 i int 848 page BuildStepListPage 849} 850 851// Next advances to the next value. If there was an error making 852// the request the iterator does not advance and the error is returned. 853func (iter *BuildStepListIterator) Next() error { 854 iter.i++ 855 if iter.i < len(iter.page.Values()) { 856 return nil 857 } 858 err := iter.page.Next() 859 if err != nil { 860 iter.i-- 861 return err 862 } 863 iter.i = 0 864 return nil 865} 866 867// NotDone returns true if the enumeration should be started or is not yet complete. 868func (iter BuildStepListIterator) NotDone() bool { 869 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 870} 871 872// Response returns the raw server response from the last page request. 873func (iter BuildStepListIterator) Response() BuildStepList { 874 return iter.page.Response() 875} 876 877// Value returns the current value or a zero-initialized value if the 878// iterator has advanced beyond the end of the collection. 879func (iter BuildStepListIterator) Value() BuildStep { 880 if !iter.page.NotDone() { 881 return BuildStep{} 882 } 883 return iter.page.Values()[iter.i] 884} 885 886// IsEmpty returns true if the ListResult contains no values. 887func (bsl BuildStepList) IsEmpty() bool { 888 return bsl.Value == nil || len(*bsl.Value) == 0 889} 890 891// buildStepListPreparer prepares a request to retrieve the next set of results. 892// It returns nil if no more results exist. 893func (bsl BuildStepList) buildStepListPreparer() (*http.Request, error) { 894 if bsl.NextLink == nil || len(to.String(bsl.NextLink)) < 1 { 895 return nil, nil 896 } 897 return autorest.Prepare(&http.Request{}, 898 autorest.AsJSON(), 899 autorest.AsGet(), 900 autorest.WithBaseURL(to.String(bsl.NextLink))) 901} 902 903// BuildStepListPage contains a page of BuildStep values. 904type BuildStepListPage struct { 905 fn func(BuildStepList) (BuildStepList, error) 906 bsl BuildStepList 907} 908 909// Next advances to the next page of values. If there was an error making 910// the request the page does not advance and the error is returned. 911func (page *BuildStepListPage) Next() error { 912 next, err := page.fn(page.bsl) 913 if err != nil { 914 return err 915 } 916 page.bsl = next 917 return nil 918} 919 920// NotDone returns true if the page enumeration should be started or is not yet complete. 921func (page BuildStepListPage) NotDone() bool { 922 return !page.bsl.IsEmpty() 923} 924 925// Response returns the raw server response from the last page request. 926func (page BuildStepListPage) Response() BuildStepList { 927 return page.bsl 928} 929 930// Values returns the slice of values for the current page or nil if there are no values. 931func (page BuildStepListPage) Values() []BuildStep { 932 if page.bsl.IsEmpty() { 933 return nil 934 } 935 return *page.bsl.Value 936} 937 938// BasicBuildStepProperties base properties for any build step. 939type BasicBuildStepProperties interface { 940 AsDockerBuildStep() (*DockerBuildStep, bool) 941 AsBuildStepProperties() (*BuildStepProperties, bool) 942} 943 944// BuildStepProperties base properties for any build step. 945type BuildStepProperties struct { 946 // ProvisioningState - The provisioning state of the build step. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' 947 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 948 // Type - Possible values include: 'TypeBuildStepProperties', 'TypeDocker' 949 Type Type `json:"type,omitempty"` 950} 951 952func unmarshalBasicBuildStepProperties(body []byte) (BasicBuildStepProperties, error) { 953 var m map[string]interface{} 954 err := json.Unmarshal(body, &m) 955 if err != nil { 956 return nil, err 957 } 958 959 switch m["type"] { 960 case string(TypeDocker): 961 var dbs DockerBuildStep 962 err := json.Unmarshal(body, &dbs) 963 return dbs, err 964 default: 965 var bsp BuildStepProperties 966 err := json.Unmarshal(body, &bsp) 967 return bsp, err 968 } 969} 970func unmarshalBasicBuildStepPropertiesArray(body []byte) ([]BasicBuildStepProperties, error) { 971 var rawMessages []*json.RawMessage 972 err := json.Unmarshal(body, &rawMessages) 973 if err != nil { 974 return nil, err 975 } 976 977 bspArray := make([]BasicBuildStepProperties, len(rawMessages)) 978 979 for index, rawMessage := range rawMessages { 980 bsp, err := unmarshalBasicBuildStepProperties(*rawMessage) 981 if err != nil { 982 return nil, err 983 } 984 bspArray[index] = bsp 985 } 986 return bspArray, nil 987} 988 989// MarshalJSON is the custom marshaler for BuildStepProperties. 990func (bsp BuildStepProperties) MarshalJSON() ([]byte, error) { 991 bsp.Type = TypeBuildStepProperties 992 objectMap := make(map[string]interface{}) 993 if bsp.ProvisioningState != "" { 994 objectMap["provisioningState"] = bsp.ProvisioningState 995 } 996 if bsp.Type != "" { 997 objectMap["type"] = bsp.Type 998 } 999 return json.Marshal(objectMap) 1000} 1001 1002// AsDockerBuildStep is the BasicBuildStepProperties implementation for BuildStepProperties. 1003func (bsp BuildStepProperties) AsDockerBuildStep() (*DockerBuildStep, bool) { 1004 return nil, false 1005} 1006 1007// AsBuildStepProperties is the BasicBuildStepProperties implementation for BuildStepProperties. 1008func (bsp BuildStepProperties) AsBuildStepProperties() (*BuildStepProperties, bool) { 1009 return &bsp, true 1010} 1011 1012// AsBasicBuildStepProperties is the BasicBuildStepProperties implementation for BuildStepProperties. 1013func (bsp BuildStepProperties) AsBasicBuildStepProperties() (BasicBuildStepProperties, bool) { 1014 return &bsp, true 1015} 1016 1017// BasicBuildStepPropertiesUpdateParameters the properties for updating a build step. 1018type BasicBuildStepPropertiesUpdateParameters interface { 1019 AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) 1020 AsBuildStepPropertiesUpdateParameters() (*BuildStepPropertiesUpdateParameters, bool) 1021} 1022 1023// BuildStepPropertiesUpdateParameters the properties for updating a build step. 1024type BuildStepPropertiesUpdateParameters struct { 1025 // Type - Possible values include: 'TypeBasicBuildStepPropertiesUpdateParametersTypeBuildStepPropertiesUpdateParameters', 'TypeBasicBuildStepPropertiesUpdateParametersTypeDocker' 1026 Type TypeBasicBuildStepPropertiesUpdateParameters `json:"type,omitempty"` 1027} 1028 1029func unmarshalBasicBuildStepPropertiesUpdateParameters(body []byte) (BasicBuildStepPropertiesUpdateParameters, error) { 1030 var m map[string]interface{} 1031 err := json.Unmarshal(body, &m) 1032 if err != nil { 1033 return nil, err 1034 } 1035 1036 switch m["type"] { 1037 case string(TypeBasicBuildStepPropertiesUpdateParametersTypeDocker): 1038 var dbsup DockerBuildStepUpdateParameters 1039 err := json.Unmarshal(body, &dbsup) 1040 return dbsup, err 1041 default: 1042 var bspup BuildStepPropertiesUpdateParameters 1043 err := json.Unmarshal(body, &bspup) 1044 return bspup, err 1045 } 1046} 1047func unmarshalBasicBuildStepPropertiesUpdateParametersArray(body []byte) ([]BasicBuildStepPropertiesUpdateParameters, error) { 1048 var rawMessages []*json.RawMessage 1049 err := json.Unmarshal(body, &rawMessages) 1050 if err != nil { 1051 return nil, err 1052 } 1053 1054 bspupArray := make([]BasicBuildStepPropertiesUpdateParameters, len(rawMessages)) 1055 1056 for index, rawMessage := range rawMessages { 1057 bspup, err := unmarshalBasicBuildStepPropertiesUpdateParameters(*rawMessage) 1058 if err != nil { 1059 return nil, err 1060 } 1061 bspupArray[index] = bspup 1062 } 1063 return bspupArray, nil 1064} 1065 1066// MarshalJSON is the custom marshaler for BuildStepPropertiesUpdateParameters. 1067func (bspup BuildStepPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { 1068 bspup.Type = TypeBasicBuildStepPropertiesUpdateParametersTypeBuildStepPropertiesUpdateParameters 1069 objectMap := make(map[string]interface{}) 1070 if bspup.Type != "" { 1071 objectMap["type"] = bspup.Type 1072 } 1073 return json.Marshal(objectMap) 1074} 1075 1076// AsDockerBuildStepUpdateParameters is the BasicBuildStepPropertiesUpdateParameters implementation for BuildStepPropertiesUpdateParameters. 1077func (bspup BuildStepPropertiesUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { 1078 return nil, false 1079} 1080 1081// AsBuildStepPropertiesUpdateParameters is the BasicBuildStepPropertiesUpdateParameters implementation for BuildStepPropertiesUpdateParameters. 1082func (bspup BuildStepPropertiesUpdateParameters) AsBuildStepPropertiesUpdateParameters() (*BuildStepPropertiesUpdateParameters, bool) { 1083 return &bspup, true 1084} 1085 1086// AsBasicBuildStepPropertiesUpdateParameters is the BasicBuildStepPropertiesUpdateParameters implementation for BuildStepPropertiesUpdateParameters. 1087func (bspup BuildStepPropertiesUpdateParameters) AsBasicBuildStepPropertiesUpdateParameters() (BasicBuildStepPropertiesUpdateParameters, bool) { 1088 return &bspup, true 1089} 1090 1091// BuildStepsCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 1092type BuildStepsCreateFuture struct { 1093 azure.Future 1094 req *http.Request 1095} 1096 1097// Result returns the result of the asynchronous operation. 1098// If the operation has not completed it will return an error. 1099func (future BuildStepsCreateFuture) Result(client BuildStepsClient) (bs BuildStep, err error) { 1100 var done bool 1101 done, err = future.Done(client) 1102 if err != nil { 1103 err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsCreateFuture", "Result", future.Response(), "Polling failure") 1104 return 1105 } 1106 if !done { 1107 return bs, azure.NewAsyncOpIncompleteError("containerregistry.BuildStepsCreateFuture") 1108 } 1109 if future.PollingMethod() == azure.PollingLocation { 1110 bs, err = client.CreateResponder(future.Response()) 1111 if err != nil { 1112 err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsCreateFuture", "Result", future.Response(), "Failure responding to request") 1113 } 1114 return 1115 } 1116 var req *http.Request 1117 var resp *http.Response 1118 if future.PollingURL() != "" { 1119 req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) 1120 if err != nil { 1121 return 1122 } 1123 } else { 1124 req = autorest.ChangeToGet(future.req) 1125 } 1126 resp, err = autorest.SendWithSender(client, req, 1127 autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1128 if err != nil { 1129 err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsCreateFuture", "Result", resp, "Failure sending request") 1130 return 1131 } 1132 bs, err = client.CreateResponder(resp) 1133 if err != nil { 1134 err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsCreateFuture", "Result", resp, "Failure responding to request") 1135 } 1136 return 1137} 1138 1139// BuildStepsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. 1140type BuildStepsDeleteFuture struct { 1141 azure.Future 1142 req *http.Request 1143} 1144 1145// Result returns the result of the asynchronous operation. 1146// If the operation has not completed it will return an error. 1147func (future BuildStepsDeleteFuture) Result(client BuildStepsClient) (ar autorest.Response, err error) { 1148 var done bool 1149 done, err = future.Done(client) 1150 if err != nil { 1151 err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsDeleteFuture", "Result", future.Response(), "Polling failure") 1152 return 1153 } 1154 if !done { 1155 return ar, azure.NewAsyncOpIncompleteError("containerregistry.BuildStepsDeleteFuture") 1156 } 1157 if future.PollingMethod() == azure.PollingLocation { 1158 ar, err = client.DeleteResponder(future.Response()) 1159 if err != nil { 1160 err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsDeleteFuture", "Result", future.Response(), "Failure responding to request") 1161 } 1162 return 1163 } 1164 var req *http.Request 1165 var resp *http.Response 1166 if future.PollingURL() != "" { 1167 req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) 1168 if err != nil { 1169 return 1170 } 1171 } else { 1172 req = autorest.ChangeToGet(future.req) 1173 } 1174 resp, err = autorest.SendWithSender(client, req, 1175 autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1176 if err != nil { 1177 err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsDeleteFuture", "Result", resp, "Failure sending request") 1178 return 1179 } 1180 ar, err = client.DeleteResponder(resp) 1181 if err != nil { 1182 err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsDeleteFuture", "Result", resp, "Failure responding to request") 1183 } 1184 return 1185} 1186 1187// BuildStepsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 1188type BuildStepsUpdateFuture struct { 1189 azure.Future 1190 req *http.Request 1191} 1192 1193// Result returns the result of the asynchronous operation. 1194// If the operation has not completed it will return an error. 1195func (future BuildStepsUpdateFuture) Result(client BuildStepsClient) (bs BuildStep, err error) { 1196 var done bool 1197 done, err = future.Done(client) 1198 if err != nil { 1199 err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsUpdateFuture", "Result", future.Response(), "Polling failure") 1200 return 1201 } 1202 if !done { 1203 return bs, azure.NewAsyncOpIncompleteError("containerregistry.BuildStepsUpdateFuture") 1204 } 1205 if future.PollingMethod() == azure.PollingLocation { 1206 bs, err = client.UpdateResponder(future.Response()) 1207 if err != nil { 1208 err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsUpdateFuture", "Result", future.Response(), "Failure responding to request") 1209 } 1210 return 1211 } 1212 var req *http.Request 1213 var resp *http.Response 1214 if future.PollingURL() != "" { 1215 req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) 1216 if err != nil { 1217 return 1218 } 1219 } else { 1220 req = autorest.ChangeToGet(future.req) 1221 } 1222 resp, err = autorest.SendWithSender(client, req, 1223 autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1224 if err != nil { 1225 err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsUpdateFuture", "Result", resp, "Failure sending request") 1226 return 1227 } 1228 bs, err = client.UpdateResponder(resp) 1229 if err != nil { 1230 err = autorest.NewErrorWithError(err, "containerregistry.BuildStepsUpdateFuture", "Result", resp, "Failure responding to request") 1231 } 1232 return 1233} 1234 1235// BuildStepUpdateParameters the parameters for updating a build step. 1236type BuildStepUpdateParameters struct { 1237 // Properties - The properties for updating a build step. 1238 Properties BasicBuildStepPropertiesUpdateParameters `json:"properties,omitempty"` 1239 // Tags - The ARM resource tags. 1240 Tags map[string]*string `json:"tags"` 1241} 1242 1243// MarshalJSON is the custom marshaler for BuildStepUpdateParameters. 1244func (bsup BuildStepUpdateParameters) MarshalJSON() ([]byte, error) { 1245 objectMap := make(map[string]interface{}) 1246 objectMap["properties"] = bsup.Properties 1247 if bsup.Tags != nil { 1248 objectMap["tags"] = bsup.Tags 1249 } 1250 return json.Marshal(objectMap) 1251} 1252 1253// UnmarshalJSON is the custom unmarshaler for BuildStepUpdateParameters struct. 1254func (bsup *BuildStepUpdateParameters) UnmarshalJSON(body []byte) error { 1255 var m map[string]*json.RawMessage 1256 err := json.Unmarshal(body, &m) 1257 if err != nil { 1258 return err 1259 } 1260 for k, v := range m { 1261 switch k { 1262 case "properties": 1263 if v != nil { 1264 properties, err := unmarshalBasicBuildStepPropertiesUpdateParameters(*v) 1265 if err != nil { 1266 return err 1267 } 1268 bsup.Properties = properties 1269 } 1270 case "tags": 1271 if v != nil { 1272 var tags map[string]*string 1273 err = json.Unmarshal(*v, &tags) 1274 if err != nil { 1275 return err 1276 } 1277 bsup.Tags = tags 1278 } 1279 } 1280 } 1281 1282 return nil 1283} 1284 1285// BuildsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 1286type BuildsUpdateFuture struct { 1287 azure.Future 1288 req *http.Request 1289} 1290 1291// Result returns the result of the asynchronous operation. 1292// If the operation has not completed it will return an error. 1293func (future BuildsUpdateFuture) Result(client BuildsClient) (b Build, err error) { 1294 var done bool 1295 done, err = future.Done(client) 1296 if err != nil { 1297 err = autorest.NewErrorWithError(err, "containerregistry.BuildsUpdateFuture", "Result", future.Response(), "Polling failure") 1298 return 1299 } 1300 if !done { 1301 return b, azure.NewAsyncOpIncompleteError("containerregistry.BuildsUpdateFuture") 1302 } 1303 if future.PollingMethod() == azure.PollingLocation { 1304 b, err = client.UpdateResponder(future.Response()) 1305 if err != nil { 1306 err = autorest.NewErrorWithError(err, "containerregistry.BuildsUpdateFuture", "Result", future.Response(), "Failure responding to request") 1307 } 1308 return 1309 } 1310 var req *http.Request 1311 var resp *http.Response 1312 if future.PollingURL() != "" { 1313 req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) 1314 if err != nil { 1315 return 1316 } 1317 } else { 1318 req = autorest.ChangeToGet(future.req) 1319 } 1320 resp, err = autorest.SendWithSender(client, req, 1321 autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1322 if err != nil { 1323 err = autorest.NewErrorWithError(err, "containerregistry.BuildsUpdateFuture", "Result", resp, "Failure sending request") 1324 return 1325 } 1326 b, err = client.UpdateResponder(resp) 1327 if err != nil { 1328 err = autorest.NewErrorWithError(err, "containerregistry.BuildsUpdateFuture", "Result", resp, "Failure responding to request") 1329 } 1330 return 1331} 1332 1333// BuildTask the build task that has the resource properties and all build items. The build task will have all 1334// information to schedule a build against it. 1335type BuildTask struct { 1336 autorest.Response `json:"-"` 1337 // BuildTaskProperties - The properties of a build task. 1338 *BuildTaskProperties `json:"properties,omitempty"` 1339 // ID - The resource ID. 1340 ID *string `json:"id,omitempty"` 1341 // Name - The name of the resource. 1342 Name *string `json:"name,omitempty"` 1343 // Type - The type of the resource. 1344 Type *string `json:"type,omitempty"` 1345 // Location - The location of the resource. This cannot be changed after the resource is created. 1346 Location *string `json:"location,omitempty"` 1347 // Tags - The tags of the resource. 1348 Tags map[string]*string `json:"tags"` 1349} 1350 1351// MarshalJSON is the custom marshaler for BuildTask. 1352func (bt BuildTask) MarshalJSON() ([]byte, error) { 1353 objectMap := make(map[string]interface{}) 1354 if bt.BuildTaskProperties != nil { 1355 objectMap["properties"] = bt.BuildTaskProperties 1356 } 1357 if bt.ID != nil { 1358 objectMap["id"] = bt.ID 1359 } 1360 if bt.Name != nil { 1361 objectMap["name"] = bt.Name 1362 } 1363 if bt.Type != nil { 1364 objectMap["type"] = bt.Type 1365 } 1366 if bt.Location != nil { 1367 objectMap["location"] = bt.Location 1368 } 1369 if bt.Tags != nil { 1370 objectMap["tags"] = bt.Tags 1371 } 1372 return json.Marshal(objectMap) 1373} 1374 1375// UnmarshalJSON is the custom unmarshaler for BuildTask struct. 1376func (bt *BuildTask) UnmarshalJSON(body []byte) error { 1377 var m map[string]*json.RawMessage 1378 err := json.Unmarshal(body, &m) 1379 if err != nil { 1380 return err 1381 } 1382 for k, v := range m { 1383 switch k { 1384 case "properties": 1385 if v != nil { 1386 var buildTaskProperties BuildTaskProperties 1387 err = json.Unmarshal(*v, &buildTaskProperties) 1388 if err != nil { 1389 return err 1390 } 1391 bt.BuildTaskProperties = &buildTaskProperties 1392 } 1393 case "id": 1394 if v != nil { 1395 var ID string 1396 err = json.Unmarshal(*v, &ID) 1397 if err != nil { 1398 return err 1399 } 1400 bt.ID = &ID 1401 } 1402 case "name": 1403 if v != nil { 1404 var name string 1405 err = json.Unmarshal(*v, &name) 1406 if err != nil { 1407 return err 1408 } 1409 bt.Name = &name 1410 } 1411 case "type": 1412 if v != nil { 1413 var typeVar string 1414 err = json.Unmarshal(*v, &typeVar) 1415 if err != nil { 1416 return err 1417 } 1418 bt.Type = &typeVar 1419 } 1420 case "location": 1421 if v != nil { 1422 var location string 1423 err = json.Unmarshal(*v, &location) 1424 if err != nil { 1425 return err 1426 } 1427 bt.Location = &location 1428 } 1429 case "tags": 1430 if v != nil { 1431 var tags map[string]*string 1432 err = json.Unmarshal(*v, &tags) 1433 if err != nil { 1434 return err 1435 } 1436 bt.Tags = tags 1437 } 1438 } 1439 } 1440 1441 return nil 1442} 1443 1444// BuildTaskBuildRequest the queue build parameters based on a build task. 1445type BuildTaskBuildRequest struct { 1446 // BuildTaskName - The name of build task against which build has to be queued. 1447 BuildTaskName *string `json:"buildTaskName,omitempty"` 1448 // Type - Possible values include: 'TypeQueueBuildRequest', 'TypeBuildTask', 'TypeQuickBuild' 1449 Type TypeBasicQueueBuildRequest `json:"type,omitempty"` 1450} 1451 1452// MarshalJSON is the custom marshaler for BuildTaskBuildRequest. 1453func (btbr BuildTaskBuildRequest) MarshalJSON() ([]byte, error) { 1454 btbr.Type = TypeBuildTask 1455 objectMap := make(map[string]interface{}) 1456 if btbr.BuildTaskName != nil { 1457 objectMap["buildTaskName"] = btbr.BuildTaskName 1458 } 1459 if btbr.Type != "" { 1460 objectMap["type"] = btbr.Type 1461 } 1462 return json.Marshal(objectMap) 1463} 1464 1465// AsBuildTaskBuildRequest is the BasicQueueBuildRequest implementation for BuildTaskBuildRequest. 1466func (btbr BuildTaskBuildRequest) AsBuildTaskBuildRequest() (*BuildTaskBuildRequest, bool) { 1467 return &btbr, true 1468} 1469 1470// AsQuickBuildRequest is the BasicQueueBuildRequest implementation for BuildTaskBuildRequest. 1471func (btbr BuildTaskBuildRequest) AsQuickBuildRequest() (*QuickBuildRequest, bool) { 1472 return nil, false 1473} 1474 1475// AsQueueBuildRequest is the BasicQueueBuildRequest implementation for BuildTaskBuildRequest. 1476func (btbr BuildTaskBuildRequest) AsQueueBuildRequest() (*QueueBuildRequest, bool) { 1477 return nil, false 1478} 1479 1480// AsBasicQueueBuildRequest is the BasicQueueBuildRequest implementation for BuildTaskBuildRequest. 1481func (btbr BuildTaskBuildRequest) AsBasicQueueBuildRequest() (BasicQueueBuildRequest, bool) { 1482 return &btbr, true 1483} 1484 1485// BuildTaskFilter the filter that can be used for listing build tasks. 1486type BuildTaskFilter struct { 1487 // Alias - The alternative name for build task. 1488 Alias *string `json:"alias,omitempty"` 1489} 1490 1491// BuildTaskListResult the collection of build tasks. 1492type BuildTaskListResult struct { 1493 autorest.Response `json:"-"` 1494 // Value - The collection value. 1495 Value *[]BuildTask `json:"value,omitempty"` 1496 // NextLink - The URI that can be used to request the next set of paged results. 1497 NextLink *string `json:"nextLink,omitempty"` 1498} 1499 1500// BuildTaskListResultIterator provides access to a complete listing of BuildTask values. 1501type BuildTaskListResultIterator struct { 1502 i int 1503 page BuildTaskListResultPage 1504} 1505 1506// Next advances to the next value. If there was an error making 1507// the request the iterator does not advance and the error is returned. 1508func (iter *BuildTaskListResultIterator) Next() error { 1509 iter.i++ 1510 if iter.i < len(iter.page.Values()) { 1511 return nil 1512 } 1513 err := iter.page.Next() 1514 if err != nil { 1515 iter.i-- 1516 return err 1517 } 1518 iter.i = 0 1519 return nil 1520} 1521 1522// NotDone returns true if the enumeration should be started or is not yet complete. 1523func (iter BuildTaskListResultIterator) NotDone() bool { 1524 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1525} 1526 1527// Response returns the raw server response from the last page request. 1528func (iter BuildTaskListResultIterator) Response() BuildTaskListResult { 1529 return iter.page.Response() 1530} 1531 1532// Value returns the current value or a zero-initialized value if the 1533// iterator has advanced beyond the end of the collection. 1534func (iter BuildTaskListResultIterator) Value() BuildTask { 1535 if !iter.page.NotDone() { 1536 return BuildTask{} 1537 } 1538 return iter.page.Values()[iter.i] 1539} 1540 1541// IsEmpty returns true if the ListResult contains no values. 1542func (btlr BuildTaskListResult) IsEmpty() bool { 1543 return btlr.Value == nil || len(*btlr.Value) == 0 1544} 1545 1546// buildTaskListResultPreparer prepares a request to retrieve the next set of results. 1547// It returns nil if no more results exist. 1548func (btlr BuildTaskListResult) buildTaskListResultPreparer() (*http.Request, error) { 1549 if btlr.NextLink == nil || len(to.String(btlr.NextLink)) < 1 { 1550 return nil, nil 1551 } 1552 return autorest.Prepare(&http.Request{}, 1553 autorest.AsJSON(), 1554 autorest.AsGet(), 1555 autorest.WithBaseURL(to.String(btlr.NextLink))) 1556} 1557 1558// BuildTaskListResultPage contains a page of BuildTask values. 1559type BuildTaskListResultPage struct { 1560 fn func(BuildTaskListResult) (BuildTaskListResult, error) 1561 btlr BuildTaskListResult 1562} 1563 1564// Next advances to the next page of values. If there was an error making 1565// the request the page does not advance and the error is returned. 1566func (page *BuildTaskListResultPage) Next() error { 1567 next, err := page.fn(page.btlr) 1568 if err != nil { 1569 return err 1570 } 1571 page.btlr = next 1572 return nil 1573} 1574 1575// NotDone returns true if the page enumeration should be started or is not yet complete. 1576func (page BuildTaskListResultPage) NotDone() bool { 1577 return !page.btlr.IsEmpty() 1578} 1579 1580// Response returns the raw server response from the last page request. 1581func (page BuildTaskListResultPage) Response() BuildTaskListResult { 1582 return page.btlr 1583} 1584 1585// Values returns the slice of values for the current page or nil if there are no values. 1586func (page BuildTaskListResultPage) Values() []BuildTask { 1587 if page.btlr.IsEmpty() { 1588 return nil 1589 } 1590 return *page.btlr.Value 1591} 1592 1593// BuildTaskProperties the properties of a build task. 1594type BuildTaskProperties struct { 1595 // ProvisioningState - The provisioning state of the build task. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' 1596 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 1597 // CreationDate - The creation date of build task. 1598 CreationDate *date.Time `json:"creationDate,omitempty"` 1599 // Alias - The alternative updatable name for a build task. 1600 Alias *string `json:"alias,omitempty"` 1601 // Status - The current status of build task. Possible values include: 'Disabled', 'Enabled' 1602 Status BuildTaskStatus `json:"status,omitempty"` 1603 // SourceRepository - The properties that describes the source(code) for the build task. 1604 SourceRepository *SourceRepositoryProperties `json:"sourceRepository,omitempty"` 1605 // Platform - The platform properties against which the build has to happen. 1606 Platform *PlatformProperties `json:"platform,omitempty"` 1607 // Timeout - Build timeout in seconds. 1608 Timeout *int32 `json:"timeout,omitempty"` 1609} 1610 1611// BuildTaskPropertiesUpdateParameters the properties for updating a build task. 1612type BuildTaskPropertiesUpdateParameters struct { 1613 // Alias - The alternative updatable name for a build task. 1614 Alias *string `json:"alias,omitempty"` 1615 // Status - The current status of build task. Possible values include: 'Disabled', 'Enabled' 1616 Status BuildTaskStatus `json:"status,omitempty"` 1617 // Platform - The platform properties against which the build has to happen. 1618 Platform *PlatformProperties `json:"platform,omitempty"` 1619 // Timeout - Build timeout in seconds. 1620 Timeout *int32 `json:"timeout,omitempty"` 1621 // SourceRepository - The properties that describes the source(code) for the build task. 1622 SourceRepository *SourceRepositoryUpdateParameters `json:"sourceRepository,omitempty"` 1623} 1624 1625// BuildTasksCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 1626type BuildTasksCreateFuture struct { 1627 azure.Future 1628 req *http.Request 1629} 1630 1631// Result returns the result of the asynchronous operation. 1632// If the operation has not completed it will return an error. 1633func (future BuildTasksCreateFuture) Result(client BuildTasksClient) (bt BuildTask, err error) { 1634 var done bool 1635 done, err = future.Done(client) 1636 if err != nil { 1637 err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksCreateFuture", "Result", future.Response(), "Polling failure") 1638 return 1639 } 1640 if !done { 1641 return bt, azure.NewAsyncOpIncompleteError("containerregistry.BuildTasksCreateFuture") 1642 } 1643 if future.PollingMethod() == azure.PollingLocation { 1644 bt, err = client.CreateResponder(future.Response()) 1645 if err != nil { 1646 err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksCreateFuture", "Result", future.Response(), "Failure responding to request") 1647 } 1648 return 1649 } 1650 var req *http.Request 1651 var resp *http.Response 1652 if future.PollingURL() != "" { 1653 req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) 1654 if err != nil { 1655 return 1656 } 1657 } else { 1658 req = autorest.ChangeToGet(future.req) 1659 } 1660 resp, err = autorest.SendWithSender(client, req, 1661 autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1662 if err != nil { 1663 err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksCreateFuture", "Result", resp, "Failure sending request") 1664 return 1665 } 1666 bt, err = client.CreateResponder(resp) 1667 if err != nil { 1668 err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksCreateFuture", "Result", resp, "Failure responding to request") 1669 } 1670 return 1671} 1672 1673// BuildTasksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. 1674type BuildTasksDeleteFuture struct { 1675 azure.Future 1676 req *http.Request 1677} 1678 1679// Result returns the result of the asynchronous operation. 1680// If the operation has not completed it will return an error. 1681func (future BuildTasksDeleteFuture) Result(client BuildTasksClient) (ar autorest.Response, err error) { 1682 var done bool 1683 done, err = future.Done(client) 1684 if err != nil { 1685 err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksDeleteFuture", "Result", future.Response(), "Polling failure") 1686 return 1687 } 1688 if !done { 1689 return ar, azure.NewAsyncOpIncompleteError("containerregistry.BuildTasksDeleteFuture") 1690 } 1691 if future.PollingMethod() == azure.PollingLocation { 1692 ar, err = client.DeleteResponder(future.Response()) 1693 if err != nil { 1694 err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksDeleteFuture", "Result", future.Response(), "Failure responding to request") 1695 } 1696 return 1697 } 1698 var req *http.Request 1699 var resp *http.Response 1700 if future.PollingURL() != "" { 1701 req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) 1702 if err != nil { 1703 return 1704 } 1705 } else { 1706 req = autorest.ChangeToGet(future.req) 1707 } 1708 resp, err = autorest.SendWithSender(client, req, 1709 autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1710 if err != nil { 1711 err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksDeleteFuture", "Result", resp, "Failure sending request") 1712 return 1713 } 1714 ar, err = client.DeleteResponder(resp) 1715 if err != nil { 1716 err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksDeleteFuture", "Result", resp, "Failure responding to request") 1717 } 1718 return 1719} 1720 1721// BuildTasksUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 1722type BuildTasksUpdateFuture struct { 1723 azure.Future 1724 req *http.Request 1725} 1726 1727// Result returns the result of the asynchronous operation. 1728// If the operation has not completed it will return an error. 1729func (future BuildTasksUpdateFuture) Result(client BuildTasksClient) (bt BuildTask, err error) { 1730 var done bool 1731 done, err = future.Done(client) 1732 if err != nil { 1733 err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksUpdateFuture", "Result", future.Response(), "Polling failure") 1734 return 1735 } 1736 if !done { 1737 return bt, azure.NewAsyncOpIncompleteError("containerregistry.BuildTasksUpdateFuture") 1738 } 1739 if future.PollingMethod() == azure.PollingLocation { 1740 bt, err = client.UpdateResponder(future.Response()) 1741 if err != nil { 1742 err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksUpdateFuture", "Result", future.Response(), "Failure responding to request") 1743 } 1744 return 1745 } 1746 var req *http.Request 1747 var resp *http.Response 1748 if future.PollingURL() != "" { 1749 req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) 1750 if err != nil { 1751 return 1752 } 1753 } else { 1754 req = autorest.ChangeToGet(future.req) 1755 } 1756 resp, err = autorest.SendWithSender(client, req, 1757 autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1758 if err != nil { 1759 err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksUpdateFuture", "Result", resp, "Failure sending request") 1760 return 1761 } 1762 bt, err = client.UpdateResponder(resp) 1763 if err != nil { 1764 err = autorest.NewErrorWithError(err, "containerregistry.BuildTasksUpdateFuture", "Result", resp, "Failure responding to request") 1765 } 1766 return 1767} 1768 1769// BuildTaskUpdateParameters the parameters for updating a build task. 1770type BuildTaskUpdateParameters struct { 1771 // BuildTaskPropertiesUpdateParameters - The properties for updating a build task. 1772 *BuildTaskPropertiesUpdateParameters `json:"properties,omitempty"` 1773 // Tags - The ARM resource tags. 1774 Tags map[string]*string `json:"tags"` 1775} 1776 1777// MarshalJSON is the custom marshaler for BuildTaskUpdateParameters. 1778func (btup BuildTaskUpdateParameters) MarshalJSON() ([]byte, error) { 1779 objectMap := make(map[string]interface{}) 1780 if btup.BuildTaskPropertiesUpdateParameters != nil { 1781 objectMap["properties"] = btup.BuildTaskPropertiesUpdateParameters 1782 } 1783 if btup.Tags != nil { 1784 objectMap["tags"] = btup.Tags 1785 } 1786 return json.Marshal(objectMap) 1787} 1788 1789// UnmarshalJSON is the custom unmarshaler for BuildTaskUpdateParameters struct. 1790func (btup *BuildTaskUpdateParameters) UnmarshalJSON(body []byte) error { 1791 var m map[string]*json.RawMessage 1792 err := json.Unmarshal(body, &m) 1793 if err != nil { 1794 return err 1795 } 1796 for k, v := range m { 1797 switch k { 1798 case "properties": 1799 if v != nil { 1800 var buildTaskPropertiesUpdateParameters BuildTaskPropertiesUpdateParameters 1801 err = json.Unmarshal(*v, &buildTaskPropertiesUpdateParameters) 1802 if err != nil { 1803 return err 1804 } 1805 btup.BuildTaskPropertiesUpdateParameters = &buildTaskPropertiesUpdateParameters 1806 } 1807 case "tags": 1808 if v != nil { 1809 var tags map[string]*string 1810 err = json.Unmarshal(*v, &tags) 1811 if err != nil { 1812 return err 1813 } 1814 btup.Tags = tags 1815 } 1816 } 1817 } 1818 1819 return nil 1820} 1821 1822// BuildUpdateParameters the set of build properties that can be updated. 1823type BuildUpdateParameters struct { 1824 // IsArchiveEnabled - The value that indicates whether archiving is enabled or not. 1825 IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` 1826} 1827 1828// CallbackConfig the configuration of service URI and custom headers for the webhook. 1829type CallbackConfig struct { 1830 autorest.Response `json:"-"` 1831 // ServiceURI - The service URI for the webhook to post notifications. 1832 ServiceURI *string `json:"serviceUri,omitempty"` 1833 // CustomHeaders - Custom headers that will be added to the webhook notifications. 1834 CustomHeaders map[string]*string `json:"customHeaders"` 1835} 1836 1837// MarshalJSON is the custom marshaler for CallbackConfig. 1838func (cc CallbackConfig) MarshalJSON() ([]byte, error) { 1839 objectMap := make(map[string]interface{}) 1840 if cc.ServiceURI != nil { 1841 objectMap["serviceUri"] = cc.ServiceURI 1842 } 1843 if cc.CustomHeaders != nil { 1844 objectMap["customHeaders"] = cc.CustomHeaders 1845 } 1846 return json.Marshal(objectMap) 1847} 1848 1849// DockerBuildStep the Docker build step. 1850type DockerBuildStep struct { 1851 // Branch - The repository branch name. 1852 Branch *string `json:"branch,omitempty"` 1853 // ImageNames - The fully qualified image names including the repository and tag. 1854 ImageNames *[]string `json:"imageNames,omitempty"` 1855 // IsPushEnabled - The value of this property indicates whether the image built should be pushed to the registry or not. 1856 IsPushEnabled *bool `json:"isPushEnabled,omitempty"` 1857 // NoCache - The value of this property indicates whether the image cache is enabled or not. 1858 NoCache *bool `json:"noCache,omitempty"` 1859 // DockerFilePath - The Docker file path relative to the source control root. 1860 DockerFilePath *string `json:"dockerFilePath,omitempty"` 1861 // ContextPath - The relative context path for a docker build in the source. 1862 ContextPath *string `json:"contextPath,omitempty"` 1863 // BuildArguments - The custom arguments for building this build step. 1864 BuildArguments *[]BuildArgument `json:"buildArguments,omitempty"` 1865 // BaseImageDependencies - List of base image dependencies for a step. 1866 BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` 1867 // BaseImageTrigger - The type of the auto trigger for base image dependency updates. Possible values include: 'All', 'Runtime', 'None' 1868 BaseImageTrigger BaseImageTriggerType `json:"baseImageTrigger,omitempty"` 1869 // ProvisioningState - The provisioning state of the build step. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' 1870 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 1871 // Type - Possible values include: 'TypeBuildStepProperties', 'TypeDocker' 1872 Type Type `json:"type,omitempty"` 1873} 1874 1875// MarshalJSON is the custom marshaler for DockerBuildStep. 1876func (dbs DockerBuildStep) MarshalJSON() ([]byte, error) { 1877 dbs.Type = TypeDocker 1878 objectMap := make(map[string]interface{}) 1879 if dbs.Branch != nil { 1880 objectMap["branch"] = dbs.Branch 1881 } 1882 if dbs.ImageNames != nil { 1883 objectMap["imageNames"] = dbs.ImageNames 1884 } 1885 if dbs.IsPushEnabled != nil { 1886 objectMap["isPushEnabled"] = dbs.IsPushEnabled 1887 } 1888 if dbs.NoCache != nil { 1889 objectMap["noCache"] = dbs.NoCache 1890 } 1891 if dbs.DockerFilePath != nil { 1892 objectMap["dockerFilePath"] = dbs.DockerFilePath 1893 } 1894 if dbs.ContextPath != nil { 1895 objectMap["contextPath"] = dbs.ContextPath 1896 } 1897 if dbs.BuildArguments != nil { 1898 objectMap["buildArguments"] = dbs.BuildArguments 1899 } 1900 if dbs.BaseImageDependencies != nil { 1901 objectMap["baseImageDependencies"] = dbs.BaseImageDependencies 1902 } 1903 if dbs.BaseImageTrigger != "" { 1904 objectMap["baseImageTrigger"] = dbs.BaseImageTrigger 1905 } 1906 if dbs.ProvisioningState != "" { 1907 objectMap["provisioningState"] = dbs.ProvisioningState 1908 } 1909 if dbs.Type != "" { 1910 objectMap["type"] = dbs.Type 1911 } 1912 return json.Marshal(objectMap) 1913} 1914 1915// AsDockerBuildStep is the BasicBuildStepProperties implementation for DockerBuildStep. 1916func (dbs DockerBuildStep) AsDockerBuildStep() (*DockerBuildStep, bool) { 1917 return &dbs, true 1918} 1919 1920// AsBuildStepProperties is the BasicBuildStepProperties implementation for DockerBuildStep. 1921func (dbs DockerBuildStep) AsBuildStepProperties() (*BuildStepProperties, bool) { 1922 return nil, false 1923} 1924 1925// AsBasicBuildStepProperties is the BasicBuildStepProperties implementation for DockerBuildStep. 1926func (dbs DockerBuildStep) AsBasicBuildStepProperties() (BasicBuildStepProperties, bool) { 1927 return &dbs, true 1928} 1929 1930// DockerBuildStepUpdateParameters the properties for updating a docker build step. 1931type DockerBuildStepUpdateParameters struct { 1932 // Branch - The repository branch name. 1933 Branch *string `json:"branch,omitempty"` 1934 // ImageNames - The fully qualified image names including the repository and tag. 1935 ImageNames *[]string `json:"imageNames,omitempty"` 1936 // IsPushEnabled - The value of this property indicates whether the image built should be pushed to the registry or not. 1937 IsPushEnabled *bool `json:"isPushEnabled,omitempty"` 1938 // NoCache - The value of this property indicates whether the image cache is enabled or not. 1939 NoCache *bool `json:"noCache,omitempty"` 1940 // DockerFilePath - The Docker file path relative to the source control root. 1941 DockerFilePath *string `json:"dockerFilePath,omitempty"` 1942 // ContextPath - The relative context path for a docker build in the source. 1943 ContextPath *string `json:"contextPath,omitempty"` 1944 // BuildArguments - The custom arguments for building this build step. 1945 BuildArguments *[]BuildArgument `json:"buildArguments,omitempty"` 1946 // BaseImageTrigger - The type of the auto trigger for base image dependency updates. Possible values include: 'All', 'Runtime', 'None' 1947 BaseImageTrigger BaseImageTriggerType `json:"baseImageTrigger,omitempty"` 1948 // Type - Possible values include: 'TypeBasicBuildStepPropertiesUpdateParametersTypeBuildStepPropertiesUpdateParameters', 'TypeBasicBuildStepPropertiesUpdateParametersTypeDocker' 1949 Type TypeBasicBuildStepPropertiesUpdateParameters `json:"type,omitempty"` 1950} 1951 1952// MarshalJSON is the custom marshaler for DockerBuildStepUpdateParameters. 1953func (dbsup DockerBuildStepUpdateParameters) MarshalJSON() ([]byte, error) { 1954 dbsup.Type = TypeBasicBuildStepPropertiesUpdateParametersTypeDocker 1955 objectMap := make(map[string]interface{}) 1956 if dbsup.Branch != nil { 1957 objectMap["branch"] = dbsup.Branch 1958 } 1959 if dbsup.ImageNames != nil { 1960 objectMap["imageNames"] = dbsup.ImageNames 1961 } 1962 if dbsup.IsPushEnabled != nil { 1963 objectMap["isPushEnabled"] = dbsup.IsPushEnabled 1964 } 1965 if dbsup.NoCache != nil { 1966 objectMap["noCache"] = dbsup.NoCache 1967 } 1968 if dbsup.DockerFilePath != nil { 1969 objectMap["dockerFilePath"] = dbsup.DockerFilePath 1970 } 1971 if dbsup.ContextPath != nil { 1972 objectMap["contextPath"] = dbsup.ContextPath 1973 } 1974 if dbsup.BuildArguments != nil { 1975 objectMap["buildArguments"] = dbsup.BuildArguments 1976 } 1977 if dbsup.BaseImageTrigger != "" { 1978 objectMap["baseImageTrigger"] = dbsup.BaseImageTrigger 1979 } 1980 if dbsup.Type != "" { 1981 objectMap["type"] = dbsup.Type 1982 } 1983 return json.Marshal(objectMap) 1984} 1985 1986// AsDockerBuildStepUpdateParameters is the BasicBuildStepPropertiesUpdateParameters implementation for DockerBuildStepUpdateParameters. 1987func (dbsup DockerBuildStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { 1988 return &dbsup, true 1989} 1990 1991// AsBuildStepPropertiesUpdateParameters is the BasicBuildStepPropertiesUpdateParameters implementation for DockerBuildStepUpdateParameters. 1992func (dbsup DockerBuildStepUpdateParameters) AsBuildStepPropertiesUpdateParameters() (*BuildStepPropertiesUpdateParameters, bool) { 1993 return nil, false 1994} 1995 1996// AsBasicBuildStepPropertiesUpdateParameters is the BasicBuildStepPropertiesUpdateParameters implementation for DockerBuildStepUpdateParameters. 1997func (dbsup DockerBuildStepUpdateParameters) AsBasicBuildStepPropertiesUpdateParameters() (BasicBuildStepPropertiesUpdateParameters, bool) { 1998 return &dbsup, true 1999} 2000 2001// Event the event for a webhook. 2002type Event struct { 2003 // EventRequestMessage - The event request message sent to the service URI. 2004 EventRequestMessage *EventRequestMessage `json:"eventRequestMessage,omitempty"` 2005 // EventResponseMessage - The event response message received from the service URI. 2006 EventResponseMessage *EventResponseMessage `json:"eventResponseMessage,omitempty"` 2007 // ID - The event ID. 2008 ID *string `json:"id,omitempty"` 2009} 2010 2011// EventContent the content of the event request message. 2012type EventContent struct { 2013 // ID - The event ID. 2014 ID *string `json:"id,omitempty"` 2015 // Timestamp - The time at which the event occurred. 2016 Timestamp *date.Time `json:"timestamp,omitempty"` 2017 // Action - The action that encompasses the provided event. 2018 Action *string `json:"action,omitempty"` 2019 // Target - The target of the event. 2020 Target *Target `json:"target,omitempty"` 2021 // Request - The request that generated the event. 2022 Request *Request `json:"request,omitempty"` 2023 // Actor - The agent that initiated the event. For most situations, this could be from the authorization context of the request. 2024 Actor *Actor `json:"actor,omitempty"` 2025 // Source - The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. 2026 Source *Source `json:"source,omitempty"` 2027} 2028 2029// EventInfo the basic information of an event. 2030type EventInfo struct { 2031 autorest.Response `json:"-"` 2032 // ID - The event ID. 2033 ID *string `json:"id,omitempty"` 2034} 2035 2036// EventListResult the result of a request to list events for a webhook. 2037type EventListResult struct { 2038 autorest.Response `json:"-"` 2039 // Value - The list of events. Since this list may be incomplete, the nextLink field should be used to request the next list of events. 2040 Value *[]Event `json:"value,omitempty"` 2041 // NextLink - The URI that can be used to request the next list of events. 2042 NextLink *string `json:"nextLink,omitempty"` 2043} 2044 2045// EventListResultIterator provides access to a complete listing of Event values. 2046type EventListResultIterator struct { 2047 i int 2048 page EventListResultPage 2049} 2050 2051// Next advances to the next value. If there was an error making 2052// the request the iterator does not advance and the error is returned. 2053func (iter *EventListResultIterator) Next() error { 2054 iter.i++ 2055 if iter.i < len(iter.page.Values()) { 2056 return nil 2057 } 2058 err := iter.page.Next() 2059 if err != nil { 2060 iter.i-- 2061 return err 2062 } 2063 iter.i = 0 2064 return nil 2065} 2066 2067// NotDone returns true if the enumeration should be started or is not yet complete. 2068func (iter EventListResultIterator) NotDone() bool { 2069 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2070} 2071 2072// Response returns the raw server response from the last page request. 2073func (iter EventListResultIterator) Response() EventListResult { 2074 return iter.page.Response() 2075} 2076 2077// Value returns the current value or a zero-initialized value if the 2078// iterator has advanced beyond the end of the collection. 2079func (iter EventListResultIterator) Value() Event { 2080 if !iter.page.NotDone() { 2081 return Event{} 2082 } 2083 return iter.page.Values()[iter.i] 2084} 2085 2086// IsEmpty returns true if the ListResult contains no values. 2087func (elr EventListResult) IsEmpty() bool { 2088 return elr.Value == nil || len(*elr.Value) == 0 2089} 2090 2091// eventListResultPreparer prepares a request to retrieve the next set of results. 2092// It returns nil if no more results exist. 2093func (elr EventListResult) eventListResultPreparer() (*http.Request, error) { 2094 if elr.NextLink == nil || len(to.String(elr.NextLink)) < 1 { 2095 return nil, nil 2096 } 2097 return autorest.Prepare(&http.Request{}, 2098 autorest.AsJSON(), 2099 autorest.AsGet(), 2100 autorest.WithBaseURL(to.String(elr.NextLink))) 2101} 2102 2103// EventListResultPage contains a page of Event values. 2104type EventListResultPage struct { 2105 fn func(EventListResult) (EventListResult, error) 2106 elr EventListResult 2107} 2108 2109// Next advances to the next page of values. If there was an error making 2110// the request the page does not advance and the error is returned. 2111func (page *EventListResultPage) Next() error { 2112 next, err := page.fn(page.elr) 2113 if err != nil { 2114 return err 2115 } 2116 page.elr = next 2117 return nil 2118} 2119 2120// NotDone returns true if the page enumeration should be started or is not yet complete. 2121func (page EventListResultPage) NotDone() bool { 2122 return !page.elr.IsEmpty() 2123} 2124 2125// Response returns the raw server response from the last page request. 2126func (page EventListResultPage) Response() EventListResult { 2127 return page.elr 2128} 2129 2130// Values returns the slice of values for the current page or nil if there are no values. 2131func (page EventListResultPage) Values() []Event { 2132 if page.elr.IsEmpty() { 2133 return nil 2134 } 2135 return *page.elr.Value 2136} 2137 2138// EventRequestMessage the event request message sent to the service URI. 2139type EventRequestMessage struct { 2140 // Content - The content of the event request message. 2141 Content *EventContent `json:"content,omitempty"` 2142 // Headers - The headers of the event request message. 2143 Headers map[string]*string `json:"headers"` 2144 // Method - The HTTP method used to send the event request message. 2145 Method *string `json:"method,omitempty"` 2146 // RequestURI - The URI used to send the event request message. 2147 RequestURI *string `json:"requestUri,omitempty"` 2148 // Version - The HTTP message version. 2149 Version *string `json:"version,omitempty"` 2150} 2151 2152// MarshalJSON is the custom marshaler for EventRequestMessage. 2153func (erm EventRequestMessage) MarshalJSON() ([]byte, error) { 2154 objectMap := make(map[string]interface{}) 2155 if erm.Content != nil { 2156 objectMap["content"] = erm.Content 2157 } 2158 if erm.Headers != nil { 2159 objectMap["headers"] = erm.Headers 2160 } 2161 if erm.Method != nil { 2162 objectMap["method"] = erm.Method 2163 } 2164 if erm.RequestURI != nil { 2165 objectMap["requestUri"] = erm.RequestURI 2166 } 2167 if erm.Version != nil { 2168 objectMap["version"] = erm.Version 2169 } 2170 return json.Marshal(objectMap) 2171} 2172 2173// EventResponseMessage the event response message received from the service URI. 2174type EventResponseMessage struct { 2175 // Content - The content of the event response message. 2176 Content *string `json:"content,omitempty"` 2177 // Headers - The headers of the event response message. 2178 Headers map[string]*string `json:"headers"` 2179 // ReasonPhrase - The reason phrase of the event response message. 2180 ReasonPhrase *string `json:"reasonPhrase,omitempty"` 2181 // StatusCode - The status code of the event response message. 2182 StatusCode *string `json:"statusCode,omitempty"` 2183 // Version - The HTTP message version. 2184 Version *string `json:"version,omitempty"` 2185} 2186 2187// MarshalJSON is the custom marshaler for EventResponseMessage. 2188func (erm EventResponseMessage) MarshalJSON() ([]byte, error) { 2189 objectMap := make(map[string]interface{}) 2190 if erm.Content != nil { 2191 objectMap["content"] = erm.Content 2192 } 2193 if erm.Headers != nil { 2194 objectMap["headers"] = erm.Headers 2195 } 2196 if erm.ReasonPhrase != nil { 2197 objectMap["reasonPhrase"] = erm.ReasonPhrase 2198 } 2199 if erm.StatusCode != nil { 2200 objectMap["statusCode"] = erm.StatusCode 2201 } 2202 if erm.Version != nil { 2203 objectMap["version"] = erm.Version 2204 } 2205 return json.Marshal(objectMap) 2206} 2207 2208// GitCommitTrigger the git commit trigger that caused a build. 2209type GitCommitTrigger struct { 2210 // ID - The unique ID of the trigger. 2211 ID *string `json:"id,omitempty"` 2212 // CommitID - The unique ID that identifies a commit. 2213 CommitID *string `json:"commitId,omitempty"` 2214 // RepositoryURL - The repository URL. 2215 RepositoryURL *string `json:"repositoryUrl,omitempty"` 2216 // BranchName - The branch name in the repository. 2217 BranchName *string `json:"branchName,omitempty"` 2218 // ProviderType - The source control provider type. 2219 ProviderType *string `json:"providerType,omitempty"` 2220} 2221 2222// ImageDescriptor properties for a registry image. 2223type ImageDescriptor struct { 2224 // Registry - The registry login server. 2225 Registry *string `json:"registry,omitempty"` 2226 // Repository - The repository name. 2227 Repository *string `json:"repository,omitempty"` 2228 // Tag - The tag name. 2229 Tag *string `json:"tag,omitempty"` 2230 // Digest - The sha256-based digest of the image manifest. 2231 Digest *string `json:"digest,omitempty"` 2232} 2233 2234// ImageUpdateTrigger the image update trigger that caused a build. 2235type ImageUpdateTrigger struct { 2236 // ID - The unique ID of the trigger. 2237 ID *string `json:"id,omitempty"` 2238 // Timestamp - The timestamp when the image update happened. 2239 Timestamp *date.Time `json:"timestamp,omitempty"` 2240 // Images - The list of image updates that caused the build. 2241 Images *[]ImageDescriptor `json:"images,omitempty"` 2242} 2243 2244// ImportImageParameters ... 2245type ImportImageParameters struct { 2246 // Source - The source of the image. 2247 Source *ImportSource `json:"source,omitempty"` 2248 // 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). 2249 TargetTags *[]string `json:"targetTags,omitempty"` 2250 // UntaggedTargetRepositories - List of strings of repository names to do a manifest only copy. No tag will be created. 2251 UntaggedTargetRepositories *[]string `json:"untaggedTargetRepositories,omitempty"` 2252 // 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' 2253 Mode ImportMode `json:"mode,omitempty"` 2254} 2255 2256// ImportSource ... 2257type ImportSource struct { 2258 // ResourceID - The resource identifier of the target Azure Container Registry. 2259 ResourceID *string `json:"resourceId,omitempty"` 2260 // SourceImage - Repository name of the source image. 2261 // Specify an image by repository ('hello-world'). This will use the 'latest' tag. 2262 // Specify an image by tag ('hello-world:latest'). 2263 // Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). 2264 SourceImage *string `json:"sourceImage,omitempty"` 2265} 2266 2267// OperationDefinition the definition of a container registry operation. 2268type OperationDefinition struct { 2269 // Name - Operation name: {provider}/{resource}/{operation}. 2270 Name *string `json:"name,omitempty"` 2271 // Display - The display information for the container registry operation. 2272 Display *OperationDisplayDefinition `json:"display,omitempty"` 2273} 2274 2275// OperationDisplayDefinition the display information for a container registry operation. 2276type OperationDisplayDefinition struct { 2277 // Provider - The resource provider name: Microsoft.ContainerRegistry. 2278 Provider *string `json:"provider,omitempty"` 2279 // Resource - The resource on which the operation is performed. 2280 Resource *string `json:"resource,omitempty"` 2281 // Operation - The operation that users can perform. 2282 Operation *string `json:"operation,omitempty"` 2283 // Description - The description for the operation. 2284 Description *string `json:"description,omitempty"` 2285} 2286 2287// OperationListResult the result of a request to list container registry operations. 2288type OperationListResult struct { 2289 autorest.Response `json:"-"` 2290 // 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. 2291 Value *[]OperationDefinition `json:"value,omitempty"` 2292 // NextLink - The URI that can be used to request the next list of container registry operations. 2293 NextLink *string `json:"nextLink,omitempty"` 2294} 2295 2296// OperationListResultIterator provides access to a complete listing of OperationDefinition values. 2297type OperationListResultIterator struct { 2298 i int 2299 page OperationListResultPage 2300} 2301 2302// Next advances to the next value. If there was an error making 2303// the request the iterator does not advance and the error is returned. 2304func (iter *OperationListResultIterator) Next() error { 2305 iter.i++ 2306 if iter.i < len(iter.page.Values()) { 2307 return nil 2308 } 2309 err := iter.page.Next() 2310 if err != nil { 2311 iter.i-- 2312 return err 2313 } 2314 iter.i = 0 2315 return nil 2316} 2317 2318// NotDone returns true if the enumeration should be started or is not yet complete. 2319func (iter OperationListResultIterator) NotDone() bool { 2320 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2321} 2322 2323// Response returns the raw server response from the last page request. 2324func (iter OperationListResultIterator) Response() OperationListResult { 2325 return iter.page.Response() 2326} 2327 2328// Value returns the current value or a zero-initialized value if the 2329// iterator has advanced beyond the end of the collection. 2330func (iter OperationListResultIterator) Value() OperationDefinition { 2331 if !iter.page.NotDone() { 2332 return OperationDefinition{} 2333 } 2334 return iter.page.Values()[iter.i] 2335} 2336 2337// IsEmpty returns true if the ListResult contains no values. 2338func (olr OperationListResult) IsEmpty() bool { 2339 return olr.Value == nil || len(*olr.Value) == 0 2340} 2341 2342// operationListResultPreparer prepares a request to retrieve the next set of results. 2343// It returns nil if no more results exist. 2344func (olr OperationListResult) operationListResultPreparer() (*http.Request, error) { 2345 if olr.NextLink == nil || len(to.String(olr.NextLink)) < 1 { 2346 return nil, nil 2347 } 2348 return autorest.Prepare(&http.Request{}, 2349 autorest.AsJSON(), 2350 autorest.AsGet(), 2351 autorest.WithBaseURL(to.String(olr.NextLink))) 2352} 2353 2354// OperationListResultPage contains a page of OperationDefinition values. 2355type OperationListResultPage struct { 2356 fn func(OperationListResult) (OperationListResult, error) 2357 olr OperationListResult 2358} 2359 2360// Next advances to the next page of values. If there was an error making 2361// the request the page does not advance and the error is returned. 2362func (page *OperationListResultPage) Next() error { 2363 next, err := page.fn(page.olr) 2364 if err != nil { 2365 return err 2366 } 2367 page.olr = next 2368 return nil 2369} 2370 2371// NotDone returns true if the page enumeration should be started or is not yet complete. 2372func (page OperationListResultPage) NotDone() bool { 2373 return !page.olr.IsEmpty() 2374} 2375 2376// Response returns the raw server response from the last page request. 2377func (page OperationListResultPage) Response() OperationListResult { 2378 return page.olr 2379} 2380 2381// Values returns the slice of values for the current page or nil if there are no values. 2382func (page OperationListResultPage) Values() []OperationDefinition { 2383 if page.olr.IsEmpty() { 2384 return nil 2385 } 2386 return *page.olr.Value 2387} 2388 2389// PlatformProperties the platform properties against which the build has to happen. 2390type PlatformProperties struct { 2391 // OsType - The operating system type required for the build. Possible values include: 'Windows', 'Linux' 2392 OsType OsType `json:"osType,omitempty"` 2393 // CPU - The CPU configuration in terms of number of cores required for the build. 2394 CPU *int32 `json:"cpu,omitempty"` 2395} 2396 2397// ProxyResource the resource model definition for a ARM proxy resource. It will have everything other than 2398// required location and tags. 2399type ProxyResource struct { 2400 // ID - The resource ID. 2401 ID *string `json:"id,omitempty"` 2402 // Name - The name of the resource. 2403 Name *string `json:"name,omitempty"` 2404 // Type - The type of the resource. 2405 Type *string `json:"type,omitempty"` 2406} 2407 2408// BasicQueueBuildRequest the queue build request parameters. 2409type BasicQueueBuildRequest interface { 2410 AsBuildTaskBuildRequest() (*BuildTaskBuildRequest, bool) 2411 AsQuickBuildRequest() (*QuickBuildRequest, bool) 2412 AsQueueBuildRequest() (*QueueBuildRequest, bool) 2413} 2414 2415// QueueBuildRequest the queue build request parameters. 2416type QueueBuildRequest struct { 2417 // Type - Possible values include: 'TypeQueueBuildRequest', 'TypeBuildTask', 'TypeQuickBuild' 2418 Type TypeBasicQueueBuildRequest `json:"type,omitempty"` 2419} 2420 2421func unmarshalBasicQueueBuildRequest(body []byte) (BasicQueueBuildRequest, error) { 2422 var m map[string]interface{} 2423 err := json.Unmarshal(body, &m) 2424 if err != nil { 2425 return nil, err 2426 } 2427 2428 switch m["type"] { 2429 case string(TypeBuildTask): 2430 var btbr BuildTaskBuildRequest 2431 err := json.Unmarshal(body, &btbr) 2432 return btbr, err 2433 case string(TypeQuickBuild): 2434 var qbr QuickBuildRequest 2435 err := json.Unmarshal(body, &qbr) 2436 return qbr, err 2437 default: 2438 var qbr QueueBuildRequest 2439 err := json.Unmarshal(body, &qbr) 2440 return qbr, err 2441 } 2442} 2443func unmarshalBasicQueueBuildRequestArray(body []byte) ([]BasicQueueBuildRequest, error) { 2444 var rawMessages []*json.RawMessage 2445 err := json.Unmarshal(body, &rawMessages) 2446 if err != nil { 2447 return nil, err 2448 } 2449 2450 qbrArray := make([]BasicQueueBuildRequest, len(rawMessages)) 2451 2452 for index, rawMessage := range rawMessages { 2453 qbr, err := unmarshalBasicQueueBuildRequest(*rawMessage) 2454 if err != nil { 2455 return nil, err 2456 } 2457 qbrArray[index] = qbr 2458 } 2459 return qbrArray, nil 2460} 2461 2462// MarshalJSON is the custom marshaler for QueueBuildRequest. 2463func (qbr QueueBuildRequest) MarshalJSON() ([]byte, error) { 2464 qbr.Type = TypeQueueBuildRequest 2465 objectMap := make(map[string]interface{}) 2466 if qbr.Type != "" { 2467 objectMap["type"] = qbr.Type 2468 } 2469 return json.Marshal(objectMap) 2470} 2471 2472// AsBuildTaskBuildRequest is the BasicQueueBuildRequest implementation for QueueBuildRequest. 2473func (qbr QueueBuildRequest) AsBuildTaskBuildRequest() (*BuildTaskBuildRequest, bool) { 2474 return nil, false 2475} 2476 2477// AsQuickBuildRequest is the BasicQueueBuildRequest implementation for QueueBuildRequest. 2478func (qbr QueueBuildRequest) AsQuickBuildRequest() (*QuickBuildRequest, bool) { 2479 return nil, false 2480} 2481 2482// AsQueueBuildRequest is the BasicQueueBuildRequest implementation for QueueBuildRequest. 2483func (qbr QueueBuildRequest) AsQueueBuildRequest() (*QueueBuildRequest, bool) { 2484 return &qbr, true 2485} 2486 2487// AsBasicQueueBuildRequest is the BasicQueueBuildRequest implementation for QueueBuildRequest. 2488func (qbr QueueBuildRequest) AsBasicQueueBuildRequest() (BasicQueueBuildRequest, bool) { 2489 return &qbr, true 2490} 2491 2492// QuickBuildRequest the queue build request parameters for a quick build. 2493type QuickBuildRequest struct { 2494 // ImageNames - The fully qualified image names including the repository and tag. 2495 ImageNames *[]string `json:"imageNames,omitempty"` 2496 // SourceLocation - The URL(absolute or relative) of the source that needs to be built. For Docker build, it can be an URL to a tar or github repoistory as supported by Docker. 2497 // If it is relative URL, the relative path should be obtained from calling getSourceUploadUrl API. 2498 SourceLocation *string `json:"sourceLocation,omitempty"` 2499 // BuildArguments - The collection of build arguments to be used. 2500 BuildArguments *[]BuildArgument `json:"buildArguments,omitempty"` 2501 // IsPushEnabled - The value of this property indicates whether the image built should be pushed to the registry or not. 2502 IsPushEnabled *bool `json:"isPushEnabled,omitempty"` 2503 // NoCache - The value of this property indicates whether the image cache is enabled or not. 2504 NoCache *bool `json:"noCache,omitempty"` 2505 // Timeout - Build timeout in seconds. 2506 Timeout *int32 `json:"timeout,omitempty"` 2507 // Platform - The platform properties against which the build will happen. 2508 Platform *PlatformProperties `json:"platform,omitempty"` 2509 // DockerFilePath - The Docker file path relative to the source location. 2510 DockerFilePath *string `json:"dockerFilePath,omitempty"` 2511 // Type - Possible values include: 'TypeQueueBuildRequest', 'TypeBuildTask', 'TypeQuickBuild' 2512 Type TypeBasicQueueBuildRequest `json:"type,omitempty"` 2513} 2514 2515// MarshalJSON is the custom marshaler for QuickBuildRequest. 2516func (qbr QuickBuildRequest) MarshalJSON() ([]byte, error) { 2517 qbr.Type = TypeQuickBuild 2518 objectMap := make(map[string]interface{}) 2519 if qbr.ImageNames != nil { 2520 objectMap["imageNames"] = qbr.ImageNames 2521 } 2522 if qbr.SourceLocation != nil { 2523 objectMap["sourceLocation"] = qbr.SourceLocation 2524 } 2525 if qbr.BuildArguments != nil { 2526 objectMap["buildArguments"] = qbr.BuildArguments 2527 } 2528 if qbr.IsPushEnabled != nil { 2529 objectMap["isPushEnabled"] = qbr.IsPushEnabled 2530 } 2531 if qbr.NoCache != nil { 2532 objectMap["noCache"] = qbr.NoCache 2533 } 2534 if qbr.Timeout != nil { 2535 objectMap["timeout"] = qbr.Timeout 2536 } 2537 if qbr.Platform != nil { 2538 objectMap["platform"] = qbr.Platform 2539 } 2540 if qbr.DockerFilePath != nil { 2541 objectMap["dockerFilePath"] = qbr.DockerFilePath 2542 } 2543 if qbr.Type != "" { 2544 objectMap["type"] = qbr.Type 2545 } 2546 return json.Marshal(objectMap) 2547} 2548 2549// AsBuildTaskBuildRequest is the BasicQueueBuildRequest implementation for QuickBuildRequest. 2550func (qbr QuickBuildRequest) AsBuildTaskBuildRequest() (*BuildTaskBuildRequest, bool) { 2551 return nil, false 2552} 2553 2554// AsQuickBuildRequest is the BasicQueueBuildRequest implementation for QuickBuildRequest. 2555func (qbr QuickBuildRequest) AsQuickBuildRequest() (*QuickBuildRequest, bool) { 2556 return &qbr, true 2557} 2558 2559// AsQueueBuildRequest is the BasicQueueBuildRequest implementation for QuickBuildRequest. 2560func (qbr QuickBuildRequest) AsQueueBuildRequest() (*QueueBuildRequest, bool) { 2561 return nil, false 2562} 2563 2564// AsBasicQueueBuildRequest is the BasicQueueBuildRequest implementation for QuickBuildRequest. 2565func (qbr QuickBuildRequest) AsBasicQueueBuildRequest() (BasicQueueBuildRequest, bool) { 2566 return &qbr, true 2567} 2568 2569// RegenerateCredentialParameters the parameters used to regenerate the login credential. 2570type RegenerateCredentialParameters struct { 2571 // Name - Specifies name of the password which should be regenerated -- password or password2. Possible values include: 'Password', 'Password2' 2572 Name PasswordName `json:"name,omitempty"` 2573} 2574 2575// RegistriesCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 2576type RegistriesCreateFuture struct { 2577 azure.Future 2578 req *http.Request 2579} 2580 2581// Result returns the result of the asynchronous operation. 2582// If the operation has not completed it will return an error. 2583func (future RegistriesCreateFuture) Result(client RegistriesClient) (r Registry, err error) { 2584 var done bool 2585 done, err = future.Done(client) 2586 if err != nil { 2587 err = autorest.NewErrorWithError(err, "containerregistry.RegistriesCreateFuture", "Result", future.Response(), "Polling failure") 2588 return 2589 } 2590 if !done { 2591 return r, azure.NewAsyncOpIncompleteError("containerregistry.RegistriesCreateFuture") 2592 } 2593 if future.PollingMethod() == azure.PollingLocation { 2594 r, err = client.CreateResponder(future.Response()) 2595 if err != nil { 2596 err = autorest.NewErrorWithError(err, "containerregistry.RegistriesCreateFuture", "Result", future.Response(), "Failure responding to request") 2597 } 2598 return 2599 } 2600 var req *http.Request 2601 var resp *http.Response 2602 if future.PollingURL() != "" { 2603 req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) 2604 if err != nil { 2605 return 2606 } 2607 } else { 2608 req = autorest.ChangeToGet(future.req) 2609 } 2610 resp, err = autorest.SendWithSender(client, req, 2611 autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2612 if err != nil { 2613 err = autorest.NewErrorWithError(err, "containerregistry.RegistriesCreateFuture", "Result", resp, "Failure sending request") 2614 return 2615 } 2616 r, err = client.CreateResponder(resp) 2617 if err != nil { 2618 err = autorest.NewErrorWithError(err, "containerregistry.RegistriesCreateFuture", "Result", resp, "Failure responding to request") 2619 } 2620 return 2621} 2622 2623// RegistriesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. 2624type RegistriesDeleteFuture struct { 2625 azure.Future 2626 req *http.Request 2627} 2628 2629// Result returns the result of the asynchronous operation. 2630// If the operation has not completed it will return an error. 2631func (future RegistriesDeleteFuture) Result(client RegistriesClient) (ar autorest.Response, err error) { 2632 var done bool 2633 done, err = future.Done(client) 2634 if err != nil { 2635 err = autorest.NewErrorWithError(err, "containerregistry.RegistriesDeleteFuture", "Result", future.Response(), "Polling failure") 2636 return 2637 } 2638 if !done { 2639 return ar, azure.NewAsyncOpIncompleteError("containerregistry.RegistriesDeleteFuture") 2640 } 2641 if future.PollingMethod() == azure.PollingLocation { 2642 ar, err = client.DeleteResponder(future.Response()) 2643 if err != nil { 2644 err = autorest.NewErrorWithError(err, "containerregistry.RegistriesDeleteFuture", "Result", future.Response(), "Failure responding to request") 2645 } 2646 return 2647 } 2648 var req *http.Request 2649 var resp *http.Response 2650 if future.PollingURL() != "" { 2651 req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) 2652 if err != nil { 2653 return 2654 } 2655 } else { 2656 req = autorest.ChangeToGet(future.req) 2657 } 2658 resp, err = autorest.SendWithSender(client, req, 2659 autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2660 if err != nil { 2661 err = autorest.NewErrorWithError(err, "containerregistry.RegistriesDeleteFuture", "Result", resp, "Failure sending request") 2662 return 2663 } 2664 ar, err = client.DeleteResponder(resp) 2665 if err != nil { 2666 err = autorest.NewErrorWithError(err, "containerregistry.RegistriesDeleteFuture", "Result", resp, "Failure responding to request") 2667 } 2668 return 2669} 2670 2671// RegistriesImportImageFuture an abstraction for monitoring and retrieving the results of a long-running 2672// operation. 2673type RegistriesImportImageFuture struct { 2674 azure.Future 2675 req *http.Request 2676} 2677 2678// Result returns the result of the asynchronous operation. 2679// If the operation has not completed it will return an error. 2680func (future RegistriesImportImageFuture) Result(client RegistriesClient) (ar autorest.Response, err error) { 2681 var done bool 2682 done, err = future.Done(client) 2683 if err != nil { 2684 err = autorest.NewErrorWithError(err, "containerregistry.RegistriesImportImageFuture", "Result", future.Response(), "Polling failure") 2685 return 2686 } 2687 if !done { 2688 return ar, azure.NewAsyncOpIncompleteError("containerregistry.RegistriesImportImageFuture") 2689 } 2690 if future.PollingMethod() == azure.PollingLocation { 2691 ar, err = client.ImportImageResponder(future.Response()) 2692 if err != nil { 2693 err = autorest.NewErrorWithError(err, "containerregistry.RegistriesImportImageFuture", "Result", future.Response(), "Failure responding to request") 2694 } 2695 return 2696 } 2697 var req *http.Request 2698 var resp *http.Response 2699 if future.PollingURL() != "" { 2700 req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) 2701 if err != nil { 2702 return 2703 } 2704 } else { 2705 req = autorest.ChangeToGet(future.req) 2706 } 2707 resp, err = autorest.SendWithSender(client, req, 2708 autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2709 if err != nil { 2710 err = autorest.NewErrorWithError(err, "containerregistry.RegistriesImportImageFuture", "Result", resp, "Failure sending request") 2711 return 2712 } 2713 ar, err = client.ImportImageResponder(resp) 2714 if err != nil { 2715 err = autorest.NewErrorWithError(err, "containerregistry.RegistriesImportImageFuture", "Result", resp, "Failure responding to request") 2716 } 2717 return 2718} 2719 2720// RegistriesQueueBuildFuture an abstraction for monitoring and retrieving the results of a long-running operation. 2721type RegistriesQueueBuildFuture struct { 2722 azure.Future 2723 req *http.Request 2724} 2725 2726// Result returns the result of the asynchronous operation. 2727// If the operation has not completed it will return an error. 2728func (future RegistriesQueueBuildFuture) Result(client RegistriesClient) (b Build, err error) { 2729 var done bool 2730 done, err = future.Done(client) 2731 if err != nil { 2732 err = autorest.NewErrorWithError(err, "containerregistry.RegistriesQueueBuildFuture", "Result", future.Response(), "Polling failure") 2733 return 2734 } 2735 if !done { 2736 return b, azure.NewAsyncOpIncompleteError("containerregistry.RegistriesQueueBuildFuture") 2737 } 2738 if future.PollingMethod() == azure.PollingLocation { 2739 b, err = client.QueueBuildResponder(future.Response()) 2740 if err != nil { 2741 err = autorest.NewErrorWithError(err, "containerregistry.RegistriesQueueBuildFuture", "Result", future.Response(), "Failure responding to request") 2742 } 2743 return 2744 } 2745 var req *http.Request 2746 var resp *http.Response 2747 if future.PollingURL() != "" { 2748 req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) 2749 if err != nil { 2750 return 2751 } 2752 } else { 2753 req = autorest.ChangeToGet(future.req) 2754 } 2755 resp, err = autorest.SendWithSender(client, req, 2756 autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2757 if err != nil { 2758 err = autorest.NewErrorWithError(err, "containerregistry.RegistriesQueueBuildFuture", "Result", resp, "Failure sending request") 2759 return 2760 } 2761 b, err = client.QueueBuildResponder(resp) 2762 if err != nil { 2763 err = autorest.NewErrorWithError(err, "containerregistry.RegistriesQueueBuildFuture", "Result", resp, "Failure responding to request") 2764 } 2765 return 2766} 2767 2768// RegistriesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 2769type RegistriesUpdateFuture struct { 2770 azure.Future 2771 req *http.Request 2772} 2773 2774// Result returns the result of the asynchronous operation. 2775// If the operation has not completed it will return an error. 2776func (future RegistriesUpdateFuture) Result(client RegistriesClient) (r Registry, err error) { 2777 var done bool 2778 done, err = future.Done(client) 2779 if err != nil { 2780 err = autorest.NewErrorWithError(err, "containerregistry.RegistriesUpdateFuture", "Result", future.Response(), "Polling failure") 2781 return 2782 } 2783 if !done { 2784 return r, azure.NewAsyncOpIncompleteError("containerregistry.RegistriesUpdateFuture") 2785 } 2786 if future.PollingMethod() == azure.PollingLocation { 2787 r, err = client.UpdateResponder(future.Response()) 2788 if err != nil { 2789 err = autorest.NewErrorWithError(err, "containerregistry.RegistriesUpdateFuture", "Result", future.Response(), "Failure responding to request") 2790 } 2791 return 2792 } 2793 var req *http.Request 2794 var resp *http.Response 2795 if future.PollingURL() != "" { 2796 req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) 2797 if err != nil { 2798 return 2799 } 2800 } else { 2801 req = autorest.ChangeToGet(future.req) 2802 } 2803 resp, err = autorest.SendWithSender(client, req, 2804 autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2805 if err != nil { 2806 err = autorest.NewErrorWithError(err, "containerregistry.RegistriesUpdateFuture", "Result", resp, "Failure sending request") 2807 return 2808 } 2809 r, err = client.UpdateResponder(resp) 2810 if err != nil { 2811 err = autorest.NewErrorWithError(err, "containerregistry.RegistriesUpdateFuture", "Result", resp, "Failure responding to request") 2812 } 2813 return 2814} 2815 2816// Registry an object that represents a container registry. 2817type Registry struct { 2818 autorest.Response `json:"-"` 2819 // Sku - The SKU of the container registry. 2820 Sku *Sku `json:"sku,omitempty"` 2821 // RegistryProperties - The properties of the container registry. 2822 *RegistryProperties `json:"properties,omitempty"` 2823 // ID - The resource ID. 2824 ID *string `json:"id,omitempty"` 2825 // Name - The name of the resource. 2826 Name *string `json:"name,omitempty"` 2827 // Type - The type of the resource. 2828 Type *string `json:"type,omitempty"` 2829 // Location - The location of the resource. This cannot be changed after the resource is created. 2830 Location *string `json:"location,omitempty"` 2831 // Tags - The tags of the resource. 2832 Tags map[string]*string `json:"tags"` 2833} 2834 2835// MarshalJSON is the custom marshaler for Registry. 2836func (r Registry) MarshalJSON() ([]byte, error) { 2837 objectMap := make(map[string]interface{}) 2838 if r.Sku != nil { 2839 objectMap["sku"] = r.Sku 2840 } 2841 if r.RegistryProperties != nil { 2842 objectMap["properties"] = r.RegistryProperties 2843 } 2844 if r.ID != nil { 2845 objectMap["id"] = r.ID 2846 } 2847 if r.Name != nil { 2848 objectMap["name"] = r.Name 2849 } 2850 if r.Type != nil { 2851 objectMap["type"] = r.Type 2852 } 2853 if r.Location != nil { 2854 objectMap["location"] = r.Location 2855 } 2856 if r.Tags != nil { 2857 objectMap["tags"] = r.Tags 2858 } 2859 return json.Marshal(objectMap) 2860} 2861 2862// UnmarshalJSON is the custom unmarshaler for Registry struct. 2863func (r *Registry) UnmarshalJSON(body []byte) error { 2864 var m map[string]*json.RawMessage 2865 err := json.Unmarshal(body, &m) 2866 if err != nil { 2867 return err 2868 } 2869 for k, v := range m { 2870 switch k { 2871 case "sku": 2872 if v != nil { 2873 var sku Sku 2874 err = json.Unmarshal(*v, &sku) 2875 if err != nil { 2876 return err 2877 } 2878 r.Sku = &sku 2879 } 2880 case "properties": 2881 if v != nil { 2882 var registryProperties RegistryProperties 2883 err = json.Unmarshal(*v, ®istryProperties) 2884 if err != nil { 2885 return err 2886 } 2887 r.RegistryProperties = ®istryProperties 2888 } 2889 case "id": 2890 if v != nil { 2891 var ID string 2892 err = json.Unmarshal(*v, &ID) 2893 if err != nil { 2894 return err 2895 } 2896 r.ID = &ID 2897 } 2898 case "name": 2899 if v != nil { 2900 var name string 2901 err = json.Unmarshal(*v, &name) 2902 if err != nil { 2903 return err 2904 } 2905 r.Name = &name 2906 } 2907 case "type": 2908 if v != nil { 2909 var typeVar string 2910 err = json.Unmarshal(*v, &typeVar) 2911 if err != nil { 2912 return err 2913 } 2914 r.Type = &typeVar 2915 } 2916 case "location": 2917 if v != nil { 2918 var location string 2919 err = json.Unmarshal(*v, &location) 2920 if err != nil { 2921 return err 2922 } 2923 r.Location = &location 2924 } 2925 case "tags": 2926 if v != nil { 2927 var tags map[string]*string 2928 err = json.Unmarshal(*v, &tags) 2929 if err != nil { 2930 return err 2931 } 2932 r.Tags = tags 2933 } 2934 } 2935 } 2936 2937 return nil 2938} 2939 2940// RegistryListCredentialsResult the response from the ListCredentials operation. 2941type RegistryListCredentialsResult struct { 2942 autorest.Response `json:"-"` 2943 // Username - The username for a container registry. 2944 Username *string `json:"username,omitempty"` 2945 // Passwords - The list of passwords for a container registry. 2946 Passwords *[]RegistryPassword `json:"passwords,omitempty"` 2947} 2948 2949// RegistryListResult the result of a request to list container registries. 2950type RegistryListResult struct { 2951 autorest.Response `json:"-"` 2952 // 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. 2953 Value *[]Registry `json:"value,omitempty"` 2954 // NextLink - The URI that can be used to request the next list of container registries. 2955 NextLink *string `json:"nextLink,omitempty"` 2956} 2957 2958// RegistryListResultIterator provides access to a complete listing of Registry values. 2959type RegistryListResultIterator struct { 2960 i int 2961 page RegistryListResultPage 2962} 2963 2964// Next advances to the next value. If there was an error making 2965// the request the iterator does not advance and the error is returned. 2966func (iter *RegistryListResultIterator) Next() error { 2967 iter.i++ 2968 if iter.i < len(iter.page.Values()) { 2969 return nil 2970 } 2971 err := iter.page.Next() 2972 if err != nil { 2973 iter.i-- 2974 return err 2975 } 2976 iter.i = 0 2977 return nil 2978} 2979 2980// NotDone returns true if the enumeration should be started or is not yet complete. 2981func (iter RegistryListResultIterator) NotDone() bool { 2982 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2983} 2984 2985// Response returns the raw server response from the last page request. 2986func (iter RegistryListResultIterator) Response() RegistryListResult { 2987 return iter.page.Response() 2988} 2989 2990// Value returns the current value or a zero-initialized value if the 2991// iterator has advanced beyond the end of the collection. 2992func (iter RegistryListResultIterator) Value() Registry { 2993 if !iter.page.NotDone() { 2994 return Registry{} 2995 } 2996 return iter.page.Values()[iter.i] 2997} 2998 2999// IsEmpty returns true if the ListResult contains no values. 3000func (rlr RegistryListResult) IsEmpty() bool { 3001 return rlr.Value == nil || len(*rlr.Value) == 0 3002} 3003 3004// registryListResultPreparer prepares a request to retrieve the next set of results. 3005// It returns nil if no more results exist. 3006func (rlr RegistryListResult) registryListResultPreparer() (*http.Request, error) { 3007 if rlr.NextLink == nil || len(to.String(rlr.NextLink)) < 1 { 3008 return nil, nil 3009 } 3010 return autorest.Prepare(&http.Request{}, 3011 autorest.AsJSON(), 3012 autorest.AsGet(), 3013 autorest.WithBaseURL(to.String(rlr.NextLink))) 3014} 3015 3016// RegistryListResultPage contains a page of Registry values. 3017type RegistryListResultPage struct { 3018 fn func(RegistryListResult) (RegistryListResult, error) 3019 rlr RegistryListResult 3020} 3021 3022// Next advances to the next page of values. If there was an error making 3023// the request the page does not advance and the error is returned. 3024func (page *RegistryListResultPage) Next() error { 3025 next, err := page.fn(page.rlr) 3026 if err != nil { 3027 return err 3028 } 3029 page.rlr = next 3030 return nil 3031} 3032 3033// NotDone returns true if the page enumeration should be started or is not yet complete. 3034func (page RegistryListResultPage) NotDone() bool { 3035 return !page.rlr.IsEmpty() 3036} 3037 3038// Response returns the raw server response from the last page request. 3039func (page RegistryListResultPage) Response() RegistryListResult { 3040 return page.rlr 3041} 3042 3043// Values returns the slice of values for the current page or nil if there are no values. 3044func (page RegistryListResultPage) Values() []Registry { 3045 if page.rlr.IsEmpty() { 3046 return nil 3047 } 3048 return *page.rlr.Value 3049} 3050 3051// RegistryNameCheckRequest a request to check whether a container registry name is available. 3052type RegistryNameCheckRequest struct { 3053 // Name - The name of the container registry. 3054 Name *string `json:"name,omitempty"` 3055 // Type - The resource type of the container registry. This field must be set to 'Microsoft.ContainerRegistry/registries'. 3056 Type *string `json:"type,omitempty"` 3057} 3058 3059// RegistryNameStatus the result of a request to check the availability of a container registry name. 3060type RegistryNameStatus struct { 3061 autorest.Response `json:"-"` 3062 // NameAvailable - The value that indicates whether the name is available. 3063 NameAvailable *bool `json:"nameAvailable,omitempty"` 3064 // Reason - If any, the reason that the name is not available. 3065 Reason *string `json:"reason,omitempty"` 3066 // Message - If any, the error message that provides more detail for the reason that the name is not available. 3067 Message *string `json:"message,omitempty"` 3068} 3069 3070// RegistryPassword the login password for the container registry. 3071type RegistryPassword struct { 3072 // Name - The password name. Possible values include: 'Password', 'Password2' 3073 Name PasswordName `json:"name,omitempty"` 3074 // Value - The password value. 3075 Value *string `json:"value,omitempty"` 3076} 3077 3078// RegistryProperties the properties of a container registry. 3079type RegistryProperties struct { 3080 // LoginServer - The URL that can be used to log into the container registry. 3081 LoginServer *string `json:"loginServer,omitempty"` 3082 // CreationDate - The creation date of the container registry in ISO8601 format. 3083 CreationDate *date.Time `json:"creationDate,omitempty"` 3084 // ProvisioningState - The provisioning state of the container registry at the time the operation was called. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' 3085 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 3086 // Status - The status of the container registry at the time the operation was called. 3087 Status *Status `json:"status,omitempty"` 3088 // AdminUserEnabled - The value that indicates whether the admin user is enabled. 3089 AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"` 3090 // StorageAccount - The properties of the storage account for the container registry. Only applicable to Classic SKU. 3091 StorageAccount *StorageAccountProperties `json:"storageAccount,omitempty"` 3092} 3093 3094// RegistryPropertiesUpdateParameters the parameters for updating the properties of a container registry. 3095type RegistryPropertiesUpdateParameters struct { 3096 // AdminUserEnabled - The value that indicates whether the admin user is enabled. 3097 AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"` 3098 // StorageAccount - The parameters of a storage account for the container registry. Only applicable to Classic SKU. If specified, the storage account must be in the same physical location as the container registry. 3099 StorageAccount *StorageAccountProperties `json:"storageAccount,omitempty"` 3100} 3101 3102// RegistryUpdateParameters the parameters for updating a container registry. 3103type RegistryUpdateParameters struct { 3104 // Tags - The tags for the container registry. 3105 Tags map[string]*string `json:"tags"` 3106 // Sku - The SKU of the container registry. 3107 Sku *Sku `json:"sku,omitempty"` 3108 // RegistryPropertiesUpdateParameters - The properties that the container registry will be updated with. 3109 *RegistryPropertiesUpdateParameters `json:"properties,omitempty"` 3110} 3111 3112// MarshalJSON is the custom marshaler for RegistryUpdateParameters. 3113func (rup RegistryUpdateParameters) MarshalJSON() ([]byte, error) { 3114 objectMap := make(map[string]interface{}) 3115 if rup.Tags != nil { 3116 objectMap["tags"] = rup.Tags 3117 } 3118 if rup.Sku != nil { 3119 objectMap["sku"] = rup.Sku 3120 } 3121 if rup.RegistryPropertiesUpdateParameters != nil { 3122 objectMap["properties"] = rup.RegistryPropertiesUpdateParameters 3123 } 3124 return json.Marshal(objectMap) 3125} 3126 3127// UnmarshalJSON is the custom unmarshaler for RegistryUpdateParameters struct. 3128func (rup *RegistryUpdateParameters) UnmarshalJSON(body []byte) error { 3129 var m map[string]*json.RawMessage 3130 err := json.Unmarshal(body, &m) 3131 if err != nil { 3132 return err 3133 } 3134 for k, v := range m { 3135 switch k { 3136 case "tags": 3137 if v != nil { 3138 var tags map[string]*string 3139 err = json.Unmarshal(*v, &tags) 3140 if err != nil { 3141 return err 3142 } 3143 rup.Tags = tags 3144 } 3145 case "sku": 3146 if v != nil { 3147 var sku Sku 3148 err = json.Unmarshal(*v, &sku) 3149 if err != nil { 3150 return err 3151 } 3152 rup.Sku = &sku 3153 } 3154 case "properties": 3155 if v != nil { 3156 var registryPropertiesUpdateParameters RegistryPropertiesUpdateParameters 3157 err = json.Unmarshal(*v, ®istryPropertiesUpdateParameters) 3158 if err != nil { 3159 return err 3160 } 3161 rup.RegistryPropertiesUpdateParameters = ®istryPropertiesUpdateParameters 3162 } 3163 } 3164 } 3165 3166 return nil 3167} 3168 3169// RegistryUsage the quota usage for a container registry. 3170type RegistryUsage struct { 3171 // Name - The name of the usage. 3172 Name *string `json:"name,omitempty"` 3173 // Limit - The limit of the usage. 3174 Limit *int64 `json:"limit,omitempty"` 3175 // CurrentValue - The current value of the usage. 3176 CurrentValue *int64 `json:"currentValue,omitempty"` 3177 // Unit - The unit of measurement. Possible values include: 'Count', 'Bytes' 3178 Unit RegistryUsageUnit `json:"unit,omitempty"` 3179} 3180 3181// RegistryUsageListResult the result of a request to get container registry quota usages. 3182type RegistryUsageListResult struct { 3183 autorest.Response `json:"-"` 3184 // Value - The list of container registry quota usages. 3185 Value *[]RegistryUsage `json:"value,omitempty"` 3186} 3187 3188// Replication an object that represents a replication for a container registry. 3189type Replication struct { 3190 autorest.Response `json:"-"` 3191 // ReplicationProperties - The properties of the replication. 3192 *ReplicationProperties `json:"properties,omitempty"` 3193 // ID - The resource ID. 3194 ID *string `json:"id,omitempty"` 3195 // Name - The name of the resource. 3196 Name *string `json:"name,omitempty"` 3197 // Type - The type of the resource. 3198 Type *string `json:"type,omitempty"` 3199 // Location - The location of the resource. This cannot be changed after the resource is created. 3200 Location *string `json:"location,omitempty"` 3201 // Tags - The tags of the resource. 3202 Tags map[string]*string `json:"tags"` 3203} 3204 3205// MarshalJSON is the custom marshaler for Replication. 3206func (r Replication) MarshalJSON() ([]byte, error) { 3207 objectMap := make(map[string]interface{}) 3208 if r.ReplicationProperties != nil { 3209 objectMap["properties"] = r.ReplicationProperties 3210 } 3211 if r.ID != nil { 3212 objectMap["id"] = r.ID 3213 } 3214 if r.Name != nil { 3215 objectMap["name"] = r.Name 3216 } 3217 if r.Type != nil { 3218 objectMap["type"] = r.Type 3219 } 3220 if r.Location != nil { 3221 objectMap["location"] = r.Location 3222 } 3223 if r.Tags != nil { 3224 objectMap["tags"] = r.Tags 3225 } 3226 return json.Marshal(objectMap) 3227} 3228 3229// UnmarshalJSON is the custom unmarshaler for Replication struct. 3230func (r *Replication) UnmarshalJSON(body []byte) error { 3231 var m map[string]*json.RawMessage 3232 err := json.Unmarshal(body, &m) 3233 if err != nil { 3234 return err 3235 } 3236 for k, v := range m { 3237 switch k { 3238 case "properties": 3239 if v != nil { 3240 var replicationProperties ReplicationProperties 3241 err = json.Unmarshal(*v, &replicationProperties) 3242 if err != nil { 3243 return err 3244 } 3245 r.ReplicationProperties = &replicationProperties 3246 } 3247 case "id": 3248 if v != nil { 3249 var ID string 3250 err = json.Unmarshal(*v, &ID) 3251 if err != nil { 3252 return err 3253 } 3254 r.ID = &ID 3255 } 3256 case "name": 3257 if v != nil { 3258 var name string 3259 err = json.Unmarshal(*v, &name) 3260 if err != nil { 3261 return err 3262 } 3263 r.Name = &name 3264 } 3265 case "type": 3266 if v != nil { 3267 var typeVar string 3268 err = json.Unmarshal(*v, &typeVar) 3269 if err != nil { 3270 return err 3271 } 3272 r.Type = &typeVar 3273 } 3274 case "location": 3275 if v != nil { 3276 var location string 3277 err = json.Unmarshal(*v, &location) 3278 if err != nil { 3279 return err 3280 } 3281 r.Location = &location 3282 } 3283 case "tags": 3284 if v != nil { 3285 var tags map[string]*string 3286 err = json.Unmarshal(*v, &tags) 3287 if err != nil { 3288 return err 3289 } 3290 r.Tags = tags 3291 } 3292 } 3293 } 3294 3295 return nil 3296} 3297 3298// ReplicationListResult the result of a request to list replications for a container registry. 3299type ReplicationListResult struct { 3300 autorest.Response `json:"-"` 3301 // Value - The list of replications. Since this list may be incomplete, the nextLink field should be used to request the next list of replications. 3302 Value *[]Replication `json:"value,omitempty"` 3303 // NextLink - The URI that can be used to request the next list of replications. 3304 NextLink *string `json:"nextLink,omitempty"` 3305} 3306 3307// ReplicationListResultIterator provides access to a complete listing of Replication values. 3308type ReplicationListResultIterator struct { 3309 i int 3310 page ReplicationListResultPage 3311} 3312 3313// Next advances to the next value. If there was an error making 3314// the request the iterator does not advance and the error is returned. 3315func (iter *ReplicationListResultIterator) Next() error { 3316 iter.i++ 3317 if iter.i < len(iter.page.Values()) { 3318 return nil 3319 } 3320 err := iter.page.Next() 3321 if err != nil { 3322 iter.i-- 3323 return err 3324 } 3325 iter.i = 0 3326 return nil 3327} 3328 3329// NotDone returns true if the enumeration should be started or is not yet complete. 3330func (iter ReplicationListResultIterator) NotDone() bool { 3331 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3332} 3333 3334// Response returns the raw server response from the last page request. 3335func (iter ReplicationListResultIterator) Response() ReplicationListResult { 3336 return iter.page.Response() 3337} 3338 3339// Value returns the current value or a zero-initialized value if the 3340// iterator has advanced beyond the end of the collection. 3341func (iter ReplicationListResultIterator) Value() Replication { 3342 if !iter.page.NotDone() { 3343 return Replication{} 3344 } 3345 return iter.page.Values()[iter.i] 3346} 3347 3348// IsEmpty returns true if the ListResult contains no values. 3349func (rlr ReplicationListResult) IsEmpty() bool { 3350 return rlr.Value == nil || len(*rlr.Value) == 0 3351} 3352 3353// replicationListResultPreparer prepares a request to retrieve the next set of results. 3354// It returns nil if no more results exist. 3355func (rlr ReplicationListResult) replicationListResultPreparer() (*http.Request, error) { 3356 if rlr.NextLink == nil || len(to.String(rlr.NextLink)) < 1 { 3357 return nil, nil 3358 } 3359 return autorest.Prepare(&http.Request{}, 3360 autorest.AsJSON(), 3361 autorest.AsGet(), 3362 autorest.WithBaseURL(to.String(rlr.NextLink))) 3363} 3364 3365// ReplicationListResultPage contains a page of Replication values. 3366type ReplicationListResultPage struct { 3367 fn func(ReplicationListResult) (ReplicationListResult, error) 3368 rlr ReplicationListResult 3369} 3370 3371// Next advances to the next page of values. If there was an error making 3372// the request the page does not advance and the error is returned. 3373func (page *ReplicationListResultPage) Next() error { 3374 next, err := page.fn(page.rlr) 3375 if err != nil { 3376 return err 3377 } 3378 page.rlr = next 3379 return nil 3380} 3381 3382// NotDone returns true if the page enumeration should be started or is not yet complete. 3383func (page ReplicationListResultPage) NotDone() bool { 3384 return !page.rlr.IsEmpty() 3385} 3386 3387// Response returns the raw server response from the last page request. 3388func (page ReplicationListResultPage) Response() ReplicationListResult { 3389 return page.rlr 3390} 3391 3392// Values returns the slice of values for the current page or nil if there are no values. 3393func (page ReplicationListResultPage) Values() []Replication { 3394 if page.rlr.IsEmpty() { 3395 return nil 3396 } 3397 return *page.rlr.Value 3398} 3399 3400// ReplicationProperties the properties of a replication. 3401type ReplicationProperties struct { 3402 // ProvisioningState - The provisioning state of the replication at the time the operation was called. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' 3403 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 3404 // Status - The status of the replication at the time the operation was called. 3405 Status *Status `json:"status,omitempty"` 3406} 3407 3408// ReplicationsCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 3409type ReplicationsCreateFuture struct { 3410 azure.Future 3411 req *http.Request 3412} 3413 3414// Result returns the result of the asynchronous operation. 3415// If the operation has not completed it will return an error. 3416func (future ReplicationsCreateFuture) Result(client ReplicationsClient) (r Replication, err error) { 3417 var done bool 3418 done, err = future.Done(client) 3419 if err != nil { 3420 err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsCreateFuture", "Result", future.Response(), "Polling failure") 3421 return 3422 } 3423 if !done { 3424 return r, azure.NewAsyncOpIncompleteError("containerregistry.ReplicationsCreateFuture") 3425 } 3426 if future.PollingMethod() == azure.PollingLocation { 3427 r, err = client.CreateResponder(future.Response()) 3428 if err != nil { 3429 err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsCreateFuture", "Result", future.Response(), "Failure responding to request") 3430 } 3431 return 3432 } 3433 var req *http.Request 3434 var resp *http.Response 3435 if future.PollingURL() != "" { 3436 req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) 3437 if err != nil { 3438 return 3439 } 3440 } else { 3441 req = autorest.ChangeToGet(future.req) 3442 } 3443 resp, err = autorest.SendWithSender(client, req, 3444 autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3445 if err != nil { 3446 err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsCreateFuture", "Result", resp, "Failure sending request") 3447 return 3448 } 3449 r, err = client.CreateResponder(resp) 3450 if err != nil { 3451 err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsCreateFuture", "Result", resp, "Failure responding to request") 3452 } 3453 return 3454} 3455 3456// ReplicationsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. 3457type ReplicationsDeleteFuture struct { 3458 azure.Future 3459 req *http.Request 3460} 3461 3462// Result returns the result of the asynchronous operation. 3463// If the operation has not completed it will return an error. 3464func (future ReplicationsDeleteFuture) Result(client ReplicationsClient) (ar autorest.Response, err error) { 3465 var done bool 3466 done, err = future.Done(client) 3467 if err != nil { 3468 err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsDeleteFuture", "Result", future.Response(), "Polling failure") 3469 return 3470 } 3471 if !done { 3472 return ar, azure.NewAsyncOpIncompleteError("containerregistry.ReplicationsDeleteFuture") 3473 } 3474 if future.PollingMethod() == azure.PollingLocation { 3475 ar, err = client.DeleteResponder(future.Response()) 3476 if err != nil { 3477 err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsDeleteFuture", "Result", future.Response(), "Failure responding to request") 3478 } 3479 return 3480 } 3481 var req *http.Request 3482 var resp *http.Response 3483 if future.PollingURL() != "" { 3484 req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) 3485 if err != nil { 3486 return 3487 } 3488 } else { 3489 req = autorest.ChangeToGet(future.req) 3490 } 3491 resp, err = autorest.SendWithSender(client, req, 3492 autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3493 if err != nil { 3494 err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsDeleteFuture", "Result", resp, "Failure sending request") 3495 return 3496 } 3497 ar, err = client.DeleteResponder(resp) 3498 if err != nil { 3499 err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsDeleteFuture", "Result", resp, "Failure responding to request") 3500 } 3501 return 3502} 3503 3504// ReplicationsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 3505type ReplicationsUpdateFuture struct { 3506 azure.Future 3507 req *http.Request 3508} 3509 3510// Result returns the result of the asynchronous operation. 3511// If the operation has not completed it will return an error. 3512func (future ReplicationsUpdateFuture) Result(client ReplicationsClient) (r Replication, err error) { 3513 var done bool 3514 done, err = future.Done(client) 3515 if err != nil { 3516 err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsUpdateFuture", "Result", future.Response(), "Polling failure") 3517 return 3518 } 3519 if !done { 3520 return r, azure.NewAsyncOpIncompleteError("containerregistry.ReplicationsUpdateFuture") 3521 } 3522 if future.PollingMethod() == azure.PollingLocation { 3523 r, err = client.UpdateResponder(future.Response()) 3524 if err != nil { 3525 err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsUpdateFuture", "Result", future.Response(), "Failure responding to request") 3526 } 3527 return 3528 } 3529 var req *http.Request 3530 var resp *http.Response 3531 if future.PollingURL() != "" { 3532 req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) 3533 if err != nil { 3534 return 3535 } 3536 } else { 3537 req = autorest.ChangeToGet(future.req) 3538 } 3539 resp, err = autorest.SendWithSender(client, req, 3540 autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3541 if err != nil { 3542 err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsUpdateFuture", "Result", resp, "Failure sending request") 3543 return 3544 } 3545 r, err = client.UpdateResponder(resp) 3546 if err != nil { 3547 err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsUpdateFuture", "Result", resp, "Failure responding to request") 3548 } 3549 return 3550} 3551 3552// ReplicationUpdateParameters the parameters for updating a replication. 3553type ReplicationUpdateParameters struct { 3554 // Tags - The tags for the replication. 3555 Tags map[string]*string `json:"tags"` 3556} 3557 3558// MarshalJSON is the custom marshaler for ReplicationUpdateParameters. 3559func (rup ReplicationUpdateParameters) MarshalJSON() ([]byte, error) { 3560 objectMap := make(map[string]interface{}) 3561 if rup.Tags != nil { 3562 objectMap["tags"] = rup.Tags 3563 } 3564 return json.Marshal(objectMap) 3565} 3566 3567// Request the request that generated the event. 3568type Request struct { 3569 // ID - The ID of the request that initiated the event. 3570 ID *string `json:"id,omitempty"` 3571 // 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. 3572 Addr *string `json:"addr,omitempty"` 3573 // Host - The externally accessible hostname of the registry instance, as specified by the http host header on incoming requests. 3574 Host *string `json:"host,omitempty"` 3575 // Method - The request method that generated the event. 3576 Method *string `json:"method,omitempty"` 3577 // Useragent - The user agent header of the request. 3578 Useragent *string `json:"useragent,omitempty"` 3579} 3580 3581// Resource an Azure resource. 3582type Resource struct { 3583 // ID - The resource ID. 3584 ID *string `json:"id,omitempty"` 3585 // Name - The name of the resource. 3586 Name *string `json:"name,omitempty"` 3587 // Type - The type of the resource. 3588 Type *string `json:"type,omitempty"` 3589 // Location - The location of the resource. This cannot be changed after the resource is created. 3590 Location *string `json:"location,omitempty"` 3591 // Tags - The tags of the resource. 3592 Tags map[string]*string `json:"tags"` 3593} 3594 3595// MarshalJSON is the custom marshaler for Resource. 3596func (r Resource) MarshalJSON() ([]byte, error) { 3597 objectMap := make(map[string]interface{}) 3598 if r.ID != nil { 3599 objectMap["id"] = r.ID 3600 } 3601 if r.Name != nil { 3602 objectMap["name"] = r.Name 3603 } 3604 if r.Type != nil { 3605 objectMap["type"] = r.Type 3606 } 3607 if r.Location != nil { 3608 objectMap["location"] = r.Location 3609 } 3610 if r.Tags != nil { 3611 objectMap["tags"] = r.Tags 3612 } 3613 return json.Marshal(objectMap) 3614} 3615 3616// Sku the SKU of a container registry. 3617type Sku struct { 3618 // Name - The SKU name of the container registry. Required for registry creation. Possible values include: 'Classic', 'Basic', 'Standard', 'Premium' 3619 Name SkuName `json:"name,omitempty"` 3620 // Tier - The SKU tier based on the SKU name. Possible values include: 'SkuTierClassic', 'SkuTierBasic', 'SkuTierStandard', 'SkuTierPremium' 3621 Tier SkuTier `json:"tier,omitempty"` 3622} 3623 3624// Source the registry node that generated the event. Put differently, while the actor initiates the event, the 3625// source generates it. 3626type Source struct { 3627 // 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. 3628 Addr *string `json:"addr,omitempty"` 3629 // InstanceID - The running instance of an application. Changes after each restart. 3630 InstanceID *string `json:"instanceID,omitempty"` 3631} 3632 3633// SourceControlAuthInfo the authorization properties for accessing the source code repository. 3634type SourceControlAuthInfo struct { 3635 // TokenType - The type of Auth token. Possible values include: 'PAT', 'OAuth' 3636 TokenType TokenType `json:"tokenType,omitempty"` 3637 // Token - The access token used to access the source control provider. 3638 Token *string `json:"token,omitempty"` 3639 // RefreshToken - The refresh token used to refresh the access token. 3640 RefreshToken *string `json:"refreshToken,omitempty"` 3641 // Scope - The scope of the access token. 3642 Scope *string `json:"scope,omitempty"` 3643 // ExpiresIn - Time in seconds that the token remains valid 3644 ExpiresIn *int32 `json:"expiresIn,omitempty"` 3645} 3646 3647// SourceRepositoryProperties the properties of the source code repository. 3648type SourceRepositoryProperties struct { 3649 autorest.Response `json:"-"` 3650 // SourceControlType - The type of source control service. Possible values include: 'Github', 'VisualStudioTeamService' 3651 SourceControlType SourceControlType `json:"sourceControlType,omitempty"` 3652 // RepositoryURL - The full URL to the source code respository 3653 RepositoryURL *string `json:"repositoryUrl,omitempty"` 3654 // IsCommitTriggerEnabled - The value of this property indicates whether the source control commit trigger is enabled or not. 3655 IsCommitTriggerEnabled *bool `json:"isCommitTriggerEnabled,omitempty"` 3656 // SourceControlAuthProperties - The authorization properties for accessing the source code repository. 3657 SourceControlAuthProperties *SourceControlAuthInfo `json:"sourceControlAuthProperties,omitempty"` 3658} 3659 3660// SourceRepositoryUpdateParameters the properties for updating the source code repository configuration. 3661type SourceRepositoryUpdateParameters struct { 3662 // SourceControlAuthProperties - The authorization properties for accessing the source code repository. 3663 SourceControlAuthProperties *SourceControlAuthInfo `json:"sourceControlAuthProperties,omitempty"` 3664 // IsCommitTriggerEnabled - The value of this property indicates whether the source control commit trigger is enabled or not. 3665 IsCommitTriggerEnabled *bool `json:"isCommitTriggerEnabled,omitempty"` 3666} 3667 3668// SourceUploadDefinition the properties of a response to source upload request. 3669type SourceUploadDefinition struct { 3670 autorest.Response `json:"-"` 3671 // UploadURL - The URL where the client can upload the source. 3672 UploadURL *string `json:"uploadUrl,omitempty"` 3673 // RelativePath - The relative path to the source. This is used to submit the subsequent queue build request. 3674 RelativePath *string `json:"relativePath,omitempty"` 3675} 3676 3677// Status the status of an Azure resource at the time the operation was called. 3678type Status struct { 3679 // DisplayStatus - The short label for the status. 3680 DisplayStatus *string `json:"displayStatus,omitempty"` 3681 // Message - The detailed message for the status, including alerts and error messages. 3682 Message *string `json:"message,omitempty"` 3683 // Timestamp - The timestamp when the status was changed to the current value. 3684 Timestamp *date.Time `json:"timestamp,omitempty"` 3685} 3686 3687// StorageAccountProperties the properties of a storage account for a container registry. Only applicable to 3688// Classic SKU. 3689type StorageAccountProperties struct { 3690 // ID - The resource ID of the storage account. 3691 ID *string `json:"id,omitempty"` 3692} 3693 3694// Target the target of the event. 3695type Target struct { 3696 // MediaType - The MIME type of the referenced object. 3697 MediaType *string `json:"mediaType,omitempty"` 3698 // Size - The number of bytes of the content. Same as Length field. 3699 Size *int64 `json:"size,omitempty"` 3700 // Digest - The digest of the content, as defined by the Registry V2 HTTP API Specification. 3701 Digest *string `json:"digest,omitempty"` 3702 // Length - The number of bytes of the content. Same as Size field. 3703 Length *int64 `json:"length,omitempty"` 3704 // Repository - The repository name. 3705 Repository *string `json:"repository,omitempty"` 3706 // URL - The direct URL to the content. 3707 URL *string `json:"url,omitempty"` 3708 // Tag - The tag name. 3709 Tag *string `json:"tag,omitempty"` 3710} 3711 3712// Webhook an object that represents a webhook for a container registry. 3713type Webhook struct { 3714 autorest.Response `json:"-"` 3715 // WebhookProperties - The properties of the webhook. 3716 *WebhookProperties `json:"properties,omitempty"` 3717 // ID - The resource ID. 3718 ID *string `json:"id,omitempty"` 3719 // Name - The name of the resource. 3720 Name *string `json:"name,omitempty"` 3721 // Type - The type of the resource. 3722 Type *string `json:"type,omitempty"` 3723 // Location - The location of the resource. This cannot be changed after the resource is created. 3724 Location *string `json:"location,omitempty"` 3725 // Tags - The tags of the resource. 3726 Tags map[string]*string `json:"tags"` 3727} 3728 3729// MarshalJSON is the custom marshaler for Webhook. 3730func (w Webhook) MarshalJSON() ([]byte, error) { 3731 objectMap := make(map[string]interface{}) 3732 if w.WebhookProperties != nil { 3733 objectMap["properties"] = w.WebhookProperties 3734 } 3735 if w.ID != nil { 3736 objectMap["id"] = w.ID 3737 } 3738 if w.Name != nil { 3739 objectMap["name"] = w.Name 3740 } 3741 if w.Type != nil { 3742 objectMap["type"] = w.Type 3743 } 3744 if w.Location != nil { 3745 objectMap["location"] = w.Location 3746 } 3747 if w.Tags != nil { 3748 objectMap["tags"] = w.Tags 3749 } 3750 return json.Marshal(objectMap) 3751} 3752 3753// UnmarshalJSON is the custom unmarshaler for Webhook struct. 3754func (w *Webhook) UnmarshalJSON(body []byte) error { 3755 var m map[string]*json.RawMessage 3756 err := json.Unmarshal(body, &m) 3757 if err != nil { 3758 return err 3759 } 3760 for k, v := range m { 3761 switch k { 3762 case "properties": 3763 if v != nil { 3764 var webhookProperties WebhookProperties 3765 err = json.Unmarshal(*v, &webhookProperties) 3766 if err != nil { 3767 return err 3768 } 3769 w.WebhookProperties = &webhookProperties 3770 } 3771 case "id": 3772 if v != nil { 3773 var ID string 3774 err = json.Unmarshal(*v, &ID) 3775 if err != nil { 3776 return err 3777 } 3778 w.ID = &ID 3779 } 3780 case "name": 3781 if v != nil { 3782 var name string 3783 err = json.Unmarshal(*v, &name) 3784 if err != nil { 3785 return err 3786 } 3787 w.Name = &name 3788 } 3789 case "type": 3790 if v != nil { 3791 var typeVar string 3792 err = json.Unmarshal(*v, &typeVar) 3793 if err != nil { 3794 return err 3795 } 3796 w.Type = &typeVar 3797 } 3798 case "location": 3799 if v != nil { 3800 var location string 3801 err = json.Unmarshal(*v, &location) 3802 if err != nil { 3803 return err 3804 } 3805 w.Location = &location 3806 } 3807 case "tags": 3808 if v != nil { 3809 var tags map[string]*string 3810 err = json.Unmarshal(*v, &tags) 3811 if err != nil { 3812 return err 3813 } 3814 w.Tags = tags 3815 } 3816 } 3817 } 3818 3819 return nil 3820} 3821 3822// WebhookCreateParameters the parameters for creating a webhook. 3823type WebhookCreateParameters struct { 3824 // Tags - The tags for the webhook. 3825 Tags map[string]*string `json:"tags"` 3826 // Location - The location of the webhook. This cannot be changed after the resource is created. 3827 Location *string `json:"location,omitempty"` 3828 // WebhookPropertiesCreateParameters - The properties that the webhook will be created with. 3829 *WebhookPropertiesCreateParameters `json:"properties,omitempty"` 3830} 3831 3832// MarshalJSON is the custom marshaler for WebhookCreateParameters. 3833func (wcp WebhookCreateParameters) MarshalJSON() ([]byte, error) { 3834 objectMap := make(map[string]interface{}) 3835 if wcp.Tags != nil { 3836 objectMap["tags"] = wcp.Tags 3837 } 3838 if wcp.Location != nil { 3839 objectMap["location"] = wcp.Location 3840 } 3841 if wcp.WebhookPropertiesCreateParameters != nil { 3842 objectMap["properties"] = wcp.WebhookPropertiesCreateParameters 3843 } 3844 return json.Marshal(objectMap) 3845} 3846 3847// UnmarshalJSON is the custom unmarshaler for WebhookCreateParameters struct. 3848func (wcp *WebhookCreateParameters) UnmarshalJSON(body []byte) error { 3849 var m map[string]*json.RawMessage 3850 err := json.Unmarshal(body, &m) 3851 if err != nil { 3852 return err 3853 } 3854 for k, v := range m { 3855 switch k { 3856 case "tags": 3857 if v != nil { 3858 var tags map[string]*string 3859 err = json.Unmarshal(*v, &tags) 3860 if err != nil { 3861 return err 3862 } 3863 wcp.Tags = tags 3864 } 3865 case "location": 3866 if v != nil { 3867 var location string 3868 err = json.Unmarshal(*v, &location) 3869 if err != nil { 3870 return err 3871 } 3872 wcp.Location = &location 3873 } 3874 case "properties": 3875 if v != nil { 3876 var webhookPropertiesCreateParameters WebhookPropertiesCreateParameters 3877 err = json.Unmarshal(*v, &webhookPropertiesCreateParameters) 3878 if err != nil { 3879 return err 3880 } 3881 wcp.WebhookPropertiesCreateParameters = &webhookPropertiesCreateParameters 3882 } 3883 } 3884 } 3885 3886 return nil 3887} 3888 3889// WebhookListResult the result of a request to list webhooks for a container registry. 3890type WebhookListResult struct { 3891 autorest.Response `json:"-"` 3892 // Value - The list of webhooks. Since this list may be incomplete, the nextLink field should be used to request the next list of webhooks. 3893 Value *[]Webhook `json:"value,omitempty"` 3894 // NextLink - The URI that can be used to request the next list of webhooks. 3895 NextLink *string `json:"nextLink,omitempty"` 3896} 3897 3898// WebhookListResultIterator provides access to a complete listing of Webhook values. 3899type WebhookListResultIterator struct { 3900 i int 3901 page WebhookListResultPage 3902} 3903 3904// Next advances to the next value. If there was an error making 3905// the request the iterator does not advance and the error is returned. 3906func (iter *WebhookListResultIterator) Next() error { 3907 iter.i++ 3908 if iter.i < len(iter.page.Values()) { 3909 return nil 3910 } 3911 err := iter.page.Next() 3912 if err != nil { 3913 iter.i-- 3914 return err 3915 } 3916 iter.i = 0 3917 return nil 3918} 3919 3920// NotDone returns true if the enumeration should be started or is not yet complete. 3921func (iter WebhookListResultIterator) NotDone() bool { 3922 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3923} 3924 3925// Response returns the raw server response from the last page request. 3926func (iter WebhookListResultIterator) Response() WebhookListResult { 3927 return iter.page.Response() 3928} 3929 3930// Value returns the current value or a zero-initialized value if the 3931// iterator has advanced beyond the end of the collection. 3932func (iter WebhookListResultIterator) Value() Webhook { 3933 if !iter.page.NotDone() { 3934 return Webhook{} 3935 } 3936 return iter.page.Values()[iter.i] 3937} 3938 3939// IsEmpty returns true if the ListResult contains no values. 3940func (wlr WebhookListResult) IsEmpty() bool { 3941 return wlr.Value == nil || len(*wlr.Value) == 0 3942} 3943 3944// webhookListResultPreparer prepares a request to retrieve the next set of results. 3945// It returns nil if no more results exist. 3946func (wlr WebhookListResult) webhookListResultPreparer() (*http.Request, error) { 3947 if wlr.NextLink == nil || len(to.String(wlr.NextLink)) < 1 { 3948 return nil, nil 3949 } 3950 return autorest.Prepare(&http.Request{}, 3951 autorest.AsJSON(), 3952 autorest.AsGet(), 3953 autorest.WithBaseURL(to.String(wlr.NextLink))) 3954} 3955 3956// WebhookListResultPage contains a page of Webhook values. 3957type WebhookListResultPage struct { 3958 fn func(WebhookListResult) (WebhookListResult, error) 3959 wlr WebhookListResult 3960} 3961 3962// Next advances to the next page of values. If there was an error making 3963// the request the page does not advance and the error is returned. 3964func (page *WebhookListResultPage) Next() error { 3965 next, err := page.fn(page.wlr) 3966 if err != nil { 3967 return err 3968 } 3969 page.wlr = next 3970 return nil 3971} 3972 3973// NotDone returns true if the page enumeration should be started or is not yet complete. 3974func (page WebhookListResultPage) NotDone() bool { 3975 return !page.wlr.IsEmpty() 3976} 3977 3978// Response returns the raw server response from the last page request. 3979func (page WebhookListResultPage) Response() WebhookListResult { 3980 return page.wlr 3981} 3982 3983// Values returns the slice of values for the current page or nil if there are no values. 3984func (page WebhookListResultPage) Values() []Webhook { 3985 if page.wlr.IsEmpty() { 3986 return nil 3987 } 3988 return *page.wlr.Value 3989} 3990 3991// WebhookProperties the properties of a webhook. 3992type WebhookProperties struct { 3993 // Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled' 3994 Status WebhookStatus `json:"status,omitempty"` 3995 // 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. 3996 Scope *string `json:"scope,omitempty"` 3997 // Actions - The list of actions that trigger the webhook to post notifications. 3998 Actions *[]WebhookAction `json:"actions,omitempty"` 3999 // ProvisioningState - The provisioning state of the webhook at the time the operation was called. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' 4000 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 4001} 4002 4003// WebhookPropertiesCreateParameters the parameters for creating the properties of a webhook. 4004type WebhookPropertiesCreateParameters struct { 4005 // ServiceURI - The service URI for the webhook to post notifications. 4006 ServiceURI *string `json:"serviceUri,omitempty"` 4007 // CustomHeaders - Custom headers that will be added to the webhook notifications. 4008 CustomHeaders map[string]*string `json:"customHeaders"` 4009 // Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled' 4010 Status WebhookStatus `json:"status,omitempty"` 4011 // 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. 4012 Scope *string `json:"scope,omitempty"` 4013 // Actions - The list of actions that trigger the webhook to post notifications. 4014 Actions *[]WebhookAction `json:"actions,omitempty"` 4015} 4016 4017// MarshalJSON is the custom marshaler for WebhookPropertiesCreateParameters. 4018func (wpcp WebhookPropertiesCreateParameters) MarshalJSON() ([]byte, error) { 4019 objectMap := make(map[string]interface{}) 4020 if wpcp.ServiceURI != nil { 4021 objectMap["serviceUri"] = wpcp.ServiceURI 4022 } 4023 if wpcp.CustomHeaders != nil { 4024 objectMap["customHeaders"] = wpcp.CustomHeaders 4025 } 4026 if wpcp.Status != "" { 4027 objectMap["status"] = wpcp.Status 4028 } 4029 if wpcp.Scope != nil { 4030 objectMap["scope"] = wpcp.Scope 4031 } 4032 if wpcp.Actions != nil { 4033 objectMap["actions"] = wpcp.Actions 4034 } 4035 return json.Marshal(objectMap) 4036} 4037 4038// WebhookPropertiesUpdateParameters the parameters for updating the properties of a webhook. 4039type WebhookPropertiesUpdateParameters struct { 4040 // ServiceURI - The service URI for the webhook to post notifications. 4041 ServiceURI *string `json:"serviceUri,omitempty"` 4042 // CustomHeaders - Custom headers that will be added to the webhook notifications. 4043 CustomHeaders map[string]*string `json:"customHeaders"` 4044 // Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled' 4045 Status WebhookStatus `json:"status,omitempty"` 4046 // 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. 4047 Scope *string `json:"scope,omitempty"` 4048 // Actions - The list of actions that trigger the webhook to post notifications. 4049 Actions *[]WebhookAction `json:"actions,omitempty"` 4050} 4051 4052// MarshalJSON is the custom marshaler for WebhookPropertiesUpdateParameters. 4053func (wpup WebhookPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { 4054 objectMap := make(map[string]interface{}) 4055 if wpup.ServiceURI != nil { 4056 objectMap["serviceUri"] = wpup.ServiceURI 4057 } 4058 if wpup.CustomHeaders != nil { 4059 objectMap["customHeaders"] = wpup.CustomHeaders 4060 } 4061 if wpup.Status != "" { 4062 objectMap["status"] = wpup.Status 4063 } 4064 if wpup.Scope != nil { 4065 objectMap["scope"] = wpup.Scope 4066 } 4067 if wpup.Actions != nil { 4068 objectMap["actions"] = wpup.Actions 4069 } 4070 return json.Marshal(objectMap) 4071} 4072 4073// WebhooksCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 4074type WebhooksCreateFuture struct { 4075 azure.Future 4076 req *http.Request 4077} 4078 4079// Result returns the result of the asynchronous operation. 4080// If the operation has not completed it will return an error. 4081func (future WebhooksCreateFuture) Result(client WebhooksClient) (w Webhook, err error) { 4082 var done bool 4083 done, err = future.Done(client) 4084 if err != nil { 4085 err = autorest.NewErrorWithError(err, "containerregistry.WebhooksCreateFuture", "Result", future.Response(), "Polling failure") 4086 return 4087 } 4088 if !done { 4089 return w, azure.NewAsyncOpIncompleteError("containerregistry.WebhooksCreateFuture") 4090 } 4091 if future.PollingMethod() == azure.PollingLocation { 4092 w, err = client.CreateResponder(future.Response()) 4093 if err != nil { 4094 err = autorest.NewErrorWithError(err, "containerregistry.WebhooksCreateFuture", "Result", future.Response(), "Failure responding to request") 4095 } 4096 return 4097 } 4098 var req *http.Request 4099 var resp *http.Response 4100 if future.PollingURL() != "" { 4101 req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) 4102 if err != nil { 4103 return 4104 } 4105 } else { 4106 req = autorest.ChangeToGet(future.req) 4107 } 4108 resp, err = autorest.SendWithSender(client, req, 4109 autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4110 if err != nil { 4111 err = autorest.NewErrorWithError(err, "containerregistry.WebhooksCreateFuture", "Result", resp, "Failure sending request") 4112 return 4113 } 4114 w, err = client.CreateResponder(resp) 4115 if err != nil { 4116 err = autorest.NewErrorWithError(err, "containerregistry.WebhooksCreateFuture", "Result", resp, "Failure responding to request") 4117 } 4118 return 4119} 4120 4121// WebhooksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. 4122type WebhooksDeleteFuture struct { 4123 azure.Future 4124 req *http.Request 4125} 4126 4127// Result returns the result of the asynchronous operation. 4128// If the operation has not completed it will return an error. 4129func (future WebhooksDeleteFuture) Result(client WebhooksClient) (ar autorest.Response, err error) { 4130 var done bool 4131 done, err = future.Done(client) 4132 if err != nil { 4133 err = autorest.NewErrorWithError(err, "containerregistry.WebhooksDeleteFuture", "Result", future.Response(), "Polling failure") 4134 return 4135 } 4136 if !done { 4137 return ar, azure.NewAsyncOpIncompleteError("containerregistry.WebhooksDeleteFuture") 4138 } 4139 if future.PollingMethod() == azure.PollingLocation { 4140 ar, err = client.DeleteResponder(future.Response()) 4141 if err != nil { 4142 err = autorest.NewErrorWithError(err, "containerregistry.WebhooksDeleteFuture", "Result", future.Response(), "Failure responding to request") 4143 } 4144 return 4145 } 4146 var req *http.Request 4147 var resp *http.Response 4148 if future.PollingURL() != "" { 4149 req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) 4150 if err != nil { 4151 return 4152 } 4153 } else { 4154 req = autorest.ChangeToGet(future.req) 4155 } 4156 resp, err = autorest.SendWithSender(client, req, 4157 autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4158 if err != nil { 4159 err = autorest.NewErrorWithError(err, "containerregistry.WebhooksDeleteFuture", "Result", resp, "Failure sending request") 4160 return 4161 } 4162 ar, err = client.DeleteResponder(resp) 4163 if err != nil { 4164 err = autorest.NewErrorWithError(err, "containerregistry.WebhooksDeleteFuture", "Result", resp, "Failure responding to request") 4165 } 4166 return 4167} 4168 4169// WebhooksUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 4170type WebhooksUpdateFuture struct { 4171 azure.Future 4172 req *http.Request 4173} 4174 4175// Result returns the result of the asynchronous operation. 4176// If the operation has not completed it will return an error. 4177func (future WebhooksUpdateFuture) Result(client WebhooksClient) (w Webhook, err error) { 4178 var done bool 4179 done, err = future.Done(client) 4180 if err != nil { 4181 err = autorest.NewErrorWithError(err, "containerregistry.WebhooksUpdateFuture", "Result", future.Response(), "Polling failure") 4182 return 4183 } 4184 if !done { 4185 return w, azure.NewAsyncOpIncompleteError("containerregistry.WebhooksUpdateFuture") 4186 } 4187 if future.PollingMethod() == azure.PollingLocation { 4188 w, err = client.UpdateResponder(future.Response()) 4189 if err != nil { 4190 err = autorest.NewErrorWithError(err, "containerregistry.WebhooksUpdateFuture", "Result", future.Response(), "Failure responding to request") 4191 } 4192 return 4193 } 4194 var req *http.Request 4195 var resp *http.Response 4196 if future.PollingURL() != "" { 4197 req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) 4198 if err != nil { 4199 return 4200 } 4201 } else { 4202 req = autorest.ChangeToGet(future.req) 4203 } 4204 resp, err = autorest.SendWithSender(client, req, 4205 autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4206 if err != nil { 4207 err = autorest.NewErrorWithError(err, "containerregistry.WebhooksUpdateFuture", "Result", resp, "Failure sending request") 4208 return 4209 } 4210 w, err = client.UpdateResponder(resp) 4211 if err != nil { 4212 err = autorest.NewErrorWithError(err, "containerregistry.WebhooksUpdateFuture", "Result", resp, "Failure responding to request") 4213 } 4214 return 4215} 4216 4217// WebhookUpdateParameters the parameters for updating a webhook. 4218type WebhookUpdateParameters struct { 4219 // Tags - The tags for the webhook. 4220 Tags map[string]*string `json:"tags"` 4221 // WebhookPropertiesUpdateParameters - The properties that the webhook will be updated with. 4222 *WebhookPropertiesUpdateParameters `json:"properties,omitempty"` 4223} 4224 4225// MarshalJSON is the custom marshaler for WebhookUpdateParameters. 4226func (wup WebhookUpdateParameters) MarshalJSON() ([]byte, error) { 4227 objectMap := make(map[string]interface{}) 4228 if wup.Tags != nil { 4229 objectMap["tags"] = wup.Tags 4230 } 4231 if wup.WebhookPropertiesUpdateParameters != nil { 4232 objectMap["properties"] = wup.WebhookPropertiesUpdateParameters 4233 } 4234 return json.Marshal(objectMap) 4235} 4236 4237// UnmarshalJSON is the custom unmarshaler for WebhookUpdateParameters struct. 4238func (wup *WebhookUpdateParameters) UnmarshalJSON(body []byte) error { 4239 var m map[string]*json.RawMessage 4240 err := json.Unmarshal(body, &m) 4241 if err != nil { 4242 return err 4243 } 4244 for k, v := range m { 4245 switch k { 4246 case "tags": 4247 if v != nil { 4248 var tags map[string]*string 4249 err = json.Unmarshal(*v, &tags) 4250 if err != nil { 4251 return err 4252 } 4253 wup.Tags = tags 4254 } 4255 case "properties": 4256 if v != nil { 4257 var webhookPropertiesUpdateParameters WebhookPropertiesUpdateParameters 4258 err = json.Unmarshal(*v, &webhookPropertiesUpdateParameters) 4259 if err != nil { 4260 return err 4261 } 4262 wup.WebhookPropertiesUpdateParameters = &webhookPropertiesUpdateParameters 4263 } 4264 } 4265 } 4266 4267 return nil 4268} 4269