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