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