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/2019-06-01-preview/containerregistry" 33 34// ActiveDirectoryObject the Active Directory Object that will be used for authenticating the token of a 35// container registry. 36type ActiveDirectoryObject struct { 37 // ObjectID - The user/group/application object ID for Active Directory Object that will be used for authenticating the token of a container registry. 38 ObjectID *string `json:"objectId,omitempty"` 39 // TenantID - The tenant ID of user/group/application object Active Directory Object that will be used for authenticating the token of a container registry. 40 TenantID *string `json:"tenantId,omitempty"` 41} 42 43// Actor the agent that initiated the event. For most situations, this could be from the authorization 44// context of the request. 45type Actor struct { 46 // Name - The subject or username associated with the request context that generated the event. 47 Name *string `json:"name,omitempty"` 48} 49 50// AgentPool the agentpool that has the ARM resource and properties. 51// The agentpool will have all information to create an agent pool. 52type AgentPool struct { 53 autorest.Response `json:"-"` 54 // AgentPoolProperties - The properties associated with the agent pool 55 *AgentPoolProperties `json:"properties,omitempty"` 56 // ID - READ-ONLY; The resource ID. 57 ID *string `json:"id,omitempty"` 58 // Name - READ-ONLY; The name of the resource. 59 Name *string `json:"name,omitempty"` 60 // Type - READ-ONLY; The type of the resource. 61 Type *string `json:"type,omitempty"` 62 // Location - The location of the resource. This cannot be changed after the resource is created. 63 Location *string `json:"location,omitempty"` 64 // Tags - The tags of the resource. 65 Tags map[string]*string `json:"tags"` 66 // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. 67 SystemData *SystemData `json:"systemData,omitempty"` 68} 69 70// MarshalJSON is the custom marshaler for AgentPool. 71func (ap AgentPool) MarshalJSON() ([]byte, error) { 72 objectMap := make(map[string]interface{}) 73 if ap.AgentPoolProperties != nil { 74 objectMap["properties"] = ap.AgentPoolProperties 75 } 76 if ap.Location != nil { 77 objectMap["location"] = ap.Location 78 } 79 if ap.Tags != nil { 80 objectMap["tags"] = ap.Tags 81 } 82 return json.Marshal(objectMap) 83} 84 85// UnmarshalJSON is the custom unmarshaler for AgentPool struct. 86func (ap *AgentPool) UnmarshalJSON(body []byte) error { 87 var m map[string]*json.RawMessage 88 err := json.Unmarshal(body, &m) 89 if err != nil { 90 return err 91 } 92 for k, v := range m { 93 switch k { 94 case "properties": 95 if v != nil { 96 var agentPoolProperties AgentPoolProperties 97 err = json.Unmarshal(*v, &agentPoolProperties) 98 if err != nil { 99 return err 100 } 101 ap.AgentPoolProperties = &agentPoolProperties 102 } 103 case "id": 104 if v != nil { 105 var ID string 106 err = json.Unmarshal(*v, &ID) 107 if err != nil { 108 return err 109 } 110 ap.ID = &ID 111 } 112 case "name": 113 if v != nil { 114 var name string 115 err = json.Unmarshal(*v, &name) 116 if err != nil { 117 return err 118 } 119 ap.Name = &name 120 } 121 case "type": 122 if v != nil { 123 var typeVar string 124 err = json.Unmarshal(*v, &typeVar) 125 if err != nil { 126 return err 127 } 128 ap.Type = &typeVar 129 } 130 case "location": 131 if v != nil { 132 var location string 133 err = json.Unmarshal(*v, &location) 134 if err != nil { 135 return err 136 } 137 ap.Location = &location 138 } 139 case "tags": 140 if v != nil { 141 var tags map[string]*string 142 err = json.Unmarshal(*v, &tags) 143 if err != nil { 144 return err 145 } 146 ap.Tags = tags 147 } 148 case "systemData": 149 if v != nil { 150 var systemData SystemData 151 err = json.Unmarshal(*v, &systemData) 152 if err != nil { 153 return err 154 } 155 ap.SystemData = &systemData 156 } 157 } 158 } 159 160 return nil 161} 162 163// AgentPoolListResult the collection of agent pools. 164type AgentPoolListResult struct { 165 autorest.Response `json:"-"` 166 // Value - The collection value. 167 Value *[]AgentPool `json:"value,omitempty"` 168 // NextLink - The URI that can be used to request the next set of paged results. 169 NextLink *string `json:"nextLink,omitempty"` 170} 171 172// AgentPoolListResultIterator provides access to a complete listing of AgentPool values. 173type AgentPoolListResultIterator struct { 174 i int 175 page AgentPoolListResultPage 176} 177 178// NextWithContext advances to the next value. If there was an error making 179// the request the iterator does not advance and the error is returned. 180func (iter *AgentPoolListResultIterator) NextWithContext(ctx context.Context) (err error) { 181 if tracing.IsEnabled() { 182 ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolListResultIterator.NextWithContext") 183 defer func() { 184 sc := -1 185 if iter.Response().Response.Response != nil { 186 sc = iter.Response().Response.Response.StatusCode 187 } 188 tracing.EndSpan(ctx, sc, err) 189 }() 190 } 191 iter.i++ 192 if iter.i < len(iter.page.Values()) { 193 return nil 194 } 195 err = iter.page.NextWithContext(ctx) 196 if err != nil { 197 iter.i-- 198 return err 199 } 200 iter.i = 0 201 return nil 202} 203 204// Next advances to the next value. If there was an error making 205// the request the iterator does not advance and the error is returned. 206// Deprecated: Use NextWithContext() instead. 207func (iter *AgentPoolListResultIterator) Next() error { 208 return iter.NextWithContext(context.Background()) 209} 210 211// NotDone returns true if the enumeration should be started or is not yet complete. 212func (iter AgentPoolListResultIterator) NotDone() bool { 213 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 214} 215 216// Response returns the raw server response from the last page request. 217func (iter AgentPoolListResultIterator) Response() AgentPoolListResult { 218 return iter.page.Response() 219} 220 221// Value returns the current value or a zero-initialized value if the 222// iterator has advanced beyond the end of the collection. 223func (iter AgentPoolListResultIterator) Value() AgentPool { 224 if !iter.page.NotDone() { 225 return AgentPool{} 226 } 227 return iter.page.Values()[iter.i] 228} 229 230// Creates a new instance of the AgentPoolListResultIterator type. 231func NewAgentPoolListResultIterator(page AgentPoolListResultPage) AgentPoolListResultIterator { 232 return AgentPoolListResultIterator{page: page} 233} 234 235// IsEmpty returns true if the ListResult contains no values. 236func (aplr AgentPoolListResult) IsEmpty() bool { 237 return aplr.Value == nil || len(*aplr.Value) == 0 238} 239 240// hasNextLink returns true if the NextLink is not empty. 241func (aplr AgentPoolListResult) hasNextLink() bool { 242 return aplr.NextLink != nil && len(*aplr.NextLink) != 0 243} 244 245// agentPoolListResultPreparer prepares a request to retrieve the next set of results. 246// It returns nil if no more results exist. 247func (aplr AgentPoolListResult) agentPoolListResultPreparer(ctx context.Context) (*http.Request, error) { 248 if !aplr.hasNextLink() { 249 return nil, nil 250 } 251 return autorest.Prepare((&http.Request{}).WithContext(ctx), 252 autorest.AsJSON(), 253 autorest.AsGet(), 254 autorest.WithBaseURL(to.String(aplr.NextLink))) 255} 256 257// AgentPoolListResultPage contains a page of AgentPool values. 258type AgentPoolListResultPage struct { 259 fn func(context.Context, AgentPoolListResult) (AgentPoolListResult, error) 260 aplr AgentPoolListResult 261} 262 263// NextWithContext advances to the next page of values. If there was an error making 264// the request the page does not advance and the error is returned. 265func (page *AgentPoolListResultPage) NextWithContext(ctx context.Context) (err error) { 266 if tracing.IsEnabled() { 267 ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolListResultPage.NextWithContext") 268 defer func() { 269 sc := -1 270 if page.Response().Response.Response != nil { 271 sc = page.Response().Response.Response.StatusCode 272 } 273 tracing.EndSpan(ctx, sc, err) 274 }() 275 } 276 for { 277 next, err := page.fn(ctx, page.aplr) 278 if err != nil { 279 return err 280 } 281 page.aplr = next 282 if !next.hasNextLink() || !next.IsEmpty() { 283 break 284 } 285 } 286 return nil 287} 288 289// Next advances to the next page of values. If there was an error making 290// the request the page does not advance and the error is returned. 291// Deprecated: Use NextWithContext() instead. 292func (page *AgentPoolListResultPage) Next() error { 293 return page.NextWithContext(context.Background()) 294} 295 296// NotDone returns true if the page enumeration should be started or is not yet complete. 297func (page AgentPoolListResultPage) NotDone() bool { 298 return !page.aplr.IsEmpty() 299} 300 301// Response returns the raw server response from the last page request. 302func (page AgentPoolListResultPage) Response() AgentPoolListResult { 303 return page.aplr 304} 305 306// Values returns the slice of values for the current page or nil if there are no values. 307func (page AgentPoolListResultPage) Values() []AgentPool { 308 if page.aplr.IsEmpty() { 309 return nil 310 } 311 return *page.aplr.Value 312} 313 314// Creates a new instance of the AgentPoolListResultPage type. 315func NewAgentPoolListResultPage(cur AgentPoolListResult, getNextPage func(context.Context, AgentPoolListResult) (AgentPoolListResult, error)) AgentPoolListResultPage { 316 return AgentPoolListResultPage{ 317 fn: getNextPage, 318 aplr: cur, 319 } 320} 321 322// AgentPoolProperties the properties of agent pool. 323type AgentPoolProperties struct { 324 // Count - The count of agent machine 325 Count *int32 `json:"count,omitempty"` 326 // Tier - The Tier of agent machine 327 Tier *string `json:"tier,omitempty"` 328 // Os - The OS of agent machine. Possible values include: 'Windows', 'Linux' 329 Os OS `json:"os,omitempty"` 330 // VirtualNetworkSubnetResourceID - The Virtual Network Subnet Resource Id of the agent machine 331 VirtualNetworkSubnetResourceID *string `json:"virtualNetworkSubnetResourceId,omitempty"` 332 // ProvisioningState - READ-ONLY; The provisioning state of this agent pool. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' 333 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 334} 335 336// MarshalJSON is the custom marshaler for AgentPoolProperties. 337func (app AgentPoolProperties) MarshalJSON() ([]byte, error) { 338 objectMap := make(map[string]interface{}) 339 if app.Count != nil { 340 objectMap["count"] = app.Count 341 } 342 if app.Tier != nil { 343 objectMap["tier"] = app.Tier 344 } 345 if app.Os != "" { 346 objectMap["os"] = app.Os 347 } 348 if app.VirtualNetworkSubnetResourceID != nil { 349 objectMap["virtualNetworkSubnetResourceId"] = app.VirtualNetworkSubnetResourceID 350 } 351 return json.Marshal(objectMap) 352} 353 354// AgentPoolPropertiesUpdateParameters ... 355type AgentPoolPropertiesUpdateParameters struct { 356 // Count - The count of agent machine 357 Count *int32 `json:"count,omitempty"` 358} 359 360// AgentPoolQueueStatus the QueueStatus of Agent Pool 361type AgentPoolQueueStatus struct { 362 autorest.Response `json:"-"` 363 // Count - The number of pending runs in the queue 364 Count *int32 `json:"count,omitempty"` 365} 366 367// AgentPoolsCreateFuture an abstraction for monitoring and retrieving the results of a long-running 368// operation. 369type AgentPoolsCreateFuture struct { 370 azure.FutureAPI 371 // Result returns the result of the asynchronous operation. 372 // If the operation has not completed it will return an error. 373 Result func(AgentPoolsClient) (AgentPool, error) 374} 375 376// AgentPoolsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 377// operation. 378type AgentPoolsDeleteFuture struct { 379 azure.FutureAPI 380 // Result returns the result of the asynchronous operation. 381 // If the operation has not completed it will return an error. 382 Result func(AgentPoolsClient) (autorest.Response, error) 383} 384 385// AgentPoolsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 386// operation. 387type AgentPoolsUpdateFuture struct { 388 azure.FutureAPI 389 // Result returns the result of the asynchronous operation. 390 // If the operation has not completed it will return an error. 391 Result func(AgentPoolsClient) (AgentPool, error) 392} 393 394// AgentPoolUpdateParameters the parameters for updating an agent pool. 395type AgentPoolUpdateParameters struct { 396 // AgentPoolPropertiesUpdateParameters - The properties associated with the agent pool 397 *AgentPoolPropertiesUpdateParameters `json:"properties,omitempty"` 398 // Tags - The ARM resource tags. 399 Tags map[string]*string `json:"tags"` 400} 401 402// MarshalJSON is the custom marshaler for AgentPoolUpdateParameters. 403func (apup AgentPoolUpdateParameters) MarshalJSON() ([]byte, error) { 404 objectMap := make(map[string]interface{}) 405 if apup.AgentPoolPropertiesUpdateParameters != nil { 406 objectMap["properties"] = apup.AgentPoolPropertiesUpdateParameters 407 } 408 if apup.Tags != nil { 409 objectMap["tags"] = apup.Tags 410 } 411 return json.Marshal(objectMap) 412} 413 414// UnmarshalJSON is the custom unmarshaler for AgentPoolUpdateParameters struct. 415func (apup *AgentPoolUpdateParameters) UnmarshalJSON(body []byte) error { 416 var m map[string]*json.RawMessage 417 err := json.Unmarshal(body, &m) 418 if err != nil { 419 return err 420 } 421 for k, v := range m { 422 switch k { 423 case "properties": 424 if v != nil { 425 var agentPoolPropertiesUpdateParameters AgentPoolPropertiesUpdateParameters 426 err = json.Unmarshal(*v, &agentPoolPropertiesUpdateParameters) 427 if err != nil { 428 return err 429 } 430 apup.AgentPoolPropertiesUpdateParameters = &agentPoolPropertiesUpdateParameters 431 } 432 case "tags": 433 if v != nil { 434 var tags map[string]*string 435 err = json.Unmarshal(*v, &tags) 436 if err != nil { 437 return err 438 } 439 apup.Tags = tags 440 } 441 } 442 } 443 444 return nil 445} 446 447// AgentProperties the properties that determine the run agent configuration. 448type AgentProperties struct { 449 // CPU - The CPU configuration in terms of number of cores required for the run. 450 CPU *int32 `json:"cpu,omitempty"` 451} 452 453// Argument the properties of a run argument. 454type Argument struct { 455 // Name - The name of the argument. 456 Name *string `json:"name,omitempty"` 457 // Value - The value of the argument. 458 Value *string `json:"value,omitempty"` 459 // IsSecret - Flag to indicate whether the argument represents a secret and want to be removed from build logs. 460 IsSecret *bool `json:"isSecret,omitempty"` 461} 462 463// AuthInfo the authorization properties for accessing the source code repository. 464type AuthInfo struct { 465 // TokenType - The type of Auth token. Possible values include: 'PAT', 'OAuth' 466 TokenType TokenType `json:"tokenType,omitempty"` 467 // Token - The access token used to access the source control provider. 468 Token *string `json:"token,omitempty"` 469 // RefreshToken - The refresh token used to refresh the access token. 470 RefreshToken *string `json:"refreshToken,omitempty"` 471 // Scope - The scope of the access token. 472 Scope *string `json:"scope,omitempty"` 473 // ExpiresIn - Time in seconds that the token remains valid 474 ExpiresIn *int32 `json:"expiresIn,omitempty"` 475} 476 477// AuthInfoUpdateParameters the authorization properties for accessing the source code repository. 478type AuthInfoUpdateParameters struct { 479 // TokenType - The type of Auth token. Possible values include: 'PAT', 'OAuth' 480 TokenType TokenType `json:"tokenType,omitempty"` 481 // Token - The access token used to access the source control provider. 482 Token *string `json:"token,omitempty"` 483 // RefreshToken - The refresh token used to refresh the access token. 484 RefreshToken *string `json:"refreshToken,omitempty"` 485 // Scope - The scope of the access token. 486 Scope *string `json:"scope,omitempty"` 487 // ExpiresIn - Time in seconds that the token remains valid 488 ExpiresIn *int32 `json:"expiresIn,omitempty"` 489} 490 491// BaseImageDependency properties that describe a base image dependency. 492type BaseImageDependency struct { 493 // Type - The type of the base image dependency. Possible values include: 'BuildTime', 'RunTime' 494 Type BaseImageDependencyType `json:"type,omitempty"` 495 // Registry - The registry login server. 496 Registry *string `json:"registry,omitempty"` 497 // Repository - The repository name. 498 Repository *string `json:"repository,omitempty"` 499 // Tag - The tag name. 500 Tag *string `json:"tag,omitempty"` 501 // Digest - The sha256-based digest of the image manifest. 502 Digest *string `json:"digest,omitempty"` 503} 504 505// BaseImageTrigger the trigger based on base image dependency. 506type BaseImageTrigger struct { 507 // BaseImageTriggerType - The type of the auto trigger for base image dependency updates. Possible values include: 'All', 'Runtime' 508 BaseImageTriggerType BaseImageTriggerType `json:"baseImageTriggerType,omitempty"` 509 // UpdateTriggerEndpoint - The endpoint URL for receiving update triggers. 510 UpdateTriggerEndpoint *string `json:"updateTriggerEndpoint,omitempty"` 511 // UpdateTriggerPayloadType - Type of Payload body for Base image update triggers. Possible values include: 'UpdateTriggerPayloadTypeDefault', 'UpdateTriggerPayloadTypeToken' 512 UpdateTriggerPayloadType UpdateTriggerPayloadType `json:"updateTriggerPayloadType,omitempty"` 513 // Status - The current status of trigger. Possible values include: 'TriggerStatusDisabled', 'TriggerStatusEnabled' 514 Status TriggerStatus `json:"status,omitempty"` 515 // Name - The name of the trigger. 516 Name *string `json:"name,omitempty"` 517} 518 519// BaseImageTriggerUpdateParameters the properties for updating base image dependency trigger. 520type BaseImageTriggerUpdateParameters struct { 521 // BaseImageTriggerType - The type of the auto trigger for base image dependency updates. Possible values include: 'All', 'Runtime' 522 BaseImageTriggerType BaseImageTriggerType `json:"baseImageTriggerType,omitempty"` 523 // UpdateTriggerEndpoint - The endpoint URL for receiving update triggers. 524 UpdateTriggerEndpoint *string `json:"updateTriggerEndpoint,omitempty"` 525 // UpdateTriggerPayloadType - Type of Payload body for Base image update triggers. Possible values include: 'UpdateTriggerPayloadTypeDefault', 'UpdateTriggerPayloadTypeToken' 526 UpdateTriggerPayloadType UpdateTriggerPayloadType `json:"updateTriggerPayloadType,omitempty"` 527 // Status - The current status of trigger. Possible values include: 'TriggerStatusDisabled', 'TriggerStatusEnabled' 528 Status TriggerStatus `json:"status,omitempty"` 529 // Name - The name of the trigger. 530 Name *string `json:"name,omitempty"` 531} 532 533// CallbackConfig the configuration of service URI and custom headers for the webhook. 534type CallbackConfig struct { 535 autorest.Response `json:"-"` 536 // ServiceURI - The service URI for the webhook to post notifications. 537 ServiceURI *string `json:"serviceUri,omitempty"` 538 // CustomHeaders - Custom headers that will be added to the webhook notifications. 539 CustomHeaders map[string]*string `json:"customHeaders"` 540} 541 542// MarshalJSON is the custom marshaler for CallbackConfig. 543func (cc CallbackConfig) MarshalJSON() ([]byte, error) { 544 objectMap := make(map[string]interface{}) 545 if cc.ServiceURI != nil { 546 objectMap["serviceUri"] = cc.ServiceURI 547 } 548 if cc.CustomHeaders != nil { 549 objectMap["customHeaders"] = cc.CustomHeaders 550 } 551 return json.Marshal(objectMap) 552} 553 554// Credentials the parameters that describes a set of credentials that will be used when a run is invoked. 555type Credentials struct { 556 // SourceRegistry - Describes the credential parameters for accessing the source registry. 557 SourceRegistry *SourceRegistryCredentials `json:"sourceRegistry,omitempty"` 558 // CustomRegistries - Describes the credential parameters for accessing other custom registries. The key 559 // for the dictionary item will be the registry login server (myregistry.azurecr.io) and 560 // the value of the item will be the registry credentials for accessing the registry. 561 CustomRegistries map[string]*CustomRegistryCredentials `json:"customRegistries"` 562} 563 564// MarshalJSON is the custom marshaler for Credentials. 565func (c Credentials) MarshalJSON() ([]byte, error) { 566 objectMap := make(map[string]interface{}) 567 if c.SourceRegistry != nil { 568 objectMap["sourceRegistry"] = c.SourceRegistry 569 } 570 if c.CustomRegistries != nil { 571 objectMap["customRegistries"] = c.CustomRegistries 572 } 573 return json.Marshal(objectMap) 574} 575 576// CustomRegistryCredentials describes the credentials that will be used to access a custom registry during 577// a run. 578type CustomRegistryCredentials struct { 579 // UserName - The username for logging into the custom registry. 580 UserName *SecretObject `json:"userName,omitempty"` 581 // Password - The password for logging into the custom registry. The password is a secret 582 // object that allows multiple ways of providing the value for it. 583 Password *SecretObject `json:"password,omitempty"` 584 // Identity - Indicates the managed identity assigned to the custom credential. If a user-assigned identity 585 // this value is the Client ID. If a system-assigned identity, the value will be `system`. In 586 // the case of a system-assigned identity, the Client ID will be determined by the runner. This 587 // identity may be used to authenticate to key vault to retrieve credentials or it may be the only 588 // source of authentication used for accessing the registry. 589 Identity *string `json:"identity,omitempty"` 590} 591 592// DockerBuildRequest the parameters for a docker quick build. 593type DockerBuildRequest struct { 594 // ImageNames - The fully qualified image names including the repository and tag. 595 ImageNames *[]string `json:"imageNames,omitempty"` 596 // IsPushEnabled - The value of this property indicates whether the image built should be pushed to the registry or not. 597 IsPushEnabled *bool `json:"isPushEnabled,omitempty"` 598 // NoCache - The value of this property indicates whether the image cache is enabled or not. 599 NoCache *bool `json:"noCache,omitempty"` 600 // DockerFilePath - The Docker file path relative to the source location. 601 DockerFilePath *string `json:"dockerFilePath,omitempty"` 602 // Target - The name of the target build stage for the docker build. 603 Target *string `json:"target,omitempty"` 604 // Arguments - The collection of override arguments to be used when executing the run. 605 Arguments *[]Argument `json:"arguments,omitempty"` 606 // Timeout - Run timeout in seconds. 607 Timeout *int32 `json:"timeout,omitempty"` 608 // Platform - The platform properties against which the run has to happen. 609 Platform *PlatformProperties `json:"platform,omitempty"` 610 // AgentConfiguration - The machine configuration of the run agent. 611 AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` 612 // SourceLocation - The URL(absolute or relative) of the source context. It can be an URL to a tar or git repository. 613 // If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. 614 SourceLocation *string `json:"sourceLocation,omitempty"` 615 // Credentials - The properties that describes a set of credentials that will be used when this run is invoked. 616 Credentials *Credentials `json:"credentials,omitempty"` 617 // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. 618 IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` 619 // AgentPoolName - The dedicated agent pool for the run. 620 AgentPoolName *string `json:"agentPoolName,omitempty"` 621 // LogTemplate - The template that describes the repository and tag information for run log artifact. 622 LogTemplate *string `json:"logTemplate,omitempty"` 623 // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' 624 Type Type `json:"type,omitempty"` 625} 626 627// MarshalJSON is the custom marshaler for DockerBuildRequest. 628func (dbr DockerBuildRequest) MarshalJSON() ([]byte, error) { 629 dbr.Type = TypeDockerBuildRequest 630 objectMap := make(map[string]interface{}) 631 if dbr.ImageNames != nil { 632 objectMap["imageNames"] = dbr.ImageNames 633 } 634 if dbr.IsPushEnabled != nil { 635 objectMap["isPushEnabled"] = dbr.IsPushEnabled 636 } 637 if dbr.NoCache != nil { 638 objectMap["noCache"] = dbr.NoCache 639 } 640 if dbr.DockerFilePath != nil { 641 objectMap["dockerFilePath"] = dbr.DockerFilePath 642 } 643 if dbr.Target != nil { 644 objectMap["target"] = dbr.Target 645 } 646 if dbr.Arguments != nil { 647 objectMap["arguments"] = dbr.Arguments 648 } 649 if dbr.Timeout != nil { 650 objectMap["timeout"] = dbr.Timeout 651 } 652 if dbr.Platform != nil { 653 objectMap["platform"] = dbr.Platform 654 } 655 if dbr.AgentConfiguration != nil { 656 objectMap["agentConfiguration"] = dbr.AgentConfiguration 657 } 658 if dbr.SourceLocation != nil { 659 objectMap["sourceLocation"] = dbr.SourceLocation 660 } 661 if dbr.Credentials != nil { 662 objectMap["credentials"] = dbr.Credentials 663 } 664 if dbr.IsArchiveEnabled != nil { 665 objectMap["isArchiveEnabled"] = dbr.IsArchiveEnabled 666 } 667 if dbr.AgentPoolName != nil { 668 objectMap["agentPoolName"] = dbr.AgentPoolName 669 } 670 if dbr.LogTemplate != nil { 671 objectMap["logTemplate"] = dbr.LogTemplate 672 } 673 if dbr.Type != "" { 674 objectMap["type"] = dbr.Type 675 } 676 return json.Marshal(objectMap) 677} 678 679// AsDockerBuildRequest is the BasicRunRequest implementation for DockerBuildRequest. 680func (dbr DockerBuildRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { 681 return &dbr, true 682} 683 684// AsFileTaskRunRequest is the BasicRunRequest implementation for DockerBuildRequest. 685func (dbr DockerBuildRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { 686 return nil, false 687} 688 689// AsTaskRunRequest is the BasicRunRequest implementation for DockerBuildRequest. 690func (dbr DockerBuildRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { 691 return nil, false 692} 693 694// AsEncodedTaskRunRequest is the BasicRunRequest implementation for DockerBuildRequest. 695func (dbr DockerBuildRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { 696 return nil, false 697} 698 699// AsRunRequest is the BasicRunRequest implementation for DockerBuildRequest. 700func (dbr DockerBuildRequest) AsRunRequest() (*RunRequest, bool) { 701 return nil, false 702} 703 704// AsBasicRunRequest is the BasicRunRequest implementation for DockerBuildRequest. 705func (dbr DockerBuildRequest) AsBasicRunRequest() (BasicRunRequest, bool) { 706 return &dbr, true 707} 708 709// DockerBuildStep the Docker build step. 710type DockerBuildStep struct { 711 // ImageNames - The fully qualified image names including the repository and tag. 712 ImageNames *[]string `json:"imageNames,omitempty"` 713 // IsPushEnabled - The value of this property indicates whether the image built should be pushed to the registry or not. 714 IsPushEnabled *bool `json:"isPushEnabled,omitempty"` 715 // NoCache - The value of this property indicates whether the image cache is enabled or not. 716 NoCache *bool `json:"noCache,omitempty"` 717 // DockerFilePath - The Docker file path relative to the source context. 718 DockerFilePath *string `json:"dockerFilePath,omitempty"` 719 // Target - The name of the target build stage for the docker build. 720 Target *string `json:"target,omitempty"` 721 // Arguments - The collection of override arguments to be used when executing this build step. 722 Arguments *[]Argument `json:"arguments,omitempty"` 723 // BaseImageDependencies - READ-ONLY; List of base image dependencies for a step. 724 BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` 725 // ContextPath - The URL(absolute or relative) of the source context for the task step. 726 ContextPath *string `json:"contextPath,omitempty"` 727 // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. 728 ContextAccessToken *string `json:"contextAccessToken,omitempty"` 729 // Type - Possible values include: 'TypeTaskStepProperties', 'TypeDocker', 'TypeFileTask', 'TypeEncodedTask' 730 Type TypeBasicTaskStepProperties `json:"type,omitempty"` 731} 732 733// MarshalJSON is the custom marshaler for DockerBuildStep. 734func (dbs DockerBuildStep) MarshalJSON() ([]byte, error) { 735 dbs.Type = TypeDocker 736 objectMap := make(map[string]interface{}) 737 if dbs.ImageNames != nil { 738 objectMap["imageNames"] = dbs.ImageNames 739 } 740 if dbs.IsPushEnabled != nil { 741 objectMap["isPushEnabled"] = dbs.IsPushEnabled 742 } 743 if dbs.NoCache != nil { 744 objectMap["noCache"] = dbs.NoCache 745 } 746 if dbs.DockerFilePath != nil { 747 objectMap["dockerFilePath"] = dbs.DockerFilePath 748 } 749 if dbs.Target != nil { 750 objectMap["target"] = dbs.Target 751 } 752 if dbs.Arguments != nil { 753 objectMap["arguments"] = dbs.Arguments 754 } 755 if dbs.ContextPath != nil { 756 objectMap["contextPath"] = dbs.ContextPath 757 } 758 if dbs.ContextAccessToken != nil { 759 objectMap["contextAccessToken"] = dbs.ContextAccessToken 760 } 761 if dbs.Type != "" { 762 objectMap["type"] = dbs.Type 763 } 764 return json.Marshal(objectMap) 765} 766 767// AsDockerBuildStep is the BasicTaskStepProperties implementation for DockerBuildStep. 768func (dbs DockerBuildStep) AsDockerBuildStep() (*DockerBuildStep, bool) { 769 return &dbs, true 770} 771 772// AsFileTaskStep is the BasicTaskStepProperties implementation for DockerBuildStep. 773func (dbs DockerBuildStep) AsFileTaskStep() (*FileTaskStep, bool) { 774 return nil, false 775} 776 777// AsEncodedTaskStep is the BasicTaskStepProperties implementation for DockerBuildStep. 778func (dbs DockerBuildStep) AsEncodedTaskStep() (*EncodedTaskStep, bool) { 779 return nil, false 780} 781 782// AsTaskStepProperties is the BasicTaskStepProperties implementation for DockerBuildStep. 783func (dbs DockerBuildStep) AsTaskStepProperties() (*TaskStepProperties, bool) { 784 return nil, false 785} 786 787// AsBasicTaskStepProperties is the BasicTaskStepProperties implementation for DockerBuildStep. 788func (dbs DockerBuildStep) AsBasicTaskStepProperties() (BasicTaskStepProperties, bool) { 789 return &dbs, true 790} 791 792// DockerBuildStepUpdateParameters the properties for updating a docker build step. 793type DockerBuildStepUpdateParameters struct { 794 // ImageNames - The fully qualified image names including the repository and tag. 795 ImageNames *[]string `json:"imageNames,omitempty"` 796 // IsPushEnabled - The value of this property indicates whether the image built should be pushed to the registry or not. 797 IsPushEnabled *bool `json:"isPushEnabled,omitempty"` 798 // NoCache - The value of this property indicates whether the image cache is enabled or not. 799 NoCache *bool `json:"noCache,omitempty"` 800 // DockerFilePath - The Docker file path relative to the source context. 801 DockerFilePath *string `json:"dockerFilePath,omitempty"` 802 // Arguments - The collection of override arguments to be used when executing this build step. 803 Arguments *[]Argument `json:"arguments,omitempty"` 804 // Target - The name of the target build stage for the docker build. 805 Target *string `json:"target,omitempty"` 806 // ContextPath - The URL(absolute or relative) of the source context for the task step. 807 ContextPath *string `json:"contextPath,omitempty"` 808 // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. 809 ContextAccessToken *string `json:"contextAccessToken,omitempty"` 810 // Type - Possible values include: 'TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters', 'TypeBasicTaskStepUpdateParametersTypeDocker', 'TypeBasicTaskStepUpdateParametersTypeFileTask', 'TypeBasicTaskStepUpdateParametersTypeEncodedTask' 811 Type TypeBasicTaskStepUpdateParameters `json:"type,omitempty"` 812} 813 814// MarshalJSON is the custom marshaler for DockerBuildStepUpdateParameters. 815func (dbsup DockerBuildStepUpdateParameters) MarshalJSON() ([]byte, error) { 816 dbsup.Type = TypeBasicTaskStepUpdateParametersTypeDocker 817 objectMap := make(map[string]interface{}) 818 if dbsup.ImageNames != nil { 819 objectMap["imageNames"] = dbsup.ImageNames 820 } 821 if dbsup.IsPushEnabled != nil { 822 objectMap["isPushEnabled"] = dbsup.IsPushEnabled 823 } 824 if dbsup.NoCache != nil { 825 objectMap["noCache"] = dbsup.NoCache 826 } 827 if dbsup.DockerFilePath != nil { 828 objectMap["dockerFilePath"] = dbsup.DockerFilePath 829 } 830 if dbsup.Arguments != nil { 831 objectMap["arguments"] = dbsup.Arguments 832 } 833 if dbsup.Target != nil { 834 objectMap["target"] = dbsup.Target 835 } 836 if dbsup.ContextPath != nil { 837 objectMap["contextPath"] = dbsup.ContextPath 838 } 839 if dbsup.ContextAccessToken != nil { 840 objectMap["contextAccessToken"] = dbsup.ContextAccessToken 841 } 842 if dbsup.Type != "" { 843 objectMap["type"] = dbsup.Type 844 } 845 return json.Marshal(objectMap) 846} 847 848// AsDockerBuildStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. 849func (dbsup DockerBuildStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { 850 return &dbsup, true 851} 852 853// AsFileTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. 854func (dbsup DockerBuildStepUpdateParameters) AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) { 855 return nil, false 856} 857 858// AsEncodedTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. 859func (dbsup DockerBuildStepUpdateParameters) AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) { 860 return nil, false 861} 862 863// AsTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. 864func (dbsup DockerBuildStepUpdateParameters) AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) { 865 return nil, false 866} 867 868// AsBasicTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. 869func (dbsup DockerBuildStepUpdateParameters) AsBasicTaskStepUpdateParameters() (BasicTaskStepUpdateParameters, bool) { 870 return &dbsup, true 871} 872 873// EncodedTaskRunRequest the parameters for a quick task run request. 874type EncodedTaskRunRequest struct { 875 // EncodedTaskContent - Base64 encoded value of the template/definition file content. 876 EncodedTaskContent *string `json:"encodedTaskContent,omitempty"` 877 // EncodedValuesContent - Base64 encoded value of the parameters/values file content. 878 EncodedValuesContent *string `json:"encodedValuesContent,omitempty"` 879 // Values - The collection of overridable values that can be passed when running a task. 880 Values *[]SetValue `json:"values,omitempty"` 881 // Timeout - Run timeout in seconds. 882 Timeout *int32 `json:"timeout,omitempty"` 883 // Platform - The platform properties against which the run has to happen. 884 Platform *PlatformProperties `json:"platform,omitempty"` 885 // AgentConfiguration - The machine configuration of the run agent. 886 AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` 887 // SourceLocation - The URL(absolute or relative) of the source context. It can be an URL to a tar or git repository. 888 // If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. 889 SourceLocation *string `json:"sourceLocation,omitempty"` 890 // Credentials - The properties that describes a set of credentials that will be used when this run is invoked. 891 Credentials *Credentials `json:"credentials,omitempty"` 892 // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. 893 IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` 894 // AgentPoolName - The dedicated agent pool for the run. 895 AgentPoolName *string `json:"agentPoolName,omitempty"` 896 // LogTemplate - The template that describes the repository and tag information for run log artifact. 897 LogTemplate *string `json:"logTemplate,omitempty"` 898 // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' 899 Type Type `json:"type,omitempty"` 900} 901 902// MarshalJSON is the custom marshaler for EncodedTaskRunRequest. 903func (etrr EncodedTaskRunRequest) MarshalJSON() ([]byte, error) { 904 etrr.Type = TypeEncodedTaskRunRequest 905 objectMap := make(map[string]interface{}) 906 if etrr.EncodedTaskContent != nil { 907 objectMap["encodedTaskContent"] = etrr.EncodedTaskContent 908 } 909 if etrr.EncodedValuesContent != nil { 910 objectMap["encodedValuesContent"] = etrr.EncodedValuesContent 911 } 912 if etrr.Values != nil { 913 objectMap["values"] = etrr.Values 914 } 915 if etrr.Timeout != nil { 916 objectMap["timeout"] = etrr.Timeout 917 } 918 if etrr.Platform != nil { 919 objectMap["platform"] = etrr.Platform 920 } 921 if etrr.AgentConfiguration != nil { 922 objectMap["agentConfiguration"] = etrr.AgentConfiguration 923 } 924 if etrr.SourceLocation != nil { 925 objectMap["sourceLocation"] = etrr.SourceLocation 926 } 927 if etrr.Credentials != nil { 928 objectMap["credentials"] = etrr.Credentials 929 } 930 if etrr.IsArchiveEnabled != nil { 931 objectMap["isArchiveEnabled"] = etrr.IsArchiveEnabled 932 } 933 if etrr.AgentPoolName != nil { 934 objectMap["agentPoolName"] = etrr.AgentPoolName 935 } 936 if etrr.LogTemplate != nil { 937 objectMap["logTemplate"] = etrr.LogTemplate 938 } 939 if etrr.Type != "" { 940 objectMap["type"] = etrr.Type 941 } 942 return json.Marshal(objectMap) 943} 944 945// AsDockerBuildRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. 946func (etrr EncodedTaskRunRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { 947 return nil, false 948} 949 950// AsFileTaskRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. 951func (etrr EncodedTaskRunRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { 952 return nil, false 953} 954 955// AsTaskRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. 956func (etrr EncodedTaskRunRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { 957 return nil, false 958} 959 960// AsEncodedTaskRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. 961func (etrr EncodedTaskRunRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { 962 return &etrr, true 963} 964 965// AsRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. 966func (etrr EncodedTaskRunRequest) AsRunRequest() (*RunRequest, bool) { 967 return nil, false 968} 969 970// AsBasicRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. 971func (etrr EncodedTaskRunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { 972 return &etrr, true 973} 974 975// EncodedTaskStep the properties of a encoded task step. 976type EncodedTaskStep struct { 977 // EncodedTaskContent - Base64 encoded value of the template/definition file content. 978 EncodedTaskContent *string `json:"encodedTaskContent,omitempty"` 979 // EncodedValuesContent - Base64 encoded value of the parameters/values file content. 980 EncodedValuesContent *string `json:"encodedValuesContent,omitempty"` 981 // Values - The collection of overridable values that can be passed when running a task. 982 Values *[]SetValue `json:"values,omitempty"` 983 // BaseImageDependencies - READ-ONLY; List of base image dependencies for a step. 984 BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` 985 // ContextPath - The URL(absolute or relative) of the source context for the task step. 986 ContextPath *string `json:"contextPath,omitempty"` 987 // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. 988 ContextAccessToken *string `json:"contextAccessToken,omitempty"` 989 // Type - Possible values include: 'TypeTaskStepProperties', 'TypeDocker', 'TypeFileTask', 'TypeEncodedTask' 990 Type TypeBasicTaskStepProperties `json:"type,omitempty"` 991} 992 993// MarshalJSON is the custom marshaler for EncodedTaskStep. 994func (ets EncodedTaskStep) MarshalJSON() ([]byte, error) { 995 ets.Type = TypeEncodedTask 996 objectMap := make(map[string]interface{}) 997 if ets.EncodedTaskContent != nil { 998 objectMap["encodedTaskContent"] = ets.EncodedTaskContent 999 } 1000 if ets.EncodedValuesContent != nil { 1001 objectMap["encodedValuesContent"] = ets.EncodedValuesContent 1002 } 1003 if ets.Values != nil { 1004 objectMap["values"] = ets.Values 1005 } 1006 if ets.ContextPath != nil { 1007 objectMap["contextPath"] = ets.ContextPath 1008 } 1009 if ets.ContextAccessToken != nil { 1010 objectMap["contextAccessToken"] = ets.ContextAccessToken 1011 } 1012 if ets.Type != "" { 1013 objectMap["type"] = ets.Type 1014 } 1015 return json.Marshal(objectMap) 1016} 1017 1018// AsDockerBuildStep is the BasicTaskStepProperties implementation for EncodedTaskStep. 1019func (ets EncodedTaskStep) AsDockerBuildStep() (*DockerBuildStep, bool) { 1020 return nil, false 1021} 1022 1023// AsFileTaskStep is the BasicTaskStepProperties implementation for EncodedTaskStep. 1024func (ets EncodedTaskStep) AsFileTaskStep() (*FileTaskStep, bool) { 1025 return nil, false 1026} 1027 1028// AsEncodedTaskStep is the BasicTaskStepProperties implementation for EncodedTaskStep. 1029func (ets EncodedTaskStep) AsEncodedTaskStep() (*EncodedTaskStep, bool) { 1030 return &ets, true 1031} 1032 1033// AsTaskStepProperties is the BasicTaskStepProperties implementation for EncodedTaskStep. 1034func (ets EncodedTaskStep) AsTaskStepProperties() (*TaskStepProperties, bool) { 1035 return nil, false 1036} 1037 1038// AsBasicTaskStepProperties is the BasicTaskStepProperties implementation for EncodedTaskStep. 1039func (ets EncodedTaskStep) AsBasicTaskStepProperties() (BasicTaskStepProperties, bool) { 1040 return &ets, true 1041} 1042 1043// EncodedTaskStepUpdateParameters the properties for updating encoded task step. 1044type EncodedTaskStepUpdateParameters struct { 1045 // EncodedTaskContent - Base64 encoded value of the template/definition file content. 1046 EncodedTaskContent *string `json:"encodedTaskContent,omitempty"` 1047 // EncodedValuesContent - Base64 encoded value of the parameters/values file content. 1048 EncodedValuesContent *string `json:"encodedValuesContent,omitempty"` 1049 // Values - The collection of overridable values that can be passed when running a task. 1050 Values *[]SetValue `json:"values,omitempty"` 1051 // ContextPath - The URL(absolute or relative) of the source context for the task step. 1052 ContextPath *string `json:"contextPath,omitempty"` 1053 // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. 1054 ContextAccessToken *string `json:"contextAccessToken,omitempty"` 1055 // Type - Possible values include: 'TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters', 'TypeBasicTaskStepUpdateParametersTypeDocker', 'TypeBasicTaskStepUpdateParametersTypeFileTask', 'TypeBasicTaskStepUpdateParametersTypeEncodedTask' 1056 Type TypeBasicTaskStepUpdateParameters `json:"type,omitempty"` 1057} 1058 1059// MarshalJSON is the custom marshaler for EncodedTaskStepUpdateParameters. 1060func (etsup EncodedTaskStepUpdateParameters) MarshalJSON() ([]byte, error) { 1061 etsup.Type = TypeBasicTaskStepUpdateParametersTypeEncodedTask 1062 objectMap := make(map[string]interface{}) 1063 if etsup.EncodedTaskContent != nil { 1064 objectMap["encodedTaskContent"] = etsup.EncodedTaskContent 1065 } 1066 if etsup.EncodedValuesContent != nil { 1067 objectMap["encodedValuesContent"] = etsup.EncodedValuesContent 1068 } 1069 if etsup.Values != nil { 1070 objectMap["values"] = etsup.Values 1071 } 1072 if etsup.ContextPath != nil { 1073 objectMap["contextPath"] = etsup.ContextPath 1074 } 1075 if etsup.ContextAccessToken != nil { 1076 objectMap["contextAccessToken"] = etsup.ContextAccessToken 1077 } 1078 if etsup.Type != "" { 1079 objectMap["type"] = etsup.Type 1080 } 1081 return json.Marshal(objectMap) 1082} 1083 1084// AsDockerBuildStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. 1085func (etsup EncodedTaskStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { 1086 return nil, false 1087} 1088 1089// AsFileTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. 1090func (etsup EncodedTaskStepUpdateParameters) AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) { 1091 return nil, false 1092} 1093 1094// AsEncodedTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. 1095func (etsup EncodedTaskStepUpdateParameters) AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) { 1096 return &etsup, true 1097} 1098 1099// AsTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. 1100func (etsup EncodedTaskStepUpdateParameters) AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) { 1101 return nil, false 1102} 1103 1104// AsBasicTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. 1105func (etsup EncodedTaskStepUpdateParameters) AsBasicTaskStepUpdateParameters() (BasicTaskStepUpdateParameters, bool) { 1106 return &etsup, true 1107} 1108 1109// ErrorResponse an error response from the Azure Container Registry service. 1110type ErrorResponse struct { 1111 // Error - Azure container registry build API error body. 1112 Error *ErrorResponseBody `json:"error,omitempty"` 1113} 1114 1115// ErrorResponseBody an error response from the Azure Container Registry service. 1116type ErrorResponseBody struct { 1117 // Code - error code. 1118 Code *string `json:"code,omitempty"` 1119 // Message - error message. 1120 Message *string `json:"message,omitempty"` 1121 // Target - target of the particular error. 1122 Target *string `json:"target,omitempty"` 1123 // Details - an array of additional nested error response info objects, as described by this contract. 1124 Details *InnerErrorDescription `json:"details,omitempty"` 1125} 1126 1127// Event the event for a webhook. 1128type Event struct { 1129 // EventRequestMessage - The event request message sent to the service URI. 1130 EventRequestMessage *EventRequestMessage `json:"eventRequestMessage,omitempty"` 1131 // EventResponseMessage - The event response message received from the service URI. 1132 EventResponseMessage *EventResponseMessage `json:"eventResponseMessage,omitempty"` 1133 // ID - The event ID. 1134 ID *string `json:"id,omitempty"` 1135} 1136 1137// EventContent the content of the event request message. 1138type EventContent struct { 1139 // ID - The event ID. 1140 ID *string `json:"id,omitempty"` 1141 // Timestamp - The time at which the event occurred. 1142 Timestamp *date.Time `json:"timestamp,omitempty"` 1143 // Action - The action that encompasses the provided event. 1144 Action *string `json:"action,omitempty"` 1145 // Target - The target of the event. 1146 Target *Target `json:"target,omitempty"` 1147 // Request - The request that generated the event. 1148 Request *Request `json:"request,omitempty"` 1149 // Actor - The agent that initiated the event. For most situations, this could be from the authorization context of the request. 1150 Actor *Actor `json:"actor,omitempty"` 1151 // Source - The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. 1152 Source *Source `json:"source,omitempty"` 1153} 1154 1155// EventInfo the basic information of an event. 1156type EventInfo struct { 1157 autorest.Response `json:"-"` 1158 // ID - The event ID. 1159 ID *string `json:"id,omitempty"` 1160} 1161 1162// EventListResult the result of a request to list events for a webhook. 1163type EventListResult struct { 1164 autorest.Response `json:"-"` 1165 // Value - The list of events. Since this list may be incomplete, the nextLink field should be used to request the next list of events. 1166 Value *[]Event `json:"value,omitempty"` 1167 // NextLink - The URI that can be used to request the next list of events. 1168 NextLink *string `json:"nextLink,omitempty"` 1169} 1170 1171// EventListResultIterator provides access to a complete listing of Event values. 1172type EventListResultIterator struct { 1173 i int 1174 page EventListResultPage 1175} 1176 1177// NextWithContext advances to the next value. If there was an error making 1178// the request the iterator does not advance and the error is returned. 1179func (iter *EventListResultIterator) NextWithContext(ctx context.Context) (err error) { 1180 if tracing.IsEnabled() { 1181 ctx = tracing.StartSpan(ctx, fqdn+"/EventListResultIterator.NextWithContext") 1182 defer func() { 1183 sc := -1 1184 if iter.Response().Response.Response != nil { 1185 sc = iter.Response().Response.Response.StatusCode 1186 } 1187 tracing.EndSpan(ctx, sc, err) 1188 }() 1189 } 1190 iter.i++ 1191 if iter.i < len(iter.page.Values()) { 1192 return nil 1193 } 1194 err = iter.page.NextWithContext(ctx) 1195 if err != nil { 1196 iter.i-- 1197 return err 1198 } 1199 iter.i = 0 1200 return nil 1201} 1202 1203// Next advances to the next value. If there was an error making 1204// the request the iterator does not advance and the error is returned. 1205// Deprecated: Use NextWithContext() instead. 1206func (iter *EventListResultIterator) Next() error { 1207 return iter.NextWithContext(context.Background()) 1208} 1209 1210// NotDone returns true if the enumeration should be started or is not yet complete. 1211func (iter EventListResultIterator) NotDone() bool { 1212 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1213} 1214 1215// Response returns the raw server response from the last page request. 1216func (iter EventListResultIterator) Response() EventListResult { 1217 return iter.page.Response() 1218} 1219 1220// Value returns the current value or a zero-initialized value if the 1221// iterator has advanced beyond the end of the collection. 1222func (iter EventListResultIterator) Value() Event { 1223 if !iter.page.NotDone() { 1224 return Event{} 1225 } 1226 return iter.page.Values()[iter.i] 1227} 1228 1229// Creates a new instance of the EventListResultIterator type. 1230func NewEventListResultIterator(page EventListResultPage) EventListResultIterator { 1231 return EventListResultIterator{page: page} 1232} 1233 1234// IsEmpty returns true if the ListResult contains no values. 1235func (elr EventListResult) IsEmpty() bool { 1236 return elr.Value == nil || len(*elr.Value) == 0 1237} 1238 1239// hasNextLink returns true if the NextLink is not empty. 1240func (elr EventListResult) hasNextLink() bool { 1241 return elr.NextLink != nil && len(*elr.NextLink) != 0 1242} 1243 1244// eventListResultPreparer prepares a request to retrieve the next set of results. 1245// It returns nil if no more results exist. 1246func (elr EventListResult) eventListResultPreparer(ctx context.Context) (*http.Request, error) { 1247 if !elr.hasNextLink() { 1248 return nil, nil 1249 } 1250 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1251 autorest.AsJSON(), 1252 autorest.AsGet(), 1253 autorest.WithBaseURL(to.String(elr.NextLink))) 1254} 1255 1256// EventListResultPage contains a page of Event values. 1257type EventListResultPage struct { 1258 fn func(context.Context, EventListResult) (EventListResult, error) 1259 elr EventListResult 1260} 1261 1262// NextWithContext advances to the next page of values. If there was an error making 1263// the request the page does not advance and the error is returned. 1264func (page *EventListResultPage) NextWithContext(ctx context.Context) (err error) { 1265 if tracing.IsEnabled() { 1266 ctx = tracing.StartSpan(ctx, fqdn+"/EventListResultPage.NextWithContext") 1267 defer func() { 1268 sc := -1 1269 if page.Response().Response.Response != nil { 1270 sc = page.Response().Response.Response.StatusCode 1271 } 1272 tracing.EndSpan(ctx, sc, err) 1273 }() 1274 } 1275 for { 1276 next, err := page.fn(ctx, page.elr) 1277 if err != nil { 1278 return err 1279 } 1280 page.elr = next 1281 if !next.hasNextLink() || !next.IsEmpty() { 1282 break 1283 } 1284 } 1285 return nil 1286} 1287 1288// Next advances to the next page of values. If there was an error making 1289// the request the page does not advance and the error is returned. 1290// Deprecated: Use NextWithContext() instead. 1291func (page *EventListResultPage) Next() error { 1292 return page.NextWithContext(context.Background()) 1293} 1294 1295// NotDone returns true if the page enumeration should be started or is not yet complete. 1296func (page EventListResultPage) NotDone() bool { 1297 return !page.elr.IsEmpty() 1298} 1299 1300// Response returns the raw server response from the last page request. 1301func (page EventListResultPage) Response() EventListResult { 1302 return page.elr 1303} 1304 1305// Values returns the slice of values for the current page or nil if there are no values. 1306func (page EventListResultPage) Values() []Event { 1307 if page.elr.IsEmpty() { 1308 return nil 1309 } 1310 return *page.elr.Value 1311} 1312 1313// Creates a new instance of the EventListResultPage type. 1314func NewEventListResultPage(cur EventListResult, getNextPage func(context.Context, EventListResult) (EventListResult, error)) EventListResultPage { 1315 return EventListResultPage{ 1316 fn: getNextPage, 1317 elr: cur, 1318 } 1319} 1320 1321// EventRequestMessage the event request message sent to the service URI. 1322type EventRequestMessage struct { 1323 // Content - The content of the event request message. 1324 Content *EventContent `json:"content,omitempty"` 1325 // Headers - The headers of the event request message. 1326 Headers map[string]*string `json:"headers"` 1327 // Method - The HTTP method used to send the event request message. 1328 Method *string `json:"method,omitempty"` 1329 // RequestURI - The URI used to send the event request message. 1330 RequestURI *string `json:"requestUri,omitempty"` 1331 // Version - The HTTP message version. 1332 Version *string `json:"version,omitempty"` 1333} 1334 1335// MarshalJSON is the custom marshaler for EventRequestMessage. 1336func (erm EventRequestMessage) MarshalJSON() ([]byte, error) { 1337 objectMap := make(map[string]interface{}) 1338 if erm.Content != nil { 1339 objectMap["content"] = erm.Content 1340 } 1341 if erm.Headers != nil { 1342 objectMap["headers"] = erm.Headers 1343 } 1344 if erm.Method != nil { 1345 objectMap["method"] = erm.Method 1346 } 1347 if erm.RequestURI != nil { 1348 objectMap["requestUri"] = erm.RequestURI 1349 } 1350 if erm.Version != nil { 1351 objectMap["version"] = erm.Version 1352 } 1353 return json.Marshal(objectMap) 1354} 1355 1356// EventResponseMessage the event response message received from the service URI. 1357type EventResponseMessage struct { 1358 // Content - The content of the event response message. 1359 Content *string `json:"content,omitempty"` 1360 // Headers - The headers of the event response message. 1361 Headers map[string]*string `json:"headers"` 1362 // ReasonPhrase - The reason phrase of the event response message. 1363 ReasonPhrase *string `json:"reasonPhrase,omitempty"` 1364 // StatusCode - The status code of the event response message. 1365 StatusCode *string `json:"statusCode,omitempty"` 1366 // Version - The HTTP message version. 1367 Version *string `json:"version,omitempty"` 1368} 1369 1370// MarshalJSON is the custom marshaler for EventResponseMessage. 1371func (erm EventResponseMessage) MarshalJSON() ([]byte, error) { 1372 objectMap := make(map[string]interface{}) 1373 if erm.Content != nil { 1374 objectMap["content"] = erm.Content 1375 } 1376 if erm.Headers != nil { 1377 objectMap["headers"] = erm.Headers 1378 } 1379 if erm.ReasonPhrase != nil { 1380 objectMap["reasonPhrase"] = erm.ReasonPhrase 1381 } 1382 if erm.StatusCode != nil { 1383 objectMap["statusCode"] = erm.StatusCode 1384 } 1385 if erm.Version != nil { 1386 objectMap["version"] = erm.Version 1387 } 1388 return json.Marshal(objectMap) 1389} 1390 1391// FileTaskRunRequest the request parameters for a scheduling run against a task file. 1392type FileTaskRunRequest struct { 1393 // TaskFilePath - The template/definition file path relative to the source. 1394 TaskFilePath *string `json:"taskFilePath,omitempty"` 1395 // ValuesFilePath - The values/parameters file path relative to the source. 1396 ValuesFilePath *string `json:"valuesFilePath,omitempty"` 1397 // Values - The collection of overridable values that can be passed when running a task. 1398 Values *[]SetValue `json:"values,omitempty"` 1399 // Timeout - Run timeout in seconds. 1400 Timeout *int32 `json:"timeout,omitempty"` 1401 // Platform - The platform properties against which the run has to happen. 1402 Platform *PlatformProperties `json:"platform,omitempty"` 1403 // AgentConfiguration - The machine configuration of the run agent. 1404 AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` 1405 // SourceLocation - The URL(absolute or relative) of the source context. It can be an URL to a tar or git repository. 1406 // If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. 1407 SourceLocation *string `json:"sourceLocation,omitempty"` 1408 // Credentials - The properties that describes a set of credentials that will be used when this run is invoked. 1409 Credentials *Credentials `json:"credentials,omitempty"` 1410 // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. 1411 IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` 1412 // AgentPoolName - The dedicated agent pool for the run. 1413 AgentPoolName *string `json:"agentPoolName,omitempty"` 1414 // LogTemplate - The template that describes the repository and tag information for run log artifact. 1415 LogTemplate *string `json:"logTemplate,omitempty"` 1416 // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' 1417 Type Type `json:"type,omitempty"` 1418} 1419 1420// MarshalJSON is the custom marshaler for FileTaskRunRequest. 1421func (ftrr FileTaskRunRequest) MarshalJSON() ([]byte, error) { 1422 ftrr.Type = TypeFileTaskRunRequest 1423 objectMap := make(map[string]interface{}) 1424 if ftrr.TaskFilePath != nil { 1425 objectMap["taskFilePath"] = ftrr.TaskFilePath 1426 } 1427 if ftrr.ValuesFilePath != nil { 1428 objectMap["valuesFilePath"] = ftrr.ValuesFilePath 1429 } 1430 if ftrr.Values != nil { 1431 objectMap["values"] = ftrr.Values 1432 } 1433 if ftrr.Timeout != nil { 1434 objectMap["timeout"] = ftrr.Timeout 1435 } 1436 if ftrr.Platform != nil { 1437 objectMap["platform"] = ftrr.Platform 1438 } 1439 if ftrr.AgentConfiguration != nil { 1440 objectMap["agentConfiguration"] = ftrr.AgentConfiguration 1441 } 1442 if ftrr.SourceLocation != nil { 1443 objectMap["sourceLocation"] = ftrr.SourceLocation 1444 } 1445 if ftrr.Credentials != nil { 1446 objectMap["credentials"] = ftrr.Credentials 1447 } 1448 if ftrr.IsArchiveEnabled != nil { 1449 objectMap["isArchiveEnabled"] = ftrr.IsArchiveEnabled 1450 } 1451 if ftrr.AgentPoolName != nil { 1452 objectMap["agentPoolName"] = ftrr.AgentPoolName 1453 } 1454 if ftrr.LogTemplate != nil { 1455 objectMap["logTemplate"] = ftrr.LogTemplate 1456 } 1457 if ftrr.Type != "" { 1458 objectMap["type"] = ftrr.Type 1459 } 1460 return json.Marshal(objectMap) 1461} 1462 1463// AsDockerBuildRequest is the BasicRunRequest implementation for FileTaskRunRequest. 1464func (ftrr FileTaskRunRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { 1465 return nil, false 1466} 1467 1468// AsFileTaskRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. 1469func (ftrr FileTaskRunRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { 1470 return &ftrr, true 1471} 1472 1473// AsTaskRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. 1474func (ftrr FileTaskRunRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { 1475 return nil, false 1476} 1477 1478// AsEncodedTaskRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. 1479func (ftrr FileTaskRunRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { 1480 return nil, false 1481} 1482 1483// AsRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. 1484func (ftrr FileTaskRunRequest) AsRunRequest() (*RunRequest, bool) { 1485 return nil, false 1486} 1487 1488// AsBasicRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. 1489func (ftrr FileTaskRunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { 1490 return &ftrr, true 1491} 1492 1493// FileTaskStep the properties of a task step. 1494type FileTaskStep struct { 1495 // TaskFilePath - The task template/definition file path relative to the source context. 1496 TaskFilePath *string `json:"taskFilePath,omitempty"` 1497 // ValuesFilePath - The task values/parameters file path relative to the source context. 1498 ValuesFilePath *string `json:"valuesFilePath,omitempty"` 1499 // Values - The collection of overridable values that can be passed when running a task. 1500 Values *[]SetValue `json:"values,omitempty"` 1501 // BaseImageDependencies - READ-ONLY; List of base image dependencies for a step. 1502 BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` 1503 // ContextPath - The URL(absolute or relative) of the source context for the task step. 1504 ContextPath *string `json:"contextPath,omitempty"` 1505 // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. 1506 ContextAccessToken *string `json:"contextAccessToken,omitempty"` 1507 // Type - Possible values include: 'TypeTaskStepProperties', 'TypeDocker', 'TypeFileTask', 'TypeEncodedTask' 1508 Type TypeBasicTaskStepProperties `json:"type,omitempty"` 1509} 1510 1511// MarshalJSON is the custom marshaler for FileTaskStep. 1512func (fts FileTaskStep) MarshalJSON() ([]byte, error) { 1513 fts.Type = TypeFileTask 1514 objectMap := make(map[string]interface{}) 1515 if fts.TaskFilePath != nil { 1516 objectMap["taskFilePath"] = fts.TaskFilePath 1517 } 1518 if fts.ValuesFilePath != nil { 1519 objectMap["valuesFilePath"] = fts.ValuesFilePath 1520 } 1521 if fts.Values != nil { 1522 objectMap["values"] = fts.Values 1523 } 1524 if fts.ContextPath != nil { 1525 objectMap["contextPath"] = fts.ContextPath 1526 } 1527 if fts.ContextAccessToken != nil { 1528 objectMap["contextAccessToken"] = fts.ContextAccessToken 1529 } 1530 if fts.Type != "" { 1531 objectMap["type"] = fts.Type 1532 } 1533 return json.Marshal(objectMap) 1534} 1535 1536// AsDockerBuildStep is the BasicTaskStepProperties implementation for FileTaskStep. 1537func (fts FileTaskStep) AsDockerBuildStep() (*DockerBuildStep, bool) { 1538 return nil, false 1539} 1540 1541// AsFileTaskStep is the BasicTaskStepProperties implementation for FileTaskStep. 1542func (fts FileTaskStep) AsFileTaskStep() (*FileTaskStep, bool) { 1543 return &fts, true 1544} 1545 1546// AsEncodedTaskStep is the BasicTaskStepProperties implementation for FileTaskStep. 1547func (fts FileTaskStep) AsEncodedTaskStep() (*EncodedTaskStep, bool) { 1548 return nil, false 1549} 1550 1551// AsTaskStepProperties is the BasicTaskStepProperties implementation for FileTaskStep. 1552func (fts FileTaskStep) AsTaskStepProperties() (*TaskStepProperties, bool) { 1553 return nil, false 1554} 1555 1556// AsBasicTaskStepProperties is the BasicTaskStepProperties implementation for FileTaskStep. 1557func (fts FileTaskStep) AsBasicTaskStepProperties() (BasicTaskStepProperties, bool) { 1558 return &fts, true 1559} 1560 1561// FileTaskStepUpdateParameters the properties of updating a task step. 1562type FileTaskStepUpdateParameters struct { 1563 // TaskFilePath - The task template/definition file path relative to the source context. 1564 TaskFilePath *string `json:"taskFilePath,omitempty"` 1565 // ValuesFilePath - The values/parameters file path relative to the source context. 1566 ValuesFilePath *string `json:"valuesFilePath,omitempty"` 1567 // Values - The collection of overridable values that can be passed when running a task. 1568 Values *[]SetValue `json:"values,omitempty"` 1569 // ContextPath - The URL(absolute or relative) of the source context for the task step. 1570 ContextPath *string `json:"contextPath,omitempty"` 1571 // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. 1572 ContextAccessToken *string `json:"contextAccessToken,omitempty"` 1573 // Type - Possible values include: 'TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters', 'TypeBasicTaskStepUpdateParametersTypeDocker', 'TypeBasicTaskStepUpdateParametersTypeFileTask', 'TypeBasicTaskStepUpdateParametersTypeEncodedTask' 1574 Type TypeBasicTaskStepUpdateParameters `json:"type,omitempty"` 1575} 1576 1577// MarshalJSON is the custom marshaler for FileTaskStepUpdateParameters. 1578func (ftsup FileTaskStepUpdateParameters) MarshalJSON() ([]byte, error) { 1579 ftsup.Type = TypeBasicTaskStepUpdateParametersTypeFileTask 1580 objectMap := make(map[string]interface{}) 1581 if ftsup.TaskFilePath != nil { 1582 objectMap["taskFilePath"] = ftsup.TaskFilePath 1583 } 1584 if ftsup.ValuesFilePath != nil { 1585 objectMap["valuesFilePath"] = ftsup.ValuesFilePath 1586 } 1587 if ftsup.Values != nil { 1588 objectMap["values"] = ftsup.Values 1589 } 1590 if ftsup.ContextPath != nil { 1591 objectMap["contextPath"] = ftsup.ContextPath 1592 } 1593 if ftsup.ContextAccessToken != nil { 1594 objectMap["contextAccessToken"] = ftsup.ContextAccessToken 1595 } 1596 if ftsup.Type != "" { 1597 objectMap["type"] = ftsup.Type 1598 } 1599 return json.Marshal(objectMap) 1600} 1601 1602// AsDockerBuildStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. 1603func (ftsup FileTaskStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { 1604 return nil, false 1605} 1606 1607// AsFileTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. 1608func (ftsup FileTaskStepUpdateParameters) AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) { 1609 return &ftsup, true 1610} 1611 1612// AsEncodedTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. 1613func (ftsup FileTaskStepUpdateParameters) AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) { 1614 return nil, false 1615} 1616 1617// AsTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. 1618func (ftsup FileTaskStepUpdateParameters) AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) { 1619 return nil, false 1620} 1621 1622// AsBasicTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. 1623func (ftsup FileTaskStepUpdateParameters) AsBasicTaskStepUpdateParameters() (BasicTaskStepUpdateParameters, bool) { 1624 return &ftsup, true 1625} 1626 1627// GenerateCredentialsParameters the parameters used to generate credentials for a specified token or user 1628// of a container registry. 1629type GenerateCredentialsParameters struct { 1630 // TokenID - The resource ID of the token for which credentials have to be generated. 1631 TokenID *string `json:"tokenId,omitempty"` 1632 // Expiry - The expiry date of the generated credentials after which the credentials become invalid. 1633 Expiry *date.Time `json:"expiry,omitempty"` 1634 // Name - Specifies name of the password which should be regenerated if any -- password1 or password2. Possible values include: 'TokenPasswordNamePassword1', 'TokenPasswordNamePassword2' 1635 Name TokenPasswordName `json:"name,omitempty"` 1636} 1637 1638// GenerateCredentialsResult the response from the GenerateCredentials operation. 1639type GenerateCredentialsResult struct { 1640 autorest.Response `json:"-"` 1641 // Username - The username for a container registry. 1642 Username *string `json:"username,omitempty"` 1643 // Passwords - The list of passwords for a container registry. 1644 Passwords *[]TokenPassword `json:"passwords,omitempty"` 1645} 1646 1647// IdentityProperties managed identity for the resource. 1648type IdentityProperties struct { 1649 // PrincipalID - The principal ID of resource identity. 1650 PrincipalID *string `json:"principalId,omitempty"` 1651 // TenantID - The tenant ID of resource. 1652 TenantID *string `json:"tenantId,omitempty"` 1653 // Type - The identity type. Possible values include: 'SystemAssigned', 'UserAssigned', 'SystemAssignedUserAssigned', 'None' 1654 Type ResourceIdentityType `json:"type,omitempty"` 1655 // UserAssignedIdentities - The list of user identities associated with the resource. The user identity 1656 // dictionary key references will be ARM resource ids in the form: 1657 // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ 1658 // providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. 1659 UserAssignedIdentities map[string]*UserIdentityProperties `json:"userAssignedIdentities"` 1660} 1661 1662// MarshalJSON is the custom marshaler for IdentityProperties. 1663func (IP IdentityProperties) MarshalJSON() ([]byte, error) { 1664 objectMap := make(map[string]interface{}) 1665 if IP.PrincipalID != nil { 1666 objectMap["principalId"] = IP.PrincipalID 1667 } 1668 if IP.TenantID != nil { 1669 objectMap["tenantId"] = IP.TenantID 1670 } 1671 if IP.Type != "" { 1672 objectMap["type"] = IP.Type 1673 } 1674 if IP.UserAssignedIdentities != nil { 1675 objectMap["userAssignedIdentities"] = IP.UserAssignedIdentities 1676 } 1677 return json.Marshal(objectMap) 1678} 1679 1680// ImageDescriptor properties for a registry image. 1681type ImageDescriptor struct { 1682 // Registry - The registry login server. 1683 Registry *string `json:"registry,omitempty"` 1684 // Repository - The repository name. 1685 Repository *string `json:"repository,omitempty"` 1686 // Tag - The tag name. 1687 Tag *string `json:"tag,omitempty"` 1688 // Digest - The sha256-based digest of the image manifest. 1689 Digest *string `json:"digest,omitempty"` 1690} 1691 1692// ImageUpdateTrigger the image update trigger that caused a build. 1693type ImageUpdateTrigger struct { 1694 // ID - The unique ID of the trigger. 1695 ID *string `json:"id,omitempty"` 1696 // Timestamp - The timestamp when the image update happened. 1697 Timestamp *date.Time `json:"timestamp,omitempty"` 1698 // Images - The list of image updates that caused the build. 1699 Images *[]ImageDescriptor `json:"images,omitempty"` 1700} 1701 1702// ImportImageParameters ... 1703type ImportImageParameters struct { 1704 // Source - The source of the image. 1705 Source *ImportSource `json:"source,omitempty"` 1706 // 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). 1707 TargetTags *[]string `json:"targetTags,omitempty"` 1708 // UntaggedTargetRepositories - List of strings of repository names to do a manifest only copy. No tag will be created. 1709 UntaggedTargetRepositories *[]string `json:"untaggedTargetRepositories,omitempty"` 1710 // 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' 1711 Mode ImportMode `json:"mode,omitempty"` 1712} 1713 1714// ImportSource ... 1715type ImportSource struct { 1716 // ResourceID - The resource identifier of the source Azure Container Registry. 1717 ResourceID *string `json:"resourceId,omitempty"` 1718 // RegistryURI - The address of the source registry (e.g. 'mcr.microsoft.com'). 1719 RegistryURI *string `json:"registryUri,omitempty"` 1720 // Credentials - Credentials used when importing from a registry uri. 1721 Credentials *ImportSourceCredentials `json:"credentials,omitempty"` 1722 // SourceImage - Repository name of the source image. 1723 // Specify an image by repository ('hello-world'). This will use the 'latest' tag. 1724 // Specify an image by tag ('hello-world:latest'). 1725 // Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). 1726 SourceImage *string `json:"sourceImage,omitempty"` 1727} 1728 1729// ImportSourceCredentials ... 1730type ImportSourceCredentials struct { 1731 // Username - The username to authenticate with the source registry. 1732 Username *string `json:"username,omitempty"` 1733 // Password - The password used to authenticate with the source registry. 1734 Password *string `json:"password,omitempty"` 1735} 1736 1737// InnerErrorDescription inner error. 1738type InnerErrorDescription struct { 1739 // Code - error code. 1740 Code *string `json:"code,omitempty"` 1741 // Message - error message. 1742 Message *string `json:"message,omitempty"` 1743 // Target - target of the particular error. 1744 Target *string `json:"target,omitempty"` 1745} 1746 1747// IPRule IP rule with specific IP or IP range in CIDR format. 1748type IPRule struct { 1749 // Action - The action of IP ACL rule. Possible values include: 'Allow' 1750 Action Action `json:"action,omitempty"` 1751 // IPAddressOrRange - Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. 1752 IPAddressOrRange *string `json:"value,omitempty"` 1753} 1754 1755// NetworkRuleSet the network rule set for a container registry. 1756type NetworkRuleSet struct { 1757 // DefaultAction - The default action of allow or deny when no other rules match. Possible values include: 'DefaultActionAllow', 'DefaultActionDeny' 1758 DefaultAction DefaultAction `json:"defaultAction,omitempty"` 1759 // VirtualNetworkRules - The virtual network rules. 1760 VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` 1761 // IPRules - The IP ACL rules. 1762 IPRules *[]IPRule `json:"ipRules,omitempty"` 1763} 1764 1765// OperationDefinition the definition of a container registry operation. 1766type OperationDefinition struct { 1767 // Origin - The origin information of the container registry operation. 1768 Origin *string `json:"origin,omitempty"` 1769 // Name - Operation name: {provider}/{resource}/{operation}. 1770 Name *string `json:"name,omitempty"` 1771 // Display - The display information for the container registry operation. 1772 Display *OperationDisplayDefinition `json:"display,omitempty"` 1773 // OperationPropertiesDefinition - The properties information for the container registry operation. 1774 *OperationPropertiesDefinition `json:"properties,omitempty"` 1775} 1776 1777// MarshalJSON is the custom marshaler for OperationDefinition. 1778func (od OperationDefinition) MarshalJSON() ([]byte, error) { 1779 objectMap := make(map[string]interface{}) 1780 if od.Origin != nil { 1781 objectMap["origin"] = od.Origin 1782 } 1783 if od.Name != nil { 1784 objectMap["name"] = od.Name 1785 } 1786 if od.Display != nil { 1787 objectMap["display"] = od.Display 1788 } 1789 if od.OperationPropertiesDefinition != nil { 1790 objectMap["properties"] = od.OperationPropertiesDefinition 1791 } 1792 return json.Marshal(objectMap) 1793} 1794 1795// UnmarshalJSON is the custom unmarshaler for OperationDefinition struct. 1796func (od *OperationDefinition) UnmarshalJSON(body []byte) error { 1797 var m map[string]*json.RawMessage 1798 err := json.Unmarshal(body, &m) 1799 if err != nil { 1800 return err 1801 } 1802 for k, v := range m { 1803 switch k { 1804 case "origin": 1805 if v != nil { 1806 var origin string 1807 err = json.Unmarshal(*v, &origin) 1808 if err != nil { 1809 return err 1810 } 1811 od.Origin = &origin 1812 } 1813 case "name": 1814 if v != nil { 1815 var name string 1816 err = json.Unmarshal(*v, &name) 1817 if err != nil { 1818 return err 1819 } 1820 od.Name = &name 1821 } 1822 case "display": 1823 if v != nil { 1824 var display OperationDisplayDefinition 1825 err = json.Unmarshal(*v, &display) 1826 if err != nil { 1827 return err 1828 } 1829 od.Display = &display 1830 } 1831 case "properties": 1832 if v != nil { 1833 var operationPropertiesDefinition OperationPropertiesDefinition 1834 err = json.Unmarshal(*v, &operationPropertiesDefinition) 1835 if err != nil { 1836 return err 1837 } 1838 od.OperationPropertiesDefinition = &operationPropertiesDefinition 1839 } 1840 } 1841 } 1842 1843 return nil 1844} 1845 1846// OperationDisplayDefinition the display information for a container registry operation. 1847type OperationDisplayDefinition struct { 1848 // Provider - The resource provider name: Microsoft.ContainerRegistry. 1849 Provider *string `json:"provider,omitempty"` 1850 // Resource - The resource on which the operation is performed. 1851 Resource *string `json:"resource,omitempty"` 1852 // Operation - The operation that users can perform. 1853 Operation *string `json:"operation,omitempty"` 1854 // Description - The description for the operation. 1855 Description *string `json:"description,omitempty"` 1856} 1857 1858// OperationListResult the result of a request to list container registry operations. 1859type OperationListResult struct { 1860 autorest.Response `json:"-"` 1861 // 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. 1862 Value *[]OperationDefinition `json:"value,omitempty"` 1863 // NextLink - The URI that can be used to request the next list of container registry operations. 1864 NextLink *string `json:"nextLink,omitempty"` 1865} 1866 1867// OperationListResultIterator provides access to a complete listing of OperationDefinition values. 1868type OperationListResultIterator struct { 1869 i int 1870 page OperationListResultPage 1871} 1872 1873// NextWithContext advances to the next value. If there was an error making 1874// the request the iterator does not advance and the error is returned. 1875func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { 1876 if tracing.IsEnabled() { 1877 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") 1878 defer func() { 1879 sc := -1 1880 if iter.Response().Response.Response != nil { 1881 sc = iter.Response().Response.Response.StatusCode 1882 } 1883 tracing.EndSpan(ctx, sc, err) 1884 }() 1885 } 1886 iter.i++ 1887 if iter.i < len(iter.page.Values()) { 1888 return nil 1889 } 1890 err = iter.page.NextWithContext(ctx) 1891 if err != nil { 1892 iter.i-- 1893 return err 1894 } 1895 iter.i = 0 1896 return nil 1897} 1898 1899// Next advances to the next value. If there was an error making 1900// the request the iterator does not advance and the error is returned. 1901// Deprecated: Use NextWithContext() instead. 1902func (iter *OperationListResultIterator) Next() error { 1903 return iter.NextWithContext(context.Background()) 1904} 1905 1906// NotDone returns true if the enumeration should be started or is not yet complete. 1907func (iter OperationListResultIterator) NotDone() bool { 1908 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1909} 1910 1911// Response returns the raw server response from the last page request. 1912func (iter OperationListResultIterator) Response() OperationListResult { 1913 return iter.page.Response() 1914} 1915 1916// Value returns the current value or a zero-initialized value if the 1917// iterator has advanced beyond the end of the collection. 1918func (iter OperationListResultIterator) Value() OperationDefinition { 1919 if !iter.page.NotDone() { 1920 return OperationDefinition{} 1921 } 1922 return iter.page.Values()[iter.i] 1923} 1924 1925// Creates a new instance of the OperationListResultIterator type. 1926func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { 1927 return OperationListResultIterator{page: page} 1928} 1929 1930// IsEmpty returns true if the ListResult contains no values. 1931func (olr OperationListResult) IsEmpty() bool { 1932 return olr.Value == nil || len(*olr.Value) == 0 1933} 1934 1935// hasNextLink returns true if the NextLink is not empty. 1936func (olr OperationListResult) hasNextLink() bool { 1937 return olr.NextLink != nil && len(*olr.NextLink) != 0 1938} 1939 1940// operationListResultPreparer prepares a request to retrieve the next set of results. 1941// It returns nil if no more results exist. 1942func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { 1943 if !olr.hasNextLink() { 1944 return nil, nil 1945 } 1946 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1947 autorest.AsJSON(), 1948 autorest.AsGet(), 1949 autorest.WithBaseURL(to.String(olr.NextLink))) 1950} 1951 1952// OperationListResultPage contains a page of OperationDefinition values. 1953type OperationListResultPage struct { 1954 fn func(context.Context, OperationListResult) (OperationListResult, error) 1955 olr OperationListResult 1956} 1957 1958// NextWithContext advances to the next page of values. If there was an error making 1959// the request the page does not advance and the error is returned. 1960func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { 1961 if tracing.IsEnabled() { 1962 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") 1963 defer func() { 1964 sc := -1 1965 if page.Response().Response.Response != nil { 1966 sc = page.Response().Response.Response.StatusCode 1967 } 1968 tracing.EndSpan(ctx, sc, err) 1969 }() 1970 } 1971 for { 1972 next, err := page.fn(ctx, page.olr) 1973 if err != nil { 1974 return err 1975 } 1976 page.olr = next 1977 if !next.hasNextLink() || !next.IsEmpty() { 1978 break 1979 } 1980 } 1981 return nil 1982} 1983 1984// Next advances to the next page of values. If there was an error making 1985// the request the page does not advance and the error is returned. 1986// Deprecated: Use NextWithContext() instead. 1987func (page *OperationListResultPage) Next() error { 1988 return page.NextWithContext(context.Background()) 1989} 1990 1991// NotDone returns true if the page enumeration should be started or is not yet complete. 1992func (page OperationListResultPage) NotDone() bool { 1993 return !page.olr.IsEmpty() 1994} 1995 1996// Response returns the raw server response from the last page request. 1997func (page OperationListResultPage) Response() OperationListResult { 1998 return page.olr 1999} 2000 2001// Values returns the slice of values for the current page or nil if there are no values. 2002func (page OperationListResultPage) Values() []OperationDefinition { 2003 if page.olr.IsEmpty() { 2004 return nil 2005 } 2006 return *page.olr.Value 2007} 2008 2009// Creates a new instance of the OperationListResultPage type. 2010func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { 2011 return OperationListResultPage{ 2012 fn: getNextPage, 2013 olr: cur, 2014 } 2015} 2016 2017// OperationMetricSpecificationDefinition the definition of Azure Monitoring metric. 2018type OperationMetricSpecificationDefinition struct { 2019 // Name - Metric name. 2020 Name *string `json:"name,omitempty"` 2021 // DisplayName - Metric display name. 2022 DisplayName *string `json:"displayName,omitempty"` 2023 // DisplayDescription - Metric description. 2024 DisplayDescription *string `json:"displayDescription,omitempty"` 2025 // Unit - Metric unit. 2026 Unit *string `json:"unit,omitempty"` 2027 // AggregationType - Metric aggregation type. 2028 AggregationType *string `json:"aggregationType,omitempty"` 2029 // InternalMetricName - Internal metric name. 2030 InternalMetricName *string `json:"internalMetricName,omitempty"` 2031} 2032 2033// OperationPropertiesDefinition the definition of Azure Monitoring properties. 2034type OperationPropertiesDefinition struct { 2035 // ServiceSpecification - The definition of Azure Monitoring service. 2036 ServiceSpecification *OperationServiceSpecificationDefinition `json:"serviceSpecification,omitempty"` 2037} 2038 2039// OperationServiceSpecificationDefinition the definition of Azure Monitoring list. 2040type OperationServiceSpecificationDefinition struct { 2041 // MetricSpecifications - A list of Azure Monitoring metrics definition. 2042 MetricSpecifications *[]OperationMetricSpecificationDefinition `json:"metricSpecifications,omitempty"` 2043} 2044 2045// OverrideTaskStepProperties ... 2046type OverrideTaskStepProperties struct { 2047 // ContextPath - The source context against which run has to be queued. 2048 ContextPath *string `json:"contextPath,omitempty"` 2049 // File - The file against which run has to be queued. 2050 File *string `json:"file,omitempty"` 2051 // Arguments - Gets or sets the collection of override arguments to be used when 2052 // executing a build step. 2053 Arguments *[]Argument `json:"arguments,omitempty"` 2054 // Target - The name of the target build stage for the docker build. 2055 Target *string `json:"target,omitempty"` 2056 // Values - The collection of overridable values that can be passed when running a Task. 2057 Values *[]SetValue `json:"values,omitempty"` 2058 // UpdateTriggerToken - Base64 encoded update trigger token that will be attached with the base image trigger webhook. 2059 UpdateTriggerToken *string `json:"updateTriggerToken,omitempty"` 2060} 2061 2062// PlatformProperties the platform properties against which the run has to happen. 2063type PlatformProperties struct { 2064 // Os - The operating system type required for the run. Possible values include: 'Windows', 'Linux' 2065 Os OS `json:"os,omitempty"` 2066 // Architecture - The OS architecture. Possible values include: 'Amd64', 'X86', 'ThreeEightSix', 'Arm', 'Arm64' 2067 Architecture Architecture `json:"architecture,omitempty"` 2068 // Variant - Variant of the CPU. Possible values include: 'V6', 'V7', 'V8' 2069 Variant Variant `json:"variant,omitempty"` 2070} 2071 2072// PlatformUpdateParameters the properties for updating the platform configuration. 2073type PlatformUpdateParameters struct { 2074 // Os - The operating system type required for the run. Possible values include: 'Windows', 'Linux' 2075 Os OS `json:"os,omitempty"` 2076 // Architecture - The OS architecture. Possible values include: 'Amd64', 'X86', 'ThreeEightSix', 'Arm', 'Arm64' 2077 Architecture Architecture `json:"architecture,omitempty"` 2078 // Variant - Variant of the CPU. Possible values include: 'V6', 'V7', 'V8' 2079 Variant Variant `json:"variant,omitempty"` 2080} 2081 2082// Policies the policies for a container registry. 2083type Policies struct { 2084 // QuarantinePolicy - The quarantine policy for a container registry. 2085 QuarantinePolicy *QuarantinePolicy `json:"quarantinePolicy,omitempty"` 2086 // TrustPolicy - The content trust policy for a container registry. 2087 TrustPolicy *TrustPolicy `json:"trustPolicy,omitempty"` 2088 // RetentionPolicy - The retention policy for a container registry. 2089 RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` 2090} 2091 2092// ProxyResource the resource model definition for a ARM proxy resource. It will have everything other than 2093// required location and tags. 2094type ProxyResource struct { 2095 // ID - READ-ONLY; The resource ID. 2096 ID *string `json:"id,omitempty"` 2097 // Name - READ-ONLY; The name of the resource. 2098 Name *string `json:"name,omitempty"` 2099 // Type - READ-ONLY; The type of the resource. 2100 Type *string `json:"type,omitempty"` 2101 // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. 2102 SystemData *SystemData `json:"systemData,omitempty"` 2103} 2104 2105// QuarantinePolicy the quarantine policy for a container registry. 2106type QuarantinePolicy struct { 2107 // Status - The value that indicates whether the policy is enabled or not. Possible values include: 'Enabled', 'Disabled' 2108 Status PolicyStatus `json:"status,omitempty"` 2109} 2110 2111// RegenerateCredentialParameters the parameters used to regenerate the login credential. 2112type RegenerateCredentialParameters struct { 2113 // Name - Specifies name of the password which should be regenerated -- password or password2. Possible values include: 'Password', 'Password2' 2114 Name PasswordName `json:"name,omitempty"` 2115} 2116 2117// RegistriesCreateFuture an abstraction for monitoring and retrieving the results of a long-running 2118// operation. 2119type RegistriesCreateFuture struct { 2120 azure.FutureAPI 2121 // Result returns the result of the asynchronous operation. 2122 // If the operation has not completed it will return an error. 2123 Result func(RegistriesClient) (Registry, error) 2124} 2125 2126// RegistriesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 2127// operation. 2128type RegistriesDeleteFuture struct { 2129 azure.FutureAPI 2130 // Result returns the result of the asynchronous operation. 2131 // If the operation has not completed it will return an error. 2132 Result func(RegistriesClient) (autorest.Response, error) 2133} 2134 2135// RegistriesGenerateCredentialsFuture an abstraction for monitoring and retrieving the results of a 2136// long-running operation. 2137type RegistriesGenerateCredentialsFuture struct { 2138 azure.FutureAPI 2139 // Result returns the result of the asynchronous operation. 2140 // If the operation has not completed it will return an error. 2141 Result func(RegistriesClient) (GenerateCredentialsResult, error) 2142} 2143 2144// RegistriesImportImageFuture an abstraction for monitoring and retrieving the results of a long-running 2145// operation. 2146type RegistriesImportImageFuture struct { 2147 azure.FutureAPI 2148 // Result returns the result of the asynchronous operation. 2149 // If the operation has not completed it will return an error. 2150 Result func(RegistriesClient) (autorest.Response, error) 2151} 2152 2153// RegistriesScheduleRunFuture an abstraction for monitoring and retrieving the results of a long-running 2154// operation. 2155type RegistriesScheduleRunFuture struct { 2156 azure.FutureAPI 2157 // Result returns the result of the asynchronous operation. 2158 // If the operation has not completed it will return an error. 2159 Result func(RegistriesClient) (Run, error) 2160} 2161 2162// RegistriesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 2163// operation. 2164type RegistriesUpdateFuture struct { 2165 azure.FutureAPI 2166 // Result returns the result of the asynchronous operation. 2167 // If the operation has not completed it will return an error. 2168 Result func(RegistriesClient) (Registry, error) 2169} 2170 2171// Registry an object that represents a container registry. 2172type Registry struct { 2173 autorest.Response `json:"-"` 2174 // Sku - The SKU of the container registry. 2175 Sku *Sku `json:"sku,omitempty"` 2176 // RegistryProperties - The properties of the container registry. 2177 *RegistryProperties `json:"properties,omitempty"` 2178 // ID - READ-ONLY; The resource ID. 2179 ID *string `json:"id,omitempty"` 2180 // Name - READ-ONLY; The name of the resource. 2181 Name *string `json:"name,omitempty"` 2182 // Type - READ-ONLY; The type of the resource. 2183 Type *string `json:"type,omitempty"` 2184 // Location - The location of the resource. This cannot be changed after the resource is created. 2185 Location *string `json:"location,omitempty"` 2186 // Tags - The tags of the resource. 2187 Tags map[string]*string `json:"tags"` 2188 // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. 2189 SystemData *SystemData `json:"systemData,omitempty"` 2190} 2191 2192// MarshalJSON is the custom marshaler for Registry. 2193func (r Registry) MarshalJSON() ([]byte, error) { 2194 objectMap := make(map[string]interface{}) 2195 if r.Sku != nil { 2196 objectMap["sku"] = r.Sku 2197 } 2198 if r.RegistryProperties != nil { 2199 objectMap["properties"] = r.RegistryProperties 2200 } 2201 if r.Location != nil { 2202 objectMap["location"] = r.Location 2203 } 2204 if r.Tags != nil { 2205 objectMap["tags"] = r.Tags 2206 } 2207 return json.Marshal(objectMap) 2208} 2209 2210// UnmarshalJSON is the custom unmarshaler for Registry struct. 2211func (r *Registry) UnmarshalJSON(body []byte) error { 2212 var m map[string]*json.RawMessage 2213 err := json.Unmarshal(body, &m) 2214 if err != nil { 2215 return err 2216 } 2217 for k, v := range m { 2218 switch k { 2219 case "sku": 2220 if v != nil { 2221 var sku Sku 2222 err = json.Unmarshal(*v, &sku) 2223 if err != nil { 2224 return err 2225 } 2226 r.Sku = &sku 2227 } 2228 case "properties": 2229 if v != nil { 2230 var registryProperties RegistryProperties 2231 err = json.Unmarshal(*v, ®istryProperties) 2232 if err != nil { 2233 return err 2234 } 2235 r.RegistryProperties = ®istryProperties 2236 } 2237 case "id": 2238 if v != nil { 2239 var ID string 2240 err = json.Unmarshal(*v, &ID) 2241 if err != nil { 2242 return err 2243 } 2244 r.ID = &ID 2245 } 2246 case "name": 2247 if v != nil { 2248 var name string 2249 err = json.Unmarshal(*v, &name) 2250 if err != nil { 2251 return err 2252 } 2253 r.Name = &name 2254 } 2255 case "type": 2256 if v != nil { 2257 var typeVar string 2258 err = json.Unmarshal(*v, &typeVar) 2259 if err != nil { 2260 return err 2261 } 2262 r.Type = &typeVar 2263 } 2264 case "location": 2265 if v != nil { 2266 var location string 2267 err = json.Unmarshal(*v, &location) 2268 if err != nil { 2269 return err 2270 } 2271 r.Location = &location 2272 } 2273 case "tags": 2274 if v != nil { 2275 var tags map[string]*string 2276 err = json.Unmarshal(*v, &tags) 2277 if err != nil { 2278 return err 2279 } 2280 r.Tags = tags 2281 } 2282 case "systemData": 2283 if v != nil { 2284 var systemData SystemData 2285 err = json.Unmarshal(*v, &systemData) 2286 if err != nil { 2287 return err 2288 } 2289 r.SystemData = &systemData 2290 } 2291 } 2292 } 2293 2294 return nil 2295} 2296 2297// RegistryListCredentialsResult the response from the ListCredentials operation. 2298type RegistryListCredentialsResult struct { 2299 autorest.Response `json:"-"` 2300 // Username - The username for a container registry. 2301 Username *string `json:"username,omitempty"` 2302 // Passwords - The list of passwords for a container registry. 2303 Passwords *[]RegistryPassword `json:"passwords,omitempty"` 2304} 2305 2306// RegistryListResult the result of a request to list container registries. 2307type RegistryListResult struct { 2308 autorest.Response `json:"-"` 2309 // 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. 2310 Value *[]Registry `json:"value,omitempty"` 2311 // NextLink - The URI that can be used to request the next list of container registries. 2312 NextLink *string `json:"nextLink,omitempty"` 2313} 2314 2315// RegistryListResultIterator provides access to a complete listing of Registry values. 2316type RegistryListResultIterator struct { 2317 i int 2318 page RegistryListResultPage 2319} 2320 2321// NextWithContext advances to the next value. If there was an error making 2322// the request the iterator does not advance and the error is returned. 2323func (iter *RegistryListResultIterator) NextWithContext(ctx context.Context) (err error) { 2324 if tracing.IsEnabled() { 2325 ctx = tracing.StartSpan(ctx, fqdn+"/RegistryListResultIterator.NextWithContext") 2326 defer func() { 2327 sc := -1 2328 if iter.Response().Response.Response != nil { 2329 sc = iter.Response().Response.Response.StatusCode 2330 } 2331 tracing.EndSpan(ctx, sc, err) 2332 }() 2333 } 2334 iter.i++ 2335 if iter.i < len(iter.page.Values()) { 2336 return nil 2337 } 2338 err = iter.page.NextWithContext(ctx) 2339 if err != nil { 2340 iter.i-- 2341 return err 2342 } 2343 iter.i = 0 2344 return nil 2345} 2346 2347// Next advances to the next value. If there was an error making 2348// the request the iterator does not advance and the error is returned. 2349// Deprecated: Use NextWithContext() instead. 2350func (iter *RegistryListResultIterator) Next() error { 2351 return iter.NextWithContext(context.Background()) 2352} 2353 2354// NotDone returns true if the enumeration should be started or is not yet complete. 2355func (iter RegistryListResultIterator) NotDone() bool { 2356 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2357} 2358 2359// Response returns the raw server response from the last page request. 2360func (iter RegistryListResultIterator) Response() RegistryListResult { 2361 return iter.page.Response() 2362} 2363 2364// Value returns the current value or a zero-initialized value if the 2365// iterator has advanced beyond the end of the collection. 2366func (iter RegistryListResultIterator) Value() Registry { 2367 if !iter.page.NotDone() { 2368 return Registry{} 2369 } 2370 return iter.page.Values()[iter.i] 2371} 2372 2373// Creates a new instance of the RegistryListResultIterator type. 2374func NewRegistryListResultIterator(page RegistryListResultPage) RegistryListResultIterator { 2375 return RegistryListResultIterator{page: page} 2376} 2377 2378// IsEmpty returns true if the ListResult contains no values. 2379func (rlr RegistryListResult) IsEmpty() bool { 2380 return rlr.Value == nil || len(*rlr.Value) == 0 2381} 2382 2383// hasNextLink returns true if the NextLink is not empty. 2384func (rlr RegistryListResult) hasNextLink() bool { 2385 return rlr.NextLink != nil && len(*rlr.NextLink) != 0 2386} 2387 2388// registryListResultPreparer prepares a request to retrieve the next set of results. 2389// It returns nil if no more results exist. 2390func (rlr RegistryListResult) registryListResultPreparer(ctx context.Context) (*http.Request, error) { 2391 if !rlr.hasNextLink() { 2392 return nil, nil 2393 } 2394 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2395 autorest.AsJSON(), 2396 autorest.AsGet(), 2397 autorest.WithBaseURL(to.String(rlr.NextLink))) 2398} 2399 2400// RegistryListResultPage contains a page of Registry values. 2401type RegistryListResultPage struct { 2402 fn func(context.Context, RegistryListResult) (RegistryListResult, error) 2403 rlr RegistryListResult 2404} 2405 2406// NextWithContext advances to the next page of values. If there was an error making 2407// the request the page does not advance and the error is returned. 2408func (page *RegistryListResultPage) NextWithContext(ctx context.Context) (err error) { 2409 if tracing.IsEnabled() { 2410 ctx = tracing.StartSpan(ctx, fqdn+"/RegistryListResultPage.NextWithContext") 2411 defer func() { 2412 sc := -1 2413 if page.Response().Response.Response != nil { 2414 sc = page.Response().Response.Response.StatusCode 2415 } 2416 tracing.EndSpan(ctx, sc, err) 2417 }() 2418 } 2419 for { 2420 next, err := page.fn(ctx, page.rlr) 2421 if err != nil { 2422 return err 2423 } 2424 page.rlr = next 2425 if !next.hasNextLink() || !next.IsEmpty() { 2426 break 2427 } 2428 } 2429 return nil 2430} 2431 2432// Next advances to the next page of values. If there was an error making 2433// the request the page does not advance and the error is returned. 2434// Deprecated: Use NextWithContext() instead. 2435func (page *RegistryListResultPage) Next() error { 2436 return page.NextWithContext(context.Background()) 2437} 2438 2439// NotDone returns true if the page enumeration should be started or is not yet complete. 2440func (page RegistryListResultPage) NotDone() bool { 2441 return !page.rlr.IsEmpty() 2442} 2443 2444// Response returns the raw server response from the last page request. 2445func (page RegistryListResultPage) Response() RegistryListResult { 2446 return page.rlr 2447} 2448 2449// Values returns the slice of values for the current page or nil if there are no values. 2450func (page RegistryListResultPage) Values() []Registry { 2451 if page.rlr.IsEmpty() { 2452 return nil 2453 } 2454 return *page.rlr.Value 2455} 2456 2457// Creates a new instance of the RegistryListResultPage type. 2458func NewRegistryListResultPage(cur RegistryListResult, getNextPage func(context.Context, RegistryListResult) (RegistryListResult, error)) RegistryListResultPage { 2459 return RegistryListResultPage{ 2460 fn: getNextPage, 2461 rlr: cur, 2462 } 2463} 2464 2465// RegistryNameCheckRequest a request to check whether a container registry name is available. 2466type RegistryNameCheckRequest struct { 2467 // Name - The name of the container registry. 2468 Name *string `json:"name,omitempty"` 2469 // Type - The resource type of the container registry. This field must be set to 'Microsoft.ContainerRegistry/registries'. 2470 Type *string `json:"type,omitempty"` 2471} 2472 2473// RegistryNameStatus the result of a request to check the availability of a container registry name. 2474type RegistryNameStatus struct { 2475 autorest.Response `json:"-"` 2476 // NameAvailable - The value that indicates whether the name is available. 2477 NameAvailable *bool `json:"nameAvailable,omitempty"` 2478 // Reason - If any, the reason that the name is not available. 2479 Reason *string `json:"reason,omitempty"` 2480 // Message - If any, the error message that provides more detail for the reason that the name is not available. 2481 Message *string `json:"message,omitempty"` 2482} 2483 2484// RegistryPassword the login password for the container registry. 2485type RegistryPassword struct { 2486 // Name - The password name. Possible values include: 'Password', 'Password2' 2487 Name PasswordName `json:"name,omitempty"` 2488 // Value - The password value. 2489 Value *string `json:"value,omitempty"` 2490} 2491 2492// RegistryProperties the properties of a container registry. 2493type RegistryProperties struct { 2494 // LoginServer - READ-ONLY; The URL that can be used to log into the container registry. 2495 LoginServer *string `json:"loginServer,omitempty"` 2496 // CreationDate - READ-ONLY; The creation date of the container registry in ISO8601 format. 2497 CreationDate *date.Time `json:"creationDate,omitempty"` 2498 // ProvisioningState - READ-ONLY; The provisioning state of the container registry at the time the operation was called. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' 2499 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 2500 // Status - READ-ONLY; The status of the container registry at the time the operation was called. 2501 Status *Status `json:"status,omitempty"` 2502 // AdminUserEnabled - The value that indicates whether the admin user is enabled. 2503 AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"` 2504 // StorageAccount - The properties of the storage account for the container registry. Only applicable to Classic SKU. 2505 StorageAccount *StorageAccountProperties `json:"storageAccount,omitempty"` 2506 // NetworkRuleSet - The network rule set for a container registry. 2507 NetworkRuleSet *NetworkRuleSet `json:"networkRuleSet,omitempty"` 2508 // Policies - The policies for a container registry. 2509 Policies *Policies `json:"policies,omitempty"` 2510} 2511 2512// MarshalJSON is the custom marshaler for RegistryProperties. 2513func (rp RegistryProperties) MarshalJSON() ([]byte, error) { 2514 objectMap := make(map[string]interface{}) 2515 if rp.AdminUserEnabled != nil { 2516 objectMap["adminUserEnabled"] = rp.AdminUserEnabled 2517 } 2518 if rp.StorageAccount != nil { 2519 objectMap["storageAccount"] = rp.StorageAccount 2520 } 2521 if rp.NetworkRuleSet != nil { 2522 objectMap["networkRuleSet"] = rp.NetworkRuleSet 2523 } 2524 if rp.Policies != nil { 2525 objectMap["policies"] = rp.Policies 2526 } 2527 return json.Marshal(objectMap) 2528} 2529 2530// RegistryPropertiesUpdateParameters the parameters for updating the properties of a container registry. 2531type RegistryPropertiesUpdateParameters struct { 2532 // AdminUserEnabled - The value that indicates whether the admin user is enabled. 2533 AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"` 2534 // NetworkRuleSet - The network rule set for a container registry. 2535 NetworkRuleSet *NetworkRuleSet `json:"networkRuleSet,omitempty"` 2536 // Policies - The policies for a container registry. 2537 Policies *Policies `json:"policies,omitempty"` 2538} 2539 2540// RegistryUpdateParameters the parameters for updating a container registry. 2541type RegistryUpdateParameters struct { 2542 // Tags - The tags for the container registry. 2543 Tags map[string]*string `json:"tags"` 2544 // Sku - The SKU of the container registry. 2545 Sku *Sku `json:"sku,omitempty"` 2546 // RegistryPropertiesUpdateParameters - The properties that the container registry will be updated with. 2547 *RegistryPropertiesUpdateParameters `json:"properties,omitempty"` 2548} 2549 2550// MarshalJSON is the custom marshaler for RegistryUpdateParameters. 2551func (rup RegistryUpdateParameters) MarshalJSON() ([]byte, error) { 2552 objectMap := make(map[string]interface{}) 2553 if rup.Tags != nil { 2554 objectMap["tags"] = rup.Tags 2555 } 2556 if rup.Sku != nil { 2557 objectMap["sku"] = rup.Sku 2558 } 2559 if rup.RegistryPropertiesUpdateParameters != nil { 2560 objectMap["properties"] = rup.RegistryPropertiesUpdateParameters 2561 } 2562 return json.Marshal(objectMap) 2563} 2564 2565// UnmarshalJSON is the custom unmarshaler for RegistryUpdateParameters struct. 2566func (rup *RegistryUpdateParameters) UnmarshalJSON(body []byte) error { 2567 var m map[string]*json.RawMessage 2568 err := json.Unmarshal(body, &m) 2569 if err != nil { 2570 return err 2571 } 2572 for k, v := range m { 2573 switch k { 2574 case "tags": 2575 if v != nil { 2576 var tags map[string]*string 2577 err = json.Unmarshal(*v, &tags) 2578 if err != nil { 2579 return err 2580 } 2581 rup.Tags = tags 2582 } 2583 case "sku": 2584 if v != nil { 2585 var sku Sku 2586 err = json.Unmarshal(*v, &sku) 2587 if err != nil { 2588 return err 2589 } 2590 rup.Sku = &sku 2591 } 2592 case "properties": 2593 if v != nil { 2594 var registryPropertiesUpdateParameters RegistryPropertiesUpdateParameters 2595 err = json.Unmarshal(*v, ®istryPropertiesUpdateParameters) 2596 if err != nil { 2597 return err 2598 } 2599 rup.RegistryPropertiesUpdateParameters = ®istryPropertiesUpdateParameters 2600 } 2601 } 2602 } 2603 2604 return nil 2605} 2606 2607// RegistryUsage the quota usage for a container registry. 2608type RegistryUsage struct { 2609 // Name - The name of the usage. 2610 Name *string `json:"name,omitempty"` 2611 // Limit - The limit of the usage. 2612 Limit *int64 `json:"limit,omitempty"` 2613 // CurrentValue - The current value of the usage. 2614 CurrentValue *int64 `json:"currentValue,omitempty"` 2615 // Unit - The unit of measurement. Possible values include: 'Count', 'Bytes' 2616 Unit RegistryUsageUnit `json:"unit,omitempty"` 2617} 2618 2619// RegistryUsageListResult the result of a request to get container registry quota usages. 2620type RegistryUsageListResult struct { 2621 autorest.Response `json:"-"` 2622 // Value - The list of container registry quota usages. 2623 Value *[]RegistryUsage `json:"value,omitempty"` 2624} 2625 2626// Replication an object that represents a replication for a container registry. 2627type Replication struct { 2628 autorest.Response `json:"-"` 2629 // ReplicationProperties - The properties of the replication. 2630 *ReplicationProperties `json:"properties,omitempty"` 2631 // ID - READ-ONLY; The resource ID. 2632 ID *string `json:"id,omitempty"` 2633 // Name - READ-ONLY; The name of the resource. 2634 Name *string `json:"name,omitempty"` 2635 // Type - READ-ONLY; The type of the resource. 2636 Type *string `json:"type,omitempty"` 2637 // Location - The location of the resource. This cannot be changed after the resource is created. 2638 Location *string `json:"location,omitempty"` 2639 // Tags - The tags of the resource. 2640 Tags map[string]*string `json:"tags"` 2641 // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. 2642 SystemData *SystemData `json:"systemData,omitempty"` 2643} 2644 2645// MarshalJSON is the custom marshaler for Replication. 2646func (r Replication) MarshalJSON() ([]byte, error) { 2647 objectMap := make(map[string]interface{}) 2648 if r.ReplicationProperties != nil { 2649 objectMap["properties"] = r.ReplicationProperties 2650 } 2651 if r.Location != nil { 2652 objectMap["location"] = r.Location 2653 } 2654 if r.Tags != nil { 2655 objectMap["tags"] = r.Tags 2656 } 2657 return json.Marshal(objectMap) 2658} 2659 2660// UnmarshalJSON is the custom unmarshaler for Replication struct. 2661func (r *Replication) UnmarshalJSON(body []byte) error { 2662 var m map[string]*json.RawMessage 2663 err := json.Unmarshal(body, &m) 2664 if err != nil { 2665 return err 2666 } 2667 for k, v := range m { 2668 switch k { 2669 case "properties": 2670 if v != nil { 2671 var replicationProperties ReplicationProperties 2672 err = json.Unmarshal(*v, &replicationProperties) 2673 if err != nil { 2674 return err 2675 } 2676 r.ReplicationProperties = &replicationProperties 2677 } 2678 case "id": 2679 if v != nil { 2680 var ID string 2681 err = json.Unmarshal(*v, &ID) 2682 if err != nil { 2683 return err 2684 } 2685 r.ID = &ID 2686 } 2687 case "name": 2688 if v != nil { 2689 var name string 2690 err = json.Unmarshal(*v, &name) 2691 if err != nil { 2692 return err 2693 } 2694 r.Name = &name 2695 } 2696 case "type": 2697 if v != nil { 2698 var typeVar string 2699 err = json.Unmarshal(*v, &typeVar) 2700 if err != nil { 2701 return err 2702 } 2703 r.Type = &typeVar 2704 } 2705 case "location": 2706 if v != nil { 2707 var location string 2708 err = json.Unmarshal(*v, &location) 2709 if err != nil { 2710 return err 2711 } 2712 r.Location = &location 2713 } 2714 case "tags": 2715 if v != nil { 2716 var tags map[string]*string 2717 err = json.Unmarshal(*v, &tags) 2718 if err != nil { 2719 return err 2720 } 2721 r.Tags = tags 2722 } 2723 case "systemData": 2724 if v != nil { 2725 var systemData SystemData 2726 err = json.Unmarshal(*v, &systemData) 2727 if err != nil { 2728 return err 2729 } 2730 r.SystemData = &systemData 2731 } 2732 } 2733 } 2734 2735 return nil 2736} 2737 2738// ReplicationListResult the result of a request to list replications for a container registry. 2739type ReplicationListResult struct { 2740 autorest.Response `json:"-"` 2741 // Value - The list of replications. Since this list may be incomplete, the nextLink field should be used to request the next list of replications. 2742 Value *[]Replication `json:"value,omitempty"` 2743 // NextLink - The URI that can be used to request the next list of replications. 2744 NextLink *string `json:"nextLink,omitempty"` 2745} 2746 2747// ReplicationListResultIterator provides access to a complete listing of Replication values. 2748type ReplicationListResultIterator struct { 2749 i int 2750 page ReplicationListResultPage 2751} 2752 2753// NextWithContext advances to the next value. If there was an error making 2754// the request the iterator does not advance and the error is returned. 2755func (iter *ReplicationListResultIterator) NextWithContext(ctx context.Context) (err error) { 2756 if tracing.IsEnabled() { 2757 ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationListResultIterator.NextWithContext") 2758 defer func() { 2759 sc := -1 2760 if iter.Response().Response.Response != nil { 2761 sc = iter.Response().Response.Response.StatusCode 2762 } 2763 tracing.EndSpan(ctx, sc, err) 2764 }() 2765 } 2766 iter.i++ 2767 if iter.i < len(iter.page.Values()) { 2768 return nil 2769 } 2770 err = iter.page.NextWithContext(ctx) 2771 if err != nil { 2772 iter.i-- 2773 return err 2774 } 2775 iter.i = 0 2776 return nil 2777} 2778 2779// Next advances to the next value. If there was an error making 2780// the request the iterator does not advance and the error is returned. 2781// Deprecated: Use NextWithContext() instead. 2782func (iter *ReplicationListResultIterator) Next() error { 2783 return iter.NextWithContext(context.Background()) 2784} 2785 2786// NotDone returns true if the enumeration should be started or is not yet complete. 2787func (iter ReplicationListResultIterator) NotDone() bool { 2788 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2789} 2790 2791// Response returns the raw server response from the last page request. 2792func (iter ReplicationListResultIterator) Response() ReplicationListResult { 2793 return iter.page.Response() 2794} 2795 2796// Value returns the current value or a zero-initialized value if the 2797// iterator has advanced beyond the end of the collection. 2798func (iter ReplicationListResultIterator) Value() Replication { 2799 if !iter.page.NotDone() { 2800 return Replication{} 2801 } 2802 return iter.page.Values()[iter.i] 2803} 2804 2805// Creates a new instance of the ReplicationListResultIterator type. 2806func NewReplicationListResultIterator(page ReplicationListResultPage) ReplicationListResultIterator { 2807 return ReplicationListResultIterator{page: page} 2808} 2809 2810// IsEmpty returns true if the ListResult contains no values. 2811func (rlr ReplicationListResult) IsEmpty() bool { 2812 return rlr.Value == nil || len(*rlr.Value) == 0 2813} 2814 2815// hasNextLink returns true if the NextLink is not empty. 2816func (rlr ReplicationListResult) hasNextLink() bool { 2817 return rlr.NextLink != nil && len(*rlr.NextLink) != 0 2818} 2819 2820// replicationListResultPreparer prepares a request to retrieve the next set of results. 2821// It returns nil if no more results exist. 2822func (rlr ReplicationListResult) replicationListResultPreparer(ctx context.Context) (*http.Request, error) { 2823 if !rlr.hasNextLink() { 2824 return nil, nil 2825 } 2826 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2827 autorest.AsJSON(), 2828 autorest.AsGet(), 2829 autorest.WithBaseURL(to.String(rlr.NextLink))) 2830} 2831 2832// ReplicationListResultPage contains a page of Replication values. 2833type ReplicationListResultPage struct { 2834 fn func(context.Context, ReplicationListResult) (ReplicationListResult, error) 2835 rlr ReplicationListResult 2836} 2837 2838// NextWithContext advances to the next page of values. If there was an error making 2839// the request the page does not advance and the error is returned. 2840func (page *ReplicationListResultPage) NextWithContext(ctx context.Context) (err error) { 2841 if tracing.IsEnabled() { 2842 ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationListResultPage.NextWithContext") 2843 defer func() { 2844 sc := -1 2845 if page.Response().Response.Response != nil { 2846 sc = page.Response().Response.Response.StatusCode 2847 } 2848 tracing.EndSpan(ctx, sc, err) 2849 }() 2850 } 2851 for { 2852 next, err := page.fn(ctx, page.rlr) 2853 if err != nil { 2854 return err 2855 } 2856 page.rlr = next 2857 if !next.hasNextLink() || !next.IsEmpty() { 2858 break 2859 } 2860 } 2861 return nil 2862} 2863 2864// Next advances to the next page of values. If there was an error making 2865// the request the page does not advance and the error is returned. 2866// Deprecated: Use NextWithContext() instead. 2867func (page *ReplicationListResultPage) Next() error { 2868 return page.NextWithContext(context.Background()) 2869} 2870 2871// NotDone returns true if the page enumeration should be started or is not yet complete. 2872func (page ReplicationListResultPage) NotDone() bool { 2873 return !page.rlr.IsEmpty() 2874} 2875 2876// Response returns the raw server response from the last page request. 2877func (page ReplicationListResultPage) Response() ReplicationListResult { 2878 return page.rlr 2879} 2880 2881// Values returns the slice of values for the current page or nil if there are no values. 2882func (page ReplicationListResultPage) Values() []Replication { 2883 if page.rlr.IsEmpty() { 2884 return nil 2885 } 2886 return *page.rlr.Value 2887} 2888 2889// Creates a new instance of the ReplicationListResultPage type. 2890func NewReplicationListResultPage(cur ReplicationListResult, getNextPage func(context.Context, ReplicationListResult) (ReplicationListResult, error)) ReplicationListResultPage { 2891 return ReplicationListResultPage{ 2892 fn: getNextPage, 2893 rlr: cur, 2894 } 2895} 2896 2897// ReplicationProperties the properties of a replication. 2898type ReplicationProperties struct { 2899 // ProvisioningState - READ-ONLY; The provisioning state of the replication at the time the operation was called. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' 2900 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 2901 // Status - READ-ONLY; The status of the replication at the time the operation was called. 2902 Status *Status `json:"status,omitempty"` 2903} 2904 2905// ReplicationsCreateFuture an abstraction for monitoring and retrieving the results of a long-running 2906// operation. 2907type ReplicationsCreateFuture struct { 2908 azure.FutureAPI 2909 // Result returns the result of the asynchronous operation. 2910 // If the operation has not completed it will return an error. 2911 Result func(ReplicationsClient) (Replication, error) 2912} 2913 2914// ReplicationsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 2915// operation. 2916type ReplicationsDeleteFuture struct { 2917 azure.FutureAPI 2918 // Result returns the result of the asynchronous operation. 2919 // If the operation has not completed it will return an error. 2920 Result func(ReplicationsClient) (autorest.Response, error) 2921} 2922 2923// ReplicationsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 2924// operation. 2925type ReplicationsUpdateFuture struct { 2926 azure.FutureAPI 2927 // Result returns the result of the asynchronous operation. 2928 // If the operation has not completed it will return an error. 2929 Result func(ReplicationsClient) (Replication, error) 2930} 2931 2932// ReplicationUpdateParameters the parameters for updating a replication. 2933type ReplicationUpdateParameters struct { 2934 // Tags - The tags for the replication. 2935 Tags map[string]*string `json:"tags"` 2936} 2937 2938// MarshalJSON is the custom marshaler for ReplicationUpdateParameters. 2939func (rup ReplicationUpdateParameters) MarshalJSON() ([]byte, error) { 2940 objectMap := make(map[string]interface{}) 2941 if rup.Tags != nil { 2942 objectMap["tags"] = rup.Tags 2943 } 2944 return json.Marshal(objectMap) 2945} 2946 2947// Request the request that generated the event. 2948type Request struct { 2949 // ID - The ID of the request that initiated the event. 2950 ID *string `json:"id,omitempty"` 2951 // 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. 2952 Addr *string `json:"addr,omitempty"` 2953 // Host - The externally accessible hostname of the registry instance, as specified by the http host header on incoming requests. 2954 Host *string `json:"host,omitempty"` 2955 // Method - The request method that generated the event. 2956 Method *string `json:"method,omitempty"` 2957 // Useragent - The user agent header of the request. 2958 Useragent *string `json:"useragent,omitempty"` 2959} 2960 2961// Resource an Azure resource. 2962type Resource struct { 2963 // ID - READ-ONLY; The resource ID. 2964 ID *string `json:"id,omitempty"` 2965 // Name - READ-ONLY; The name of the resource. 2966 Name *string `json:"name,omitempty"` 2967 // Type - READ-ONLY; The type of the resource. 2968 Type *string `json:"type,omitempty"` 2969 // Location - The location of the resource. This cannot be changed after the resource is created. 2970 Location *string `json:"location,omitempty"` 2971 // Tags - The tags of the resource. 2972 Tags map[string]*string `json:"tags"` 2973 // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. 2974 SystemData *SystemData `json:"systemData,omitempty"` 2975} 2976 2977// MarshalJSON is the custom marshaler for Resource. 2978func (r Resource) MarshalJSON() ([]byte, error) { 2979 objectMap := make(map[string]interface{}) 2980 if r.Location != nil { 2981 objectMap["location"] = r.Location 2982 } 2983 if r.Tags != nil { 2984 objectMap["tags"] = r.Tags 2985 } 2986 return json.Marshal(objectMap) 2987} 2988 2989// RetentionPolicy the retention policy for a container registry. 2990type RetentionPolicy struct { 2991 // Days - The number of days to retain an untagged manifest after which it gets purged. 2992 Days *int32 `json:"days,omitempty"` 2993 // LastUpdatedTime - READ-ONLY; The timestamp when the policy was last updated. 2994 LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` 2995 // Status - The value that indicates whether the policy is enabled or not. Possible values include: 'Enabled', 'Disabled' 2996 Status PolicyStatus `json:"status,omitempty"` 2997} 2998 2999// MarshalJSON is the custom marshaler for RetentionPolicy. 3000func (rp RetentionPolicy) MarshalJSON() ([]byte, error) { 3001 objectMap := make(map[string]interface{}) 3002 if rp.Days != nil { 3003 objectMap["days"] = rp.Days 3004 } 3005 if rp.Status != "" { 3006 objectMap["status"] = rp.Status 3007 } 3008 return json.Marshal(objectMap) 3009} 3010 3011// Run run resource properties 3012type Run struct { 3013 autorest.Response `json:"-"` 3014 // RunProperties - The properties of a run. 3015 *RunProperties `json:"properties,omitempty"` 3016 // ID - READ-ONLY; The resource ID. 3017 ID *string `json:"id,omitempty"` 3018 // Name - READ-ONLY; The name of the resource. 3019 Name *string `json:"name,omitempty"` 3020 // Type - READ-ONLY; The type of the resource. 3021 Type *string `json:"type,omitempty"` 3022 // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. 3023 SystemData *SystemData `json:"systemData,omitempty"` 3024} 3025 3026// MarshalJSON is the custom marshaler for Run. 3027func (r Run) MarshalJSON() ([]byte, error) { 3028 objectMap := make(map[string]interface{}) 3029 if r.RunProperties != nil { 3030 objectMap["properties"] = r.RunProperties 3031 } 3032 return json.Marshal(objectMap) 3033} 3034 3035// UnmarshalJSON is the custom unmarshaler for Run struct. 3036func (r *Run) UnmarshalJSON(body []byte) error { 3037 var m map[string]*json.RawMessage 3038 err := json.Unmarshal(body, &m) 3039 if err != nil { 3040 return err 3041 } 3042 for k, v := range m { 3043 switch k { 3044 case "properties": 3045 if v != nil { 3046 var runProperties RunProperties 3047 err = json.Unmarshal(*v, &runProperties) 3048 if err != nil { 3049 return err 3050 } 3051 r.RunProperties = &runProperties 3052 } 3053 case "id": 3054 if v != nil { 3055 var ID string 3056 err = json.Unmarshal(*v, &ID) 3057 if err != nil { 3058 return err 3059 } 3060 r.ID = &ID 3061 } 3062 case "name": 3063 if v != nil { 3064 var name string 3065 err = json.Unmarshal(*v, &name) 3066 if err != nil { 3067 return err 3068 } 3069 r.Name = &name 3070 } 3071 case "type": 3072 if v != nil { 3073 var typeVar string 3074 err = json.Unmarshal(*v, &typeVar) 3075 if err != nil { 3076 return err 3077 } 3078 r.Type = &typeVar 3079 } 3080 case "systemData": 3081 if v != nil { 3082 var systemData SystemData 3083 err = json.Unmarshal(*v, &systemData) 3084 if err != nil { 3085 return err 3086 } 3087 r.SystemData = &systemData 3088 } 3089 } 3090 } 3091 3092 return nil 3093} 3094 3095// RunFilter properties that are enabled for Odata querying on runs. 3096type RunFilter struct { 3097 // RunID - The unique identifier for the run. 3098 RunID *string `json:"runId,omitempty"` 3099 // RunType - The type of run. Possible values include: 'QuickBuild', 'QuickRun', 'AutoBuild', 'AutoRun' 3100 RunType RunType `json:"runType,omitempty"` 3101 // Status - The current status of the run. Possible values include: 'RunStatusQueued', 'RunStatusStarted', 'RunStatusRunning', 'RunStatusSucceeded', 'RunStatusFailed', 'RunStatusCanceled', 'RunStatusError', 'RunStatusTimeout' 3102 Status RunStatus `json:"status,omitempty"` 3103 // CreateTime - The create time for a run. 3104 CreateTime *date.Time `json:"createTime,omitempty"` 3105 // FinishTime - The time the run finished. 3106 FinishTime *date.Time `json:"finishTime,omitempty"` 3107 // OutputImageManifests - The list of comma-separated image manifests that were generated from the run. This is applicable if the run is of 3108 // build type. 3109 OutputImageManifests *string `json:"outputImageManifests,omitempty"` 3110 // IsArchiveEnabled - The value that indicates whether archiving is enabled or not. 3111 IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` 3112 // TaskName - The name of the task that the run corresponds to. 3113 TaskName *string `json:"taskName,omitempty"` 3114 // AgentPoolName - The name of the agent pool that the run corresponds to. 3115 AgentPoolName *string `json:"agentPoolName,omitempty"` 3116} 3117 3118// RunGetLogResult the result of get log link operation. 3119type RunGetLogResult struct { 3120 autorest.Response `json:"-"` 3121 // LogLink - The link to logs for a run on a azure container registry. 3122 LogLink *string `json:"logLink,omitempty"` 3123 // LogArtifactLink - The link to logs in registry for a run on a azure container registry. 3124 LogArtifactLink *string `json:"logArtifactLink,omitempty"` 3125} 3126 3127// RunListResult collection of runs. 3128type RunListResult struct { 3129 autorest.Response `json:"-"` 3130 // Value - The collection value. 3131 Value *[]Run `json:"value,omitempty"` 3132 // NextLink - The URI that can be used to request the next set of paged results. 3133 NextLink *string `json:"nextLink,omitempty"` 3134} 3135 3136// RunListResultIterator provides access to a complete listing of Run values. 3137type RunListResultIterator struct { 3138 i int 3139 page RunListResultPage 3140} 3141 3142// NextWithContext advances to the next value. If there was an error making 3143// the request the iterator does not advance and the error is returned. 3144func (iter *RunListResultIterator) NextWithContext(ctx context.Context) (err error) { 3145 if tracing.IsEnabled() { 3146 ctx = tracing.StartSpan(ctx, fqdn+"/RunListResultIterator.NextWithContext") 3147 defer func() { 3148 sc := -1 3149 if iter.Response().Response.Response != nil { 3150 sc = iter.Response().Response.Response.StatusCode 3151 } 3152 tracing.EndSpan(ctx, sc, err) 3153 }() 3154 } 3155 iter.i++ 3156 if iter.i < len(iter.page.Values()) { 3157 return nil 3158 } 3159 err = iter.page.NextWithContext(ctx) 3160 if err != nil { 3161 iter.i-- 3162 return err 3163 } 3164 iter.i = 0 3165 return nil 3166} 3167 3168// Next advances to the next value. If there was an error making 3169// the request the iterator does not advance and the error is returned. 3170// Deprecated: Use NextWithContext() instead. 3171func (iter *RunListResultIterator) Next() error { 3172 return iter.NextWithContext(context.Background()) 3173} 3174 3175// NotDone returns true if the enumeration should be started or is not yet complete. 3176func (iter RunListResultIterator) NotDone() bool { 3177 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3178} 3179 3180// Response returns the raw server response from the last page request. 3181func (iter RunListResultIterator) Response() RunListResult { 3182 return iter.page.Response() 3183} 3184 3185// Value returns the current value or a zero-initialized value if the 3186// iterator has advanced beyond the end of the collection. 3187func (iter RunListResultIterator) Value() Run { 3188 if !iter.page.NotDone() { 3189 return Run{} 3190 } 3191 return iter.page.Values()[iter.i] 3192} 3193 3194// Creates a new instance of the RunListResultIterator type. 3195func NewRunListResultIterator(page RunListResultPage) RunListResultIterator { 3196 return RunListResultIterator{page: page} 3197} 3198 3199// IsEmpty returns true if the ListResult contains no values. 3200func (rlr RunListResult) IsEmpty() bool { 3201 return rlr.Value == nil || len(*rlr.Value) == 0 3202} 3203 3204// hasNextLink returns true if the NextLink is not empty. 3205func (rlr RunListResult) hasNextLink() bool { 3206 return rlr.NextLink != nil && len(*rlr.NextLink) != 0 3207} 3208 3209// runListResultPreparer prepares a request to retrieve the next set of results. 3210// It returns nil if no more results exist. 3211func (rlr RunListResult) runListResultPreparer(ctx context.Context) (*http.Request, error) { 3212 if !rlr.hasNextLink() { 3213 return nil, nil 3214 } 3215 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3216 autorest.AsJSON(), 3217 autorest.AsGet(), 3218 autorest.WithBaseURL(to.String(rlr.NextLink))) 3219} 3220 3221// RunListResultPage contains a page of Run values. 3222type RunListResultPage struct { 3223 fn func(context.Context, RunListResult) (RunListResult, error) 3224 rlr RunListResult 3225} 3226 3227// NextWithContext advances to the next page of values. If there was an error making 3228// the request the page does not advance and the error is returned. 3229func (page *RunListResultPage) NextWithContext(ctx context.Context) (err error) { 3230 if tracing.IsEnabled() { 3231 ctx = tracing.StartSpan(ctx, fqdn+"/RunListResultPage.NextWithContext") 3232 defer func() { 3233 sc := -1 3234 if page.Response().Response.Response != nil { 3235 sc = page.Response().Response.Response.StatusCode 3236 } 3237 tracing.EndSpan(ctx, sc, err) 3238 }() 3239 } 3240 for { 3241 next, err := page.fn(ctx, page.rlr) 3242 if err != nil { 3243 return err 3244 } 3245 page.rlr = next 3246 if !next.hasNextLink() || !next.IsEmpty() { 3247 break 3248 } 3249 } 3250 return nil 3251} 3252 3253// Next advances to the next page of values. If there was an error making 3254// the request the page does not advance and the error is returned. 3255// Deprecated: Use NextWithContext() instead. 3256func (page *RunListResultPage) Next() error { 3257 return page.NextWithContext(context.Background()) 3258} 3259 3260// NotDone returns true if the page enumeration should be started or is not yet complete. 3261func (page RunListResultPage) NotDone() bool { 3262 return !page.rlr.IsEmpty() 3263} 3264 3265// Response returns the raw server response from the last page request. 3266func (page RunListResultPage) Response() RunListResult { 3267 return page.rlr 3268} 3269 3270// Values returns the slice of values for the current page or nil if there are no values. 3271func (page RunListResultPage) Values() []Run { 3272 if page.rlr.IsEmpty() { 3273 return nil 3274 } 3275 return *page.rlr.Value 3276} 3277 3278// Creates a new instance of the RunListResultPage type. 3279func NewRunListResultPage(cur RunListResult, getNextPage func(context.Context, RunListResult) (RunListResult, error)) RunListResultPage { 3280 return RunListResultPage{ 3281 fn: getNextPage, 3282 rlr: cur, 3283 } 3284} 3285 3286// RunProperties the properties for a run. 3287type RunProperties struct { 3288 // RunID - The unique identifier for the run. 3289 RunID *string `json:"runId,omitempty"` 3290 // Status - The current status of the run. Possible values include: 'RunStatusQueued', 'RunStatusStarted', 'RunStatusRunning', 'RunStatusSucceeded', 'RunStatusFailed', 'RunStatusCanceled', 'RunStatusError', 'RunStatusTimeout' 3291 Status RunStatus `json:"status,omitempty"` 3292 // LastUpdatedTime - The last updated time for the run. 3293 LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` 3294 // RunType - The type of run. Possible values include: 'QuickBuild', 'QuickRun', 'AutoBuild', 'AutoRun' 3295 RunType RunType `json:"runType,omitempty"` 3296 // AgentPoolName - The dedicated agent pool for the run. 3297 AgentPoolName *string `json:"agentPoolName,omitempty"` 3298 // CreateTime - The time the run was scheduled. 3299 CreateTime *date.Time `json:"createTime,omitempty"` 3300 // StartTime - The time the run started. 3301 StartTime *date.Time `json:"startTime,omitempty"` 3302 // FinishTime - The time the run finished. 3303 FinishTime *date.Time `json:"finishTime,omitempty"` 3304 // OutputImages - The list of all images that were generated from the run. This is applicable if the run generates base image dependencies. 3305 OutputImages *[]ImageDescriptor `json:"outputImages,omitempty"` 3306 // Task - The task against which run was scheduled. 3307 Task *string `json:"task,omitempty"` 3308 // ImageUpdateTrigger - The image update trigger that caused the run. This is applicable if the task has base image trigger configured. 3309 ImageUpdateTrigger *ImageUpdateTrigger `json:"imageUpdateTrigger,omitempty"` 3310 // SourceTrigger - The source trigger that caused the run. 3311 SourceTrigger *SourceTriggerDescriptor `json:"sourceTrigger,omitempty"` 3312 // TimerTrigger - The timer trigger that caused the run. 3313 TimerTrigger *TimerTriggerDescriptor `json:"timerTrigger,omitempty"` 3314 // Platform - The platform properties against which the run will happen. 3315 Platform *PlatformProperties `json:"platform,omitempty"` 3316 // AgentConfiguration - The machine configuration of the run agent. 3317 AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` 3318 // SourceRegistryAuth - The scope of the credentials that were used to login to the source registry during this run. 3319 SourceRegistryAuth *string `json:"sourceRegistryAuth,omitempty"` 3320 // CustomRegistries - The list of custom registries that were logged in during this run. 3321 CustomRegistries *[]string `json:"customRegistries,omitempty"` 3322 // RunErrorMessage - READ-ONLY; The error message received from backend systems after the run is scheduled. 3323 RunErrorMessage *string `json:"runErrorMessage,omitempty"` 3324 // UpdateTriggerToken - The update trigger token passed for the Run. 3325 UpdateTriggerToken *string `json:"updateTriggerToken,omitempty"` 3326 // LogArtifact - READ-ONLY; The image description for the log artifact. 3327 LogArtifact *ImageDescriptor `json:"logArtifact,omitempty"` 3328 // ProvisioningState - The provisioning state of a run. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' 3329 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 3330 // IsArchiveEnabled - The value that indicates whether archiving is enabled or not. 3331 IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` 3332} 3333 3334// MarshalJSON is the custom marshaler for RunProperties. 3335func (rp RunProperties) MarshalJSON() ([]byte, error) { 3336 objectMap := make(map[string]interface{}) 3337 if rp.RunID != nil { 3338 objectMap["runId"] = rp.RunID 3339 } 3340 if rp.Status != "" { 3341 objectMap["status"] = rp.Status 3342 } 3343 if rp.LastUpdatedTime != nil { 3344 objectMap["lastUpdatedTime"] = rp.LastUpdatedTime 3345 } 3346 if rp.RunType != "" { 3347 objectMap["runType"] = rp.RunType 3348 } 3349 if rp.AgentPoolName != nil { 3350 objectMap["agentPoolName"] = rp.AgentPoolName 3351 } 3352 if rp.CreateTime != nil { 3353 objectMap["createTime"] = rp.CreateTime 3354 } 3355 if rp.StartTime != nil { 3356 objectMap["startTime"] = rp.StartTime 3357 } 3358 if rp.FinishTime != nil { 3359 objectMap["finishTime"] = rp.FinishTime 3360 } 3361 if rp.OutputImages != nil { 3362 objectMap["outputImages"] = rp.OutputImages 3363 } 3364 if rp.Task != nil { 3365 objectMap["task"] = rp.Task 3366 } 3367 if rp.ImageUpdateTrigger != nil { 3368 objectMap["imageUpdateTrigger"] = rp.ImageUpdateTrigger 3369 } 3370 if rp.SourceTrigger != nil { 3371 objectMap["sourceTrigger"] = rp.SourceTrigger 3372 } 3373 if rp.TimerTrigger != nil { 3374 objectMap["timerTrigger"] = rp.TimerTrigger 3375 } 3376 if rp.Platform != nil { 3377 objectMap["platform"] = rp.Platform 3378 } 3379 if rp.AgentConfiguration != nil { 3380 objectMap["agentConfiguration"] = rp.AgentConfiguration 3381 } 3382 if rp.SourceRegistryAuth != nil { 3383 objectMap["sourceRegistryAuth"] = rp.SourceRegistryAuth 3384 } 3385 if rp.CustomRegistries != nil { 3386 objectMap["customRegistries"] = rp.CustomRegistries 3387 } 3388 if rp.UpdateTriggerToken != nil { 3389 objectMap["updateTriggerToken"] = rp.UpdateTriggerToken 3390 } 3391 if rp.ProvisioningState != "" { 3392 objectMap["provisioningState"] = rp.ProvisioningState 3393 } 3394 if rp.IsArchiveEnabled != nil { 3395 objectMap["isArchiveEnabled"] = rp.IsArchiveEnabled 3396 } 3397 return json.Marshal(objectMap) 3398} 3399 3400// BasicRunRequest the request parameters for scheduling a run. 3401type BasicRunRequest interface { 3402 AsDockerBuildRequest() (*DockerBuildRequest, bool) 3403 AsFileTaskRunRequest() (*FileTaskRunRequest, bool) 3404 AsTaskRunRequest() (*TaskRunRequest, bool) 3405 AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) 3406 AsRunRequest() (*RunRequest, bool) 3407} 3408 3409// RunRequest the request parameters for scheduling a run. 3410type RunRequest struct { 3411 // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. 3412 IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` 3413 // AgentPoolName - The dedicated agent pool for the run. 3414 AgentPoolName *string `json:"agentPoolName,omitempty"` 3415 // LogTemplate - The template that describes the repository and tag information for run log artifact. 3416 LogTemplate *string `json:"logTemplate,omitempty"` 3417 // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' 3418 Type Type `json:"type,omitempty"` 3419} 3420 3421func unmarshalBasicRunRequest(body []byte) (BasicRunRequest, error) { 3422 var m map[string]interface{} 3423 err := json.Unmarshal(body, &m) 3424 if err != nil { 3425 return nil, err 3426 } 3427 3428 switch m["type"] { 3429 case string(TypeDockerBuildRequest): 3430 var dbr DockerBuildRequest 3431 err := json.Unmarshal(body, &dbr) 3432 return dbr, err 3433 case string(TypeFileTaskRunRequest): 3434 var ftrr FileTaskRunRequest 3435 err := json.Unmarshal(body, &ftrr) 3436 return ftrr, err 3437 case string(TypeTaskRunRequest): 3438 var trr TaskRunRequest 3439 err := json.Unmarshal(body, &trr) 3440 return trr, err 3441 case string(TypeEncodedTaskRunRequest): 3442 var etrr EncodedTaskRunRequest 3443 err := json.Unmarshal(body, &etrr) 3444 return etrr, err 3445 default: 3446 var rr RunRequest 3447 err := json.Unmarshal(body, &rr) 3448 return rr, err 3449 } 3450} 3451func unmarshalBasicRunRequestArray(body []byte) ([]BasicRunRequest, error) { 3452 var rawMessages []*json.RawMessage 3453 err := json.Unmarshal(body, &rawMessages) 3454 if err != nil { 3455 return nil, err 3456 } 3457 3458 rrArray := make([]BasicRunRequest, len(rawMessages)) 3459 3460 for index, rawMessage := range rawMessages { 3461 rr, err := unmarshalBasicRunRequest(*rawMessage) 3462 if err != nil { 3463 return nil, err 3464 } 3465 rrArray[index] = rr 3466 } 3467 return rrArray, nil 3468} 3469 3470// MarshalJSON is the custom marshaler for RunRequest. 3471func (rr RunRequest) MarshalJSON() ([]byte, error) { 3472 rr.Type = TypeRunRequest 3473 objectMap := make(map[string]interface{}) 3474 if rr.IsArchiveEnabled != nil { 3475 objectMap["isArchiveEnabled"] = rr.IsArchiveEnabled 3476 } 3477 if rr.AgentPoolName != nil { 3478 objectMap["agentPoolName"] = rr.AgentPoolName 3479 } 3480 if rr.LogTemplate != nil { 3481 objectMap["logTemplate"] = rr.LogTemplate 3482 } 3483 if rr.Type != "" { 3484 objectMap["type"] = rr.Type 3485 } 3486 return json.Marshal(objectMap) 3487} 3488 3489// AsDockerBuildRequest is the BasicRunRequest implementation for RunRequest. 3490func (rr RunRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { 3491 return nil, false 3492} 3493 3494// AsFileTaskRunRequest is the BasicRunRequest implementation for RunRequest. 3495func (rr RunRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { 3496 return nil, false 3497} 3498 3499// AsTaskRunRequest is the BasicRunRequest implementation for RunRequest. 3500func (rr RunRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { 3501 return nil, false 3502} 3503 3504// AsEncodedTaskRunRequest is the BasicRunRequest implementation for RunRequest. 3505func (rr RunRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { 3506 return nil, false 3507} 3508 3509// AsRunRequest is the BasicRunRequest implementation for RunRequest. 3510func (rr RunRequest) AsRunRequest() (*RunRequest, bool) { 3511 return &rr, true 3512} 3513 3514// AsBasicRunRequest is the BasicRunRequest implementation for RunRequest. 3515func (rr RunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { 3516 return &rr, true 3517} 3518 3519// RunsCancelFuture an abstraction for monitoring and retrieving the results of a long-running operation. 3520type RunsCancelFuture struct { 3521 azure.FutureAPI 3522 // Result returns the result of the asynchronous operation. 3523 // If the operation has not completed it will return an error. 3524 Result func(RunsClient) (autorest.Response, error) 3525} 3526 3527// RunsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 3528type RunsUpdateFuture struct { 3529 azure.FutureAPI 3530 // Result returns the result of the asynchronous operation. 3531 // If the operation has not completed it will return an error. 3532 Result func(RunsClient) (Run, error) 3533} 3534 3535// RunUpdateParameters the set of run properties that can be updated. 3536type RunUpdateParameters struct { 3537 // IsArchiveEnabled - The value that indicates whether archiving is enabled or not. 3538 IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` 3539} 3540 3541// ScopeMap an object that represents a scope map for a container registry. 3542type ScopeMap struct { 3543 autorest.Response `json:"-"` 3544 // ScopeMapProperties - The properties of the scope map. 3545 *ScopeMapProperties `json:"properties,omitempty"` 3546 // ID - READ-ONLY; The resource ID. 3547 ID *string `json:"id,omitempty"` 3548 // Name - READ-ONLY; The name of the resource. 3549 Name *string `json:"name,omitempty"` 3550 // Type - READ-ONLY; The type of the resource. 3551 Type *string `json:"type,omitempty"` 3552 // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. 3553 SystemData *SystemData `json:"systemData,omitempty"` 3554} 3555 3556// MarshalJSON is the custom marshaler for ScopeMap. 3557func (sm ScopeMap) MarshalJSON() ([]byte, error) { 3558 objectMap := make(map[string]interface{}) 3559 if sm.ScopeMapProperties != nil { 3560 objectMap["properties"] = sm.ScopeMapProperties 3561 } 3562 return json.Marshal(objectMap) 3563} 3564 3565// UnmarshalJSON is the custom unmarshaler for ScopeMap struct. 3566func (sm *ScopeMap) UnmarshalJSON(body []byte) error { 3567 var m map[string]*json.RawMessage 3568 err := json.Unmarshal(body, &m) 3569 if err != nil { 3570 return err 3571 } 3572 for k, v := range m { 3573 switch k { 3574 case "properties": 3575 if v != nil { 3576 var scopeMapProperties ScopeMapProperties 3577 err = json.Unmarshal(*v, &scopeMapProperties) 3578 if err != nil { 3579 return err 3580 } 3581 sm.ScopeMapProperties = &scopeMapProperties 3582 } 3583 case "id": 3584 if v != nil { 3585 var ID string 3586 err = json.Unmarshal(*v, &ID) 3587 if err != nil { 3588 return err 3589 } 3590 sm.ID = &ID 3591 } 3592 case "name": 3593 if v != nil { 3594 var name string 3595 err = json.Unmarshal(*v, &name) 3596 if err != nil { 3597 return err 3598 } 3599 sm.Name = &name 3600 } 3601 case "type": 3602 if v != nil { 3603 var typeVar string 3604 err = json.Unmarshal(*v, &typeVar) 3605 if err != nil { 3606 return err 3607 } 3608 sm.Type = &typeVar 3609 } 3610 case "systemData": 3611 if v != nil { 3612 var systemData SystemData 3613 err = json.Unmarshal(*v, &systemData) 3614 if err != nil { 3615 return err 3616 } 3617 sm.SystemData = &systemData 3618 } 3619 } 3620 } 3621 3622 return nil 3623} 3624 3625// ScopeMapListResult the result of a request to list scope maps for a container registry. 3626type ScopeMapListResult struct { 3627 autorest.Response `json:"-"` 3628 // Value - The list of scope maps. Since this list may be incomplete, the nextLink field should be used to request the next list of scope maps. 3629 Value *[]ScopeMap `json:"value,omitempty"` 3630 // NextLink - The URI that can be used to request the next list of scope maps. 3631 NextLink *string `json:"nextLink,omitempty"` 3632} 3633 3634// ScopeMapListResultIterator provides access to a complete listing of ScopeMap values. 3635type ScopeMapListResultIterator struct { 3636 i int 3637 page ScopeMapListResultPage 3638} 3639 3640// NextWithContext advances to the next value. If there was an error making 3641// the request the iterator does not advance and the error is returned. 3642func (iter *ScopeMapListResultIterator) NextWithContext(ctx context.Context) (err error) { 3643 if tracing.IsEnabled() { 3644 ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapListResultIterator.NextWithContext") 3645 defer func() { 3646 sc := -1 3647 if iter.Response().Response.Response != nil { 3648 sc = iter.Response().Response.Response.StatusCode 3649 } 3650 tracing.EndSpan(ctx, sc, err) 3651 }() 3652 } 3653 iter.i++ 3654 if iter.i < len(iter.page.Values()) { 3655 return nil 3656 } 3657 err = iter.page.NextWithContext(ctx) 3658 if err != nil { 3659 iter.i-- 3660 return err 3661 } 3662 iter.i = 0 3663 return nil 3664} 3665 3666// Next advances to the next value. If there was an error making 3667// the request the iterator does not advance and the error is returned. 3668// Deprecated: Use NextWithContext() instead. 3669func (iter *ScopeMapListResultIterator) Next() error { 3670 return iter.NextWithContext(context.Background()) 3671} 3672 3673// NotDone returns true if the enumeration should be started or is not yet complete. 3674func (iter ScopeMapListResultIterator) NotDone() bool { 3675 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3676} 3677 3678// Response returns the raw server response from the last page request. 3679func (iter ScopeMapListResultIterator) Response() ScopeMapListResult { 3680 return iter.page.Response() 3681} 3682 3683// Value returns the current value or a zero-initialized value if the 3684// iterator has advanced beyond the end of the collection. 3685func (iter ScopeMapListResultIterator) Value() ScopeMap { 3686 if !iter.page.NotDone() { 3687 return ScopeMap{} 3688 } 3689 return iter.page.Values()[iter.i] 3690} 3691 3692// Creates a new instance of the ScopeMapListResultIterator type. 3693func NewScopeMapListResultIterator(page ScopeMapListResultPage) ScopeMapListResultIterator { 3694 return ScopeMapListResultIterator{page: page} 3695} 3696 3697// IsEmpty returns true if the ListResult contains no values. 3698func (smlr ScopeMapListResult) IsEmpty() bool { 3699 return smlr.Value == nil || len(*smlr.Value) == 0 3700} 3701 3702// hasNextLink returns true if the NextLink is not empty. 3703func (smlr ScopeMapListResult) hasNextLink() bool { 3704 return smlr.NextLink != nil && len(*smlr.NextLink) != 0 3705} 3706 3707// scopeMapListResultPreparer prepares a request to retrieve the next set of results. 3708// It returns nil if no more results exist. 3709func (smlr ScopeMapListResult) scopeMapListResultPreparer(ctx context.Context) (*http.Request, error) { 3710 if !smlr.hasNextLink() { 3711 return nil, nil 3712 } 3713 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3714 autorest.AsJSON(), 3715 autorest.AsGet(), 3716 autorest.WithBaseURL(to.String(smlr.NextLink))) 3717} 3718 3719// ScopeMapListResultPage contains a page of ScopeMap values. 3720type ScopeMapListResultPage struct { 3721 fn func(context.Context, ScopeMapListResult) (ScopeMapListResult, error) 3722 smlr ScopeMapListResult 3723} 3724 3725// NextWithContext advances to the next page of values. If there was an error making 3726// the request the page does not advance and the error is returned. 3727func (page *ScopeMapListResultPage) NextWithContext(ctx context.Context) (err error) { 3728 if tracing.IsEnabled() { 3729 ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapListResultPage.NextWithContext") 3730 defer func() { 3731 sc := -1 3732 if page.Response().Response.Response != nil { 3733 sc = page.Response().Response.Response.StatusCode 3734 } 3735 tracing.EndSpan(ctx, sc, err) 3736 }() 3737 } 3738 for { 3739 next, err := page.fn(ctx, page.smlr) 3740 if err != nil { 3741 return err 3742 } 3743 page.smlr = next 3744 if !next.hasNextLink() || !next.IsEmpty() { 3745 break 3746 } 3747 } 3748 return nil 3749} 3750 3751// Next advances to the next page of values. If there was an error making 3752// the request the page does not advance and the error is returned. 3753// Deprecated: Use NextWithContext() instead. 3754func (page *ScopeMapListResultPage) Next() error { 3755 return page.NextWithContext(context.Background()) 3756} 3757 3758// NotDone returns true if the page enumeration should be started or is not yet complete. 3759func (page ScopeMapListResultPage) NotDone() bool { 3760 return !page.smlr.IsEmpty() 3761} 3762 3763// Response returns the raw server response from the last page request. 3764func (page ScopeMapListResultPage) Response() ScopeMapListResult { 3765 return page.smlr 3766} 3767 3768// Values returns the slice of values for the current page or nil if there are no values. 3769func (page ScopeMapListResultPage) Values() []ScopeMap { 3770 if page.smlr.IsEmpty() { 3771 return nil 3772 } 3773 return *page.smlr.Value 3774} 3775 3776// Creates a new instance of the ScopeMapListResultPage type. 3777func NewScopeMapListResultPage(cur ScopeMapListResult, getNextPage func(context.Context, ScopeMapListResult) (ScopeMapListResult, error)) ScopeMapListResultPage { 3778 return ScopeMapListResultPage{ 3779 fn: getNextPage, 3780 smlr: cur, 3781 } 3782} 3783 3784// ScopeMapProperties the properties of a scope map. 3785type ScopeMapProperties struct { 3786 // Description - The user friendly description of the scope map. 3787 Description *string `json:"description,omitempty"` 3788 // Type - READ-ONLY; The type of the scope map. E.g. BuildIn scope map. 3789 Type *string `json:"type,omitempty"` 3790 // CreationDate - READ-ONLY; The creation date of scope map. 3791 CreationDate *date.Time `json:"creationDate,omitempty"` 3792 // ProvisioningState - READ-ONLY; Provisioning state of the resource. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' 3793 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 3794 // Actions - The list of scoped permissions for registry artifacts. 3795 // E.g. repositories/repository-name/content/read, 3796 // repositories/repository-name/metadata/write 3797 Actions *[]string `json:"actions,omitempty"` 3798} 3799 3800// MarshalJSON is the custom marshaler for ScopeMapProperties. 3801func (smp ScopeMapProperties) MarshalJSON() ([]byte, error) { 3802 objectMap := make(map[string]interface{}) 3803 if smp.Description != nil { 3804 objectMap["description"] = smp.Description 3805 } 3806 if smp.Actions != nil { 3807 objectMap["actions"] = smp.Actions 3808 } 3809 return json.Marshal(objectMap) 3810} 3811 3812// ScopeMapPropertiesUpdateParameters the update parameters for scope map properties. 3813type ScopeMapPropertiesUpdateParameters struct { 3814 // Description - The user friendly description of the scope map. 3815 Description *string `json:"description,omitempty"` 3816 // Actions - The list of scope permissions for registry artifacts. 3817 // E.g. repositories/repository-name/pull, 3818 // repositories/repository-name/delete 3819 Actions *[]string `json:"actions,omitempty"` 3820} 3821 3822// ScopeMapsCreateFuture an abstraction for monitoring and retrieving the results of a long-running 3823// operation. 3824type ScopeMapsCreateFuture struct { 3825 azure.FutureAPI 3826 // Result returns the result of the asynchronous operation. 3827 // If the operation has not completed it will return an error. 3828 Result func(ScopeMapsClient) (ScopeMap, error) 3829} 3830 3831// ScopeMapsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 3832// operation. 3833type ScopeMapsDeleteFuture struct { 3834 azure.FutureAPI 3835 // Result returns the result of the asynchronous operation. 3836 // If the operation has not completed it will return an error. 3837 Result func(ScopeMapsClient) (autorest.Response, error) 3838} 3839 3840// ScopeMapsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 3841// operation. 3842type ScopeMapsUpdateFuture struct { 3843 azure.FutureAPI 3844 // Result returns the result of the asynchronous operation. 3845 // If the operation has not completed it will return an error. 3846 Result func(ScopeMapsClient) (ScopeMap, error) 3847} 3848 3849// ScopeMapUpdateParameters the properties for updating the scope map. 3850type ScopeMapUpdateParameters struct { 3851 // ScopeMapPropertiesUpdateParameters - The update parameters for scope map properties. 3852 *ScopeMapPropertiesUpdateParameters `json:"properties,omitempty"` 3853} 3854 3855// MarshalJSON is the custom marshaler for ScopeMapUpdateParameters. 3856func (smup ScopeMapUpdateParameters) MarshalJSON() ([]byte, error) { 3857 objectMap := make(map[string]interface{}) 3858 if smup.ScopeMapPropertiesUpdateParameters != nil { 3859 objectMap["properties"] = smup.ScopeMapPropertiesUpdateParameters 3860 } 3861 return json.Marshal(objectMap) 3862} 3863 3864// UnmarshalJSON is the custom unmarshaler for ScopeMapUpdateParameters struct. 3865func (smup *ScopeMapUpdateParameters) UnmarshalJSON(body []byte) error { 3866 var m map[string]*json.RawMessage 3867 err := json.Unmarshal(body, &m) 3868 if err != nil { 3869 return err 3870 } 3871 for k, v := range m { 3872 switch k { 3873 case "properties": 3874 if v != nil { 3875 var scopeMapPropertiesUpdateParameters ScopeMapPropertiesUpdateParameters 3876 err = json.Unmarshal(*v, &scopeMapPropertiesUpdateParameters) 3877 if err != nil { 3878 return err 3879 } 3880 smup.ScopeMapPropertiesUpdateParameters = &scopeMapPropertiesUpdateParameters 3881 } 3882 } 3883 } 3884 3885 return nil 3886} 3887 3888// SecretObject describes the properties of a secret object value. 3889type SecretObject struct { 3890 // Value - The value of the secret. The format of this value will be determined 3891 // based on the type of the secret object. If the type is Opaque, the value will be 3892 // used as is without any modification. 3893 Value *string `json:"value,omitempty"` 3894 // Type - The type of the secret object which determines how the value of the secret object has to be 3895 // interpreted. Possible values include: 'Opaque', 'Vaultsecret' 3896 Type SecretObjectType `json:"type,omitempty"` 3897} 3898 3899// SetValue the properties of a overridable value that can be passed to a task template. 3900type SetValue struct { 3901 // Name - The name of the overridable value. 3902 Name *string `json:"name,omitempty"` 3903 // Value - The overridable value. 3904 Value *string `json:"value,omitempty"` 3905 // IsSecret - Flag to indicate whether the value represents a secret or not. 3906 IsSecret *bool `json:"isSecret,omitempty"` 3907} 3908 3909// Sku the SKU of a container registry. 3910type Sku struct { 3911 // Name - The SKU name of the container registry. Required for registry creation. Possible values include: 'Classic', 'Basic', 'Standard', 'Premium' 3912 Name SkuName `json:"name,omitempty"` 3913 // Tier - READ-ONLY; The SKU tier based on the SKU name. Possible values include: 'SkuTierClassic', 'SkuTierBasic', 'SkuTierStandard', 'SkuTierPremium' 3914 Tier SkuTier `json:"tier,omitempty"` 3915} 3916 3917// MarshalJSON is the custom marshaler for Sku. 3918func (s Sku) MarshalJSON() ([]byte, error) { 3919 objectMap := make(map[string]interface{}) 3920 if s.Name != "" { 3921 objectMap["name"] = s.Name 3922 } 3923 return json.Marshal(objectMap) 3924} 3925 3926// Source the registry node that generated the event. Put differently, while the actor initiates the event, 3927// the source generates it. 3928type Source struct { 3929 // 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. 3930 Addr *string `json:"addr,omitempty"` 3931 // InstanceID - The running instance of an application. Changes after each restart. 3932 InstanceID *string `json:"instanceID,omitempty"` 3933} 3934 3935// SourceProperties the properties of the source code repository. 3936type SourceProperties struct { 3937 // SourceControlType - The type of source control service. Possible values include: 'Github', 'VisualStudioTeamService' 3938 SourceControlType SourceControlType `json:"sourceControlType,omitempty"` 3939 // RepositoryURL - The full URL to the source code repository 3940 RepositoryURL *string `json:"repositoryUrl,omitempty"` 3941 // Branch - The branch name of the source code. 3942 Branch *string `json:"branch,omitempty"` 3943 // SourceControlAuthProperties - The authorization properties for accessing the source code repository and to set up 3944 // webhooks for notifications. 3945 SourceControlAuthProperties *AuthInfo `json:"sourceControlAuthProperties,omitempty"` 3946} 3947 3948// SourceRegistryCredentials describes the credential parameters for accessing the source registry. 3949type SourceRegistryCredentials struct { 3950 // LoginMode - The authentication mode which determines the source registry login scope. The credentials for the source registry 3951 // will be generated using the given scope. These credentials will be used to login to 3952 // the source registry during the run. Possible values include: 'SourceRegistryLoginModeNone', 'SourceRegistryLoginModeDefault' 3953 LoginMode SourceRegistryLoginMode `json:"loginMode,omitempty"` 3954} 3955 3956// SourceTrigger the properties of a source based trigger. 3957type SourceTrigger struct { 3958 // SourceRepository - The properties that describes the source(code) for the task. 3959 SourceRepository *SourceProperties `json:"sourceRepository,omitempty"` 3960 // SourceTriggerEvents - The source event corresponding to the trigger. 3961 SourceTriggerEvents *[]SourceTriggerEvent `json:"sourceTriggerEvents,omitempty"` 3962 // Status - The current status of trigger. Possible values include: 'TriggerStatusDisabled', 'TriggerStatusEnabled' 3963 Status TriggerStatus `json:"status,omitempty"` 3964 // Name - The name of the trigger. 3965 Name *string `json:"name,omitempty"` 3966} 3967 3968// SourceTriggerDescriptor the source trigger that caused a run. 3969type SourceTriggerDescriptor struct { 3970 // ID - The unique ID of the trigger. 3971 ID *string `json:"id,omitempty"` 3972 // EventType - The event type of the trigger. 3973 EventType *string `json:"eventType,omitempty"` 3974 // CommitID - The unique ID that identifies a commit. 3975 CommitID *string `json:"commitId,omitempty"` 3976 // PullRequestID - The unique ID that identifies pull request. 3977 PullRequestID *string `json:"pullRequestId,omitempty"` 3978 // RepositoryURL - The repository URL. 3979 RepositoryURL *string `json:"repositoryUrl,omitempty"` 3980 // BranchName - The branch name in the repository. 3981 BranchName *string `json:"branchName,omitempty"` 3982 // ProviderType - The source control provider type. 3983 ProviderType *string `json:"providerType,omitempty"` 3984} 3985 3986// SourceTriggerUpdateParameters the properties for updating a source based trigger. 3987type SourceTriggerUpdateParameters struct { 3988 // SourceRepository - The properties that describes the source(code) for the task. 3989 SourceRepository *SourceUpdateParameters `json:"sourceRepository,omitempty"` 3990 // SourceTriggerEvents - The source event corresponding to the trigger. 3991 SourceTriggerEvents *[]SourceTriggerEvent `json:"sourceTriggerEvents,omitempty"` 3992 // Status - The current status of trigger. Possible values include: 'TriggerStatusDisabled', 'TriggerStatusEnabled' 3993 Status TriggerStatus `json:"status,omitempty"` 3994 // Name - The name of the trigger. 3995 Name *string `json:"name,omitempty"` 3996} 3997 3998// SourceUpdateParameters the properties for updating the source code repository. 3999type SourceUpdateParameters struct { 4000 // SourceControlType - The type of source control service. Possible values include: 'Github', 'VisualStudioTeamService' 4001 SourceControlType SourceControlType `json:"sourceControlType,omitempty"` 4002 // RepositoryURL - The full URL to the source code repository 4003 RepositoryURL *string `json:"repositoryUrl,omitempty"` 4004 // Branch - The branch name of the source code. 4005 Branch *string `json:"branch,omitempty"` 4006 // SourceControlAuthProperties - The authorization properties for accessing the source code repository and to set up 4007 // webhooks for notifications. 4008 SourceControlAuthProperties *AuthInfoUpdateParameters `json:"sourceControlAuthProperties,omitempty"` 4009} 4010 4011// SourceUploadDefinition the properties of a response to source upload request. 4012type SourceUploadDefinition struct { 4013 autorest.Response `json:"-"` 4014 // UploadURL - The URL where the client can upload the source. 4015 UploadURL *string `json:"uploadUrl,omitempty"` 4016 // RelativePath - The relative path to the source. This is used to submit the subsequent queue build request. 4017 RelativePath *string `json:"relativePath,omitempty"` 4018} 4019 4020// Status the status of an Azure resource at the time the operation was called. 4021type Status struct { 4022 // DisplayStatus - READ-ONLY; The short label for the status. 4023 DisplayStatus *string `json:"displayStatus,omitempty"` 4024 // Message - READ-ONLY; The detailed message for the status, including alerts and error messages. 4025 Message *string `json:"message,omitempty"` 4026 // Timestamp - READ-ONLY; The timestamp when the status was changed to the current value. 4027 Timestamp *date.Time `json:"timestamp,omitempty"` 4028} 4029 4030// StorageAccountProperties the properties of a storage account for a container registry. Only applicable 4031// to Classic SKU. 4032type StorageAccountProperties struct { 4033 // ID - The resource ID of the storage account. 4034 ID *string `json:"id,omitempty"` 4035} 4036 4037// SystemData metadata pertaining to creation and last modification of the resource. 4038type SystemData struct { 4039 // CreatedBy - The identity that created the resource. 4040 CreatedBy *string `json:"createdBy,omitempty"` 4041 // CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' 4042 CreatedByType CreatedByType `json:"createdByType,omitempty"` 4043 // CreatedAt - The timestamp of resource creation (UTC). 4044 CreatedAt *date.Time `json:"createdAt,omitempty"` 4045 // LastModifiedBy - The identity that last modified the resource. 4046 LastModifiedBy *string `json:"lastModifiedBy,omitempty"` 4047 // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'LastModifiedByTypeUser', 'LastModifiedByTypeApplication', 'LastModifiedByTypeManagedIdentity', 'LastModifiedByTypeKey' 4048 LastModifiedByType LastModifiedByType `json:"lastModifiedByType,omitempty"` 4049 // LastModifiedAt - The timestamp of resource modification (UTC). 4050 LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` 4051} 4052 4053// Target the target of the event. 4054type Target struct { 4055 // MediaType - The MIME type of the referenced object. 4056 MediaType *string `json:"mediaType,omitempty"` 4057 // Size - The number of bytes of the content. Same as Length field. 4058 Size *int64 `json:"size,omitempty"` 4059 // Digest - The digest of the content, as defined by the Registry V2 HTTP API Specification. 4060 Digest *string `json:"digest,omitempty"` 4061 // Length - The number of bytes of the content. Same as Size field. 4062 Length *int64 `json:"length,omitempty"` 4063 // Repository - The repository name. 4064 Repository *string `json:"repository,omitempty"` 4065 // URL - The direct URL to the content. 4066 URL *string `json:"url,omitempty"` 4067 // Tag - The tag name. 4068 Tag *string `json:"tag,omitempty"` 4069 // Name - The name of the artifact. 4070 Name *string `json:"name,omitempty"` 4071 // Version - The version of the artifact. 4072 Version *string `json:"version,omitempty"` 4073} 4074 4075// Task the task that has the ARM resource and task properties. 4076// The task will have all information to schedule a run against it. 4077type Task struct { 4078 autorest.Response `json:"-"` 4079 // Identity - Identity for the resource. 4080 Identity *IdentityProperties `json:"identity,omitempty"` 4081 // TaskProperties - The properties of a task. 4082 *TaskProperties `json:"properties,omitempty"` 4083 // ID - READ-ONLY; The resource ID. 4084 ID *string `json:"id,omitempty"` 4085 // Name - READ-ONLY; The name of the resource. 4086 Name *string `json:"name,omitempty"` 4087 // Type - READ-ONLY; The type of the resource. 4088 Type *string `json:"type,omitempty"` 4089 // Location - The location of the resource. This cannot be changed after the resource is created. 4090 Location *string `json:"location,omitempty"` 4091 // Tags - The tags of the resource. 4092 Tags map[string]*string `json:"tags"` 4093 // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. 4094 SystemData *SystemData `json:"systemData,omitempty"` 4095} 4096 4097// MarshalJSON is the custom marshaler for Task. 4098func (t Task) MarshalJSON() ([]byte, error) { 4099 objectMap := make(map[string]interface{}) 4100 if t.Identity != nil { 4101 objectMap["identity"] = t.Identity 4102 } 4103 if t.TaskProperties != nil { 4104 objectMap["properties"] = t.TaskProperties 4105 } 4106 if t.Location != nil { 4107 objectMap["location"] = t.Location 4108 } 4109 if t.Tags != nil { 4110 objectMap["tags"] = t.Tags 4111 } 4112 return json.Marshal(objectMap) 4113} 4114 4115// UnmarshalJSON is the custom unmarshaler for Task struct. 4116func (t *Task) UnmarshalJSON(body []byte) error { 4117 var m map[string]*json.RawMessage 4118 err := json.Unmarshal(body, &m) 4119 if err != nil { 4120 return err 4121 } 4122 for k, v := range m { 4123 switch k { 4124 case "identity": 4125 if v != nil { 4126 var identity IdentityProperties 4127 err = json.Unmarshal(*v, &identity) 4128 if err != nil { 4129 return err 4130 } 4131 t.Identity = &identity 4132 } 4133 case "properties": 4134 if v != nil { 4135 var taskProperties TaskProperties 4136 err = json.Unmarshal(*v, &taskProperties) 4137 if err != nil { 4138 return err 4139 } 4140 t.TaskProperties = &taskProperties 4141 } 4142 case "id": 4143 if v != nil { 4144 var ID string 4145 err = json.Unmarshal(*v, &ID) 4146 if err != nil { 4147 return err 4148 } 4149 t.ID = &ID 4150 } 4151 case "name": 4152 if v != nil { 4153 var name string 4154 err = json.Unmarshal(*v, &name) 4155 if err != nil { 4156 return err 4157 } 4158 t.Name = &name 4159 } 4160 case "type": 4161 if v != nil { 4162 var typeVar string 4163 err = json.Unmarshal(*v, &typeVar) 4164 if err != nil { 4165 return err 4166 } 4167 t.Type = &typeVar 4168 } 4169 case "location": 4170 if v != nil { 4171 var location string 4172 err = json.Unmarshal(*v, &location) 4173 if err != nil { 4174 return err 4175 } 4176 t.Location = &location 4177 } 4178 case "tags": 4179 if v != nil { 4180 var tags map[string]*string 4181 err = json.Unmarshal(*v, &tags) 4182 if err != nil { 4183 return err 4184 } 4185 t.Tags = tags 4186 } 4187 case "systemData": 4188 if v != nil { 4189 var systemData SystemData 4190 err = json.Unmarshal(*v, &systemData) 4191 if err != nil { 4192 return err 4193 } 4194 t.SystemData = &systemData 4195 } 4196 } 4197 } 4198 4199 return nil 4200} 4201 4202// TaskListResult the collection of tasks. 4203type TaskListResult struct { 4204 autorest.Response `json:"-"` 4205 // Value - The collection value. 4206 Value *[]Task `json:"value,omitempty"` 4207 // NextLink - The URI that can be used to request the next set of paged results. 4208 NextLink *string `json:"nextLink,omitempty"` 4209} 4210 4211// TaskListResultIterator provides access to a complete listing of Task values. 4212type TaskListResultIterator struct { 4213 i int 4214 page TaskListResultPage 4215} 4216 4217// NextWithContext advances to the next value. If there was an error making 4218// the request the iterator does not advance and the error is returned. 4219func (iter *TaskListResultIterator) NextWithContext(ctx context.Context) (err error) { 4220 if tracing.IsEnabled() { 4221 ctx = tracing.StartSpan(ctx, fqdn+"/TaskListResultIterator.NextWithContext") 4222 defer func() { 4223 sc := -1 4224 if iter.Response().Response.Response != nil { 4225 sc = iter.Response().Response.Response.StatusCode 4226 } 4227 tracing.EndSpan(ctx, sc, err) 4228 }() 4229 } 4230 iter.i++ 4231 if iter.i < len(iter.page.Values()) { 4232 return nil 4233 } 4234 err = iter.page.NextWithContext(ctx) 4235 if err != nil { 4236 iter.i-- 4237 return err 4238 } 4239 iter.i = 0 4240 return nil 4241} 4242 4243// Next advances to the next value. If there was an error making 4244// the request the iterator does not advance and the error is returned. 4245// Deprecated: Use NextWithContext() instead. 4246func (iter *TaskListResultIterator) Next() error { 4247 return iter.NextWithContext(context.Background()) 4248} 4249 4250// NotDone returns true if the enumeration should be started or is not yet complete. 4251func (iter TaskListResultIterator) NotDone() bool { 4252 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 4253} 4254 4255// Response returns the raw server response from the last page request. 4256func (iter TaskListResultIterator) Response() TaskListResult { 4257 return iter.page.Response() 4258} 4259 4260// Value returns the current value or a zero-initialized value if the 4261// iterator has advanced beyond the end of the collection. 4262func (iter TaskListResultIterator) Value() Task { 4263 if !iter.page.NotDone() { 4264 return Task{} 4265 } 4266 return iter.page.Values()[iter.i] 4267} 4268 4269// Creates a new instance of the TaskListResultIterator type. 4270func NewTaskListResultIterator(page TaskListResultPage) TaskListResultIterator { 4271 return TaskListResultIterator{page: page} 4272} 4273 4274// IsEmpty returns true if the ListResult contains no values. 4275func (tlr TaskListResult) IsEmpty() bool { 4276 return tlr.Value == nil || len(*tlr.Value) == 0 4277} 4278 4279// hasNextLink returns true if the NextLink is not empty. 4280func (tlr TaskListResult) hasNextLink() bool { 4281 return tlr.NextLink != nil && len(*tlr.NextLink) != 0 4282} 4283 4284// taskListResultPreparer prepares a request to retrieve the next set of results. 4285// It returns nil if no more results exist. 4286func (tlr TaskListResult) taskListResultPreparer(ctx context.Context) (*http.Request, error) { 4287 if !tlr.hasNextLink() { 4288 return nil, nil 4289 } 4290 return autorest.Prepare((&http.Request{}).WithContext(ctx), 4291 autorest.AsJSON(), 4292 autorest.AsGet(), 4293 autorest.WithBaseURL(to.String(tlr.NextLink))) 4294} 4295 4296// TaskListResultPage contains a page of Task values. 4297type TaskListResultPage struct { 4298 fn func(context.Context, TaskListResult) (TaskListResult, error) 4299 tlr TaskListResult 4300} 4301 4302// NextWithContext advances to the next page of values. If there was an error making 4303// the request the page does not advance and the error is returned. 4304func (page *TaskListResultPage) NextWithContext(ctx context.Context) (err error) { 4305 if tracing.IsEnabled() { 4306 ctx = tracing.StartSpan(ctx, fqdn+"/TaskListResultPage.NextWithContext") 4307 defer func() { 4308 sc := -1 4309 if page.Response().Response.Response != nil { 4310 sc = page.Response().Response.Response.StatusCode 4311 } 4312 tracing.EndSpan(ctx, sc, err) 4313 }() 4314 } 4315 for { 4316 next, err := page.fn(ctx, page.tlr) 4317 if err != nil { 4318 return err 4319 } 4320 page.tlr = next 4321 if !next.hasNextLink() || !next.IsEmpty() { 4322 break 4323 } 4324 } 4325 return nil 4326} 4327 4328// Next advances to the next page of values. If there was an error making 4329// the request the page does not advance and the error is returned. 4330// Deprecated: Use NextWithContext() instead. 4331func (page *TaskListResultPage) Next() error { 4332 return page.NextWithContext(context.Background()) 4333} 4334 4335// NotDone returns true if the page enumeration should be started or is not yet complete. 4336func (page TaskListResultPage) NotDone() bool { 4337 return !page.tlr.IsEmpty() 4338} 4339 4340// Response returns the raw server response from the last page request. 4341func (page TaskListResultPage) Response() TaskListResult { 4342 return page.tlr 4343} 4344 4345// Values returns the slice of values for the current page or nil if there are no values. 4346func (page TaskListResultPage) Values() []Task { 4347 if page.tlr.IsEmpty() { 4348 return nil 4349 } 4350 return *page.tlr.Value 4351} 4352 4353// Creates a new instance of the TaskListResultPage type. 4354func NewTaskListResultPage(cur TaskListResult, getNextPage func(context.Context, TaskListResult) (TaskListResult, error)) TaskListResultPage { 4355 return TaskListResultPage{ 4356 fn: getNextPage, 4357 tlr: cur, 4358 } 4359} 4360 4361// TaskProperties the properties of a task. 4362type TaskProperties struct { 4363 // ProvisioningState - READ-ONLY; The provisioning state of the task. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' 4364 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 4365 // CreationDate - READ-ONLY; The creation date of task. 4366 CreationDate *date.Time `json:"creationDate,omitempty"` 4367 // Status - The current status of task. Possible values include: 'TaskStatusDisabled', 'TaskStatusEnabled' 4368 Status TaskStatus `json:"status,omitempty"` 4369 // Platform - The platform properties against which the run has to happen. 4370 Platform *PlatformProperties `json:"platform,omitempty"` 4371 // AgentConfiguration - The machine configuration of the run agent. 4372 AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` 4373 // AgentPoolName - The dedicated agent pool for the task. 4374 AgentPoolName *string `json:"agentPoolName,omitempty"` 4375 // Timeout - Run timeout in seconds. 4376 Timeout *int32 `json:"timeout,omitempty"` 4377 // Step - The properties of a task step. 4378 Step BasicTaskStepProperties `json:"step,omitempty"` 4379 // Trigger - The properties that describe all triggers for the task. 4380 Trigger *TriggerProperties `json:"trigger,omitempty"` 4381 // Credentials - The properties that describes a set of credentials that will be used when this run is invoked. 4382 Credentials *Credentials `json:"credentials,omitempty"` 4383 // LogTemplate - The template that describes the repository and tag information for run log artifact. 4384 LogTemplate *string `json:"logTemplate,omitempty"` 4385 // IsSystemTask - The value of this property indicates whether the task resource is system task or not. 4386 IsSystemTask *bool `json:"isSystemTask,omitempty"` 4387} 4388 4389// MarshalJSON is the custom marshaler for TaskProperties. 4390func (tp TaskProperties) MarshalJSON() ([]byte, error) { 4391 objectMap := make(map[string]interface{}) 4392 if tp.Status != "" { 4393 objectMap["status"] = tp.Status 4394 } 4395 if tp.Platform != nil { 4396 objectMap["platform"] = tp.Platform 4397 } 4398 if tp.AgentConfiguration != nil { 4399 objectMap["agentConfiguration"] = tp.AgentConfiguration 4400 } 4401 if tp.AgentPoolName != nil { 4402 objectMap["agentPoolName"] = tp.AgentPoolName 4403 } 4404 if tp.Timeout != nil { 4405 objectMap["timeout"] = tp.Timeout 4406 } 4407 objectMap["step"] = tp.Step 4408 if tp.Trigger != nil { 4409 objectMap["trigger"] = tp.Trigger 4410 } 4411 if tp.Credentials != nil { 4412 objectMap["credentials"] = tp.Credentials 4413 } 4414 if tp.LogTemplate != nil { 4415 objectMap["logTemplate"] = tp.LogTemplate 4416 } 4417 if tp.IsSystemTask != nil { 4418 objectMap["isSystemTask"] = tp.IsSystemTask 4419 } 4420 return json.Marshal(objectMap) 4421} 4422 4423// UnmarshalJSON is the custom unmarshaler for TaskProperties struct. 4424func (tp *TaskProperties) UnmarshalJSON(body []byte) error { 4425 var m map[string]*json.RawMessage 4426 err := json.Unmarshal(body, &m) 4427 if err != nil { 4428 return err 4429 } 4430 for k, v := range m { 4431 switch k { 4432 case "provisioningState": 4433 if v != nil { 4434 var provisioningState ProvisioningState 4435 err = json.Unmarshal(*v, &provisioningState) 4436 if err != nil { 4437 return err 4438 } 4439 tp.ProvisioningState = provisioningState 4440 } 4441 case "creationDate": 4442 if v != nil { 4443 var creationDate date.Time 4444 err = json.Unmarshal(*v, &creationDate) 4445 if err != nil { 4446 return err 4447 } 4448 tp.CreationDate = &creationDate 4449 } 4450 case "status": 4451 if v != nil { 4452 var status TaskStatus 4453 err = json.Unmarshal(*v, &status) 4454 if err != nil { 4455 return err 4456 } 4457 tp.Status = status 4458 } 4459 case "platform": 4460 if v != nil { 4461 var platform PlatformProperties 4462 err = json.Unmarshal(*v, &platform) 4463 if err != nil { 4464 return err 4465 } 4466 tp.Platform = &platform 4467 } 4468 case "agentConfiguration": 4469 if v != nil { 4470 var agentConfiguration AgentProperties 4471 err = json.Unmarshal(*v, &agentConfiguration) 4472 if err != nil { 4473 return err 4474 } 4475 tp.AgentConfiguration = &agentConfiguration 4476 } 4477 case "agentPoolName": 4478 if v != nil { 4479 var agentPoolName string 4480 err = json.Unmarshal(*v, &agentPoolName) 4481 if err != nil { 4482 return err 4483 } 4484 tp.AgentPoolName = &agentPoolName 4485 } 4486 case "timeout": 4487 if v != nil { 4488 var timeout int32 4489 err = json.Unmarshal(*v, &timeout) 4490 if err != nil { 4491 return err 4492 } 4493 tp.Timeout = &timeout 4494 } 4495 case "step": 4496 if v != nil { 4497 step, err := unmarshalBasicTaskStepProperties(*v) 4498 if err != nil { 4499 return err 4500 } 4501 tp.Step = step 4502 } 4503 case "trigger": 4504 if v != nil { 4505 var trigger TriggerProperties 4506 err = json.Unmarshal(*v, &trigger) 4507 if err != nil { 4508 return err 4509 } 4510 tp.Trigger = &trigger 4511 } 4512 case "credentials": 4513 if v != nil { 4514 var credentials Credentials 4515 err = json.Unmarshal(*v, &credentials) 4516 if err != nil { 4517 return err 4518 } 4519 tp.Credentials = &credentials 4520 } 4521 case "logTemplate": 4522 if v != nil { 4523 var logTemplate string 4524 err = json.Unmarshal(*v, &logTemplate) 4525 if err != nil { 4526 return err 4527 } 4528 tp.LogTemplate = &logTemplate 4529 } 4530 case "isSystemTask": 4531 if v != nil { 4532 var isSystemTask bool 4533 err = json.Unmarshal(*v, &isSystemTask) 4534 if err != nil { 4535 return err 4536 } 4537 tp.IsSystemTask = &isSystemTask 4538 } 4539 } 4540 } 4541 4542 return nil 4543} 4544 4545// TaskPropertiesUpdateParameters the properties for updating a task. 4546type TaskPropertiesUpdateParameters struct { 4547 // Status - The current status of task. Possible values include: 'TaskStatusDisabled', 'TaskStatusEnabled' 4548 Status TaskStatus `json:"status,omitempty"` 4549 // Platform - The platform properties against which the run has to happen. 4550 Platform *PlatformUpdateParameters `json:"platform,omitempty"` 4551 // AgentConfiguration - The machine configuration of the run agent. 4552 AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` 4553 // AgentPoolName - The dedicated agent pool for the task. 4554 AgentPoolName *string `json:"agentPoolName,omitempty"` 4555 // Timeout - Run timeout in seconds. 4556 Timeout *int32 `json:"timeout,omitempty"` 4557 // Step - The properties for updating a task step. 4558 Step BasicTaskStepUpdateParameters `json:"step,omitempty"` 4559 // Trigger - The properties for updating trigger properties. 4560 Trigger *TriggerUpdateParameters `json:"trigger,omitempty"` 4561 // Credentials - The parameters that describes a set of credentials that will be used when this run is invoked. 4562 Credentials *Credentials `json:"credentials,omitempty"` 4563 // LogTemplate - The template that describes the repository and tag information for run log artifact. 4564 LogTemplate *string `json:"logTemplate,omitempty"` 4565} 4566 4567// UnmarshalJSON is the custom unmarshaler for TaskPropertiesUpdateParameters struct. 4568func (tpup *TaskPropertiesUpdateParameters) UnmarshalJSON(body []byte) error { 4569 var m map[string]*json.RawMessage 4570 err := json.Unmarshal(body, &m) 4571 if err != nil { 4572 return err 4573 } 4574 for k, v := range m { 4575 switch k { 4576 case "status": 4577 if v != nil { 4578 var status TaskStatus 4579 err = json.Unmarshal(*v, &status) 4580 if err != nil { 4581 return err 4582 } 4583 tpup.Status = status 4584 } 4585 case "platform": 4586 if v != nil { 4587 var platform PlatformUpdateParameters 4588 err = json.Unmarshal(*v, &platform) 4589 if err != nil { 4590 return err 4591 } 4592 tpup.Platform = &platform 4593 } 4594 case "agentConfiguration": 4595 if v != nil { 4596 var agentConfiguration AgentProperties 4597 err = json.Unmarshal(*v, &agentConfiguration) 4598 if err != nil { 4599 return err 4600 } 4601 tpup.AgentConfiguration = &agentConfiguration 4602 } 4603 case "agentPoolName": 4604 if v != nil { 4605 var agentPoolName string 4606 err = json.Unmarshal(*v, &agentPoolName) 4607 if err != nil { 4608 return err 4609 } 4610 tpup.AgentPoolName = &agentPoolName 4611 } 4612 case "timeout": 4613 if v != nil { 4614 var timeout int32 4615 err = json.Unmarshal(*v, &timeout) 4616 if err != nil { 4617 return err 4618 } 4619 tpup.Timeout = &timeout 4620 } 4621 case "step": 4622 if v != nil { 4623 step, err := unmarshalBasicTaskStepUpdateParameters(*v) 4624 if err != nil { 4625 return err 4626 } 4627 tpup.Step = step 4628 } 4629 case "trigger": 4630 if v != nil { 4631 var trigger TriggerUpdateParameters 4632 err = json.Unmarshal(*v, &trigger) 4633 if err != nil { 4634 return err 4635 } 4636 tpup.Trigger = &trigger 4637 } 4638 case "credentials": 4639 if v != nil { 4640 var credentials Credentials 4641 err = json.Unmarshal(*v, &credentials) 4642 if err != nil { 4643 return err 4644 } 4645 tpup.Credentials = &credentials 4646 } 4647 case "logTemplate": 4648 if v != nil { 4649 var logTemplate string 4650 err = json.Unmarshal(*v, &logTemplate) 4651 if err != nil { 4652 return err 4653 } 4654 tpup.LogTemplate = &logTemplate 4655 } 4656 } 4657 } 4658 4659 return nil 4660} 4661 4662// TaskRun the task run that has the ARM resource and properties. 4663// The task run will have the information of request and result of a run. 4664type TaskRun struct { 4665 autorest.Response `json:"-"` 4666 // Identity - Identity for the resource. 4667 Identity *IdentityProperties `json:"identity,omitempty"` 4668 // TaskRunProperties - The properties associated with the task run, i.e., request and result of the run 4669 *TaskRunProperties `json:"properties,omitempty"` 4670 // Location - The location of the resource 4671 Location *string `json:"location,omitempty"` 4672 // ID - READ-ONLY; The resource ID. 4673 ID *string `json:"id,omitempty"` 4674 // Name - READ-ONLY; The name of the resource. 4675 Name *string `json:"name,omitempty"` 4676 // Type - READ-ONLY; The type of the resource. 4677 Type *string `json:"type,omitempty"` 4678 // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. 4679 SystemData *SystemData `json:"systemData,omitempty"` 4680} 4681 4682// MarshalJSON is the custom marshaler for TaskRun. 4683func (tr TaskRun) MarshalJSON() ([]byte, error) { 4684 objectMap := make(map[string]interface{}) 4685 if tr.Identity != nil { 4686 objectMap["identity"] = tr.Identity 4687 } 4688 if tr.TaskRunProperties != nil { 4689 objectMap["properties"] = tr.TaskRunProperties 4690 } 4691 if tr.Location != nil { 4692 objectMap["location"] = tr.Location 4693 } 4694 return json.Marshal(objectMap) 4695} 4696 4697// UnmarshalJSON is the custom unmarshaler for TaskRun struct. 4698func (tr *TaskRun) UnmarshalJSON(body []byte) error { 4699 var m map[string]*json.RawMessage 4700 err := json.Unmarshal(body, &m) 4701 if err != nil { 4702 return err 4703 } 4704 for k, v := range m { 4705 switch k { 4706 case "identity": 4707 if v != nil { 4708 var identity IdentityProperties 4709 err = json.Unmarshal(*v, &identity) 4710 if err != nil { 4711 return err 4712 } 4713 tr.Identity = &identity 4714 } 4715 case "properties": 4716 if v != nil { 4717 var taskRunProperties TaskRunProperties 4718 err = json.Unmarshal(*v, &taskRunProperties) 4719 if err != nil { 4720 return err 4721 } 4722 tr.TaskRunProperties = &taskRunProperties 4723 } 4724 case "location": 4725 if v != nil { 4726 var location string 4727 err = json.Unmarshal(*v, &location) 4728 if err != nil { 4729 return err 4730 } 4731 tr.Location = &location 4732 } 4733 case "id": 4734 if v != nil { 4735 var ID string 4736 err = json.Unmarshal(*v, &ID) 4737 if err != nil { 4738 return err 4739 } 4740 tr.ID = &ID 4741 } 4742 case "name": 4743 if v != nil { 4744 var name string 4745 err = json.Unmarshal(*v, &name) 4746 if err != nil { 4747 return err 4748 } 4749 tr.Name = &name 4750 } 4751 case "type": 4752 if v != nil { 4753 var typeVar string 4754 err = json.Unmarshal(*v, &typeVar) 4755 if err != nil { 4756 return err 4757 } 4758 tr.Type = &typeVar 4759 } 4760 case "systemData": 4761 if v != nil { 4762 var systemData SystemData 4763 err = json.Unmarshal(*v, &systemData) 4764 if err != nil { 4765 return err 4766 } 4767 tr.SystemData = &systemData 4768 } 4769 } 4770 } 4771 4772 return nil 4773} 4774 4775// TaskRunListResult the collection of task runs. 4776type TaskRunListResult struct { 4777 autorest.Response `json:"-"` 4778 // Value - The collection value. 4779 Value *[]TaskRun `json:"value,omitempty"` 4780 // NextLink - The URI that can be used to request the next set of paged results. 4781 NextLink *string `json:"nextLink,omitempty"` 4782} 4783 4784// TaskRunListResultIterator provides access to a complete listing of TaskRun values. 4785type TaskRunListResultIterator struct { 4786 i int 4787 page TaskRunListResultPage 4788} 4789 4790// NextWithContext advances to the next value. If there was an error making 4791// the request the iterator does not advance and the error is returned. 4792func (iter *TaskRunListResultIterator) NextWithContext(ctx context.Context) (err error) { 4793 if tracing.IsEnabled() { 4794 ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunListResultIterator.NextWithContext") 4795 defer func() { 4796 sc := -1 4797 if iter.Response().Response.Response != nil { 4798 sc = iter.Response().Response.Response.StatusCode 4799 } 4800 tracing.EndSpan(ctx, sc, err) 4801 }() 4802 } 4803 iter.i++ 4804 if iter.i < len(iter.page.Values()) { 4805 return nil 4806 } 4807 err = iter.page.NextWithContext(ctx) 4808 if err != nil { 4809 iter.i-- 4810 return err 4811 } 4812 iter.i = 0 4813 return nil 4814} 4815 4816// Next advances to the next value. If there was an error making 4817// the request the iterator does not advance and the error is returned. 4818// Deprecated: Use NextWithContext() instead. 4819func (iter *TaskRunListResultIterator) Next() error { 4820 return iter.NextWithContext(context.Background()) 4821} 4822 4823// NotDone returns true if the enumeration should be started or is not yet complete. 4824func (iter TaskRunListResultIterator) NotDone() bool { 4825 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 4826} 4827 4828// Response returns the raw server response from the last page request. 4829func (iter TaskRunListResultIterator) Response() TaskRunListResult { 4830 return iter.page.Response() 4831} 4832 4833// Value returns the current value or a zero-initialized value if the 4834// iterator has advanced beyond the end of the collection. 4835func (iter TaskRunListResultIterator) Value() TaskRun { 4836 if !iter.page.NotDone() { 4837 return TaskRun{} 4838 } 4839 return iter.page.Values()[iter.i] 4840} 4841 4842// Creates a new instance of the TaskRunListResultIterator type. 4843func NewTaskRunListResultIterator(page TaskRunListResultPage) TaskRunListResultIterator { 4844 return TaskRunListResultIterator{page: page} 4845} 4846 4847// IsEmpty returns true if the ListResult contains no values. 4848func (trlr TaskRunListResult) IsEmpty() bool { 4849 return trlr.Value == nil || len(*trlr.Value) == 0 4850} 4851 4852// hasNextLink returns true if the NextLink is not empty. 4853func (trlr TaskRunListResult) hasNextLink() bool { 4854 return trlr.NextLink != nil && len(*trlr.NextLink) != 0 4855} 4856 4857// taskRunListResultPreparer prepares a request to retrieve the next set of results. 4858// It returns nil if no more results exist. 4859func (trlr TaskRunListResult) taskRunListResultPreparer(ctx context.Context) (*http.Request, error) { 4860 if !trlr.hasNextLink() { 4861 return nil, nil 4862 } 4863 return autorest.Prepare((&http.Request{}).WithContext(ctx), 4864 autorest.AsJSON(), 4865 autorest.AsGet(), 4866 autorest.WithBaseURL(to.String(trlr.NextLink))) 4867} 4868 4869// TaskRunListResultPage contains a page of TaskRun values. 4870type TaskRunListResultPage struct { 4871 fn func(context.Context, TaskRunListResult) (TaskRunListResult, error) 4872 trlr TaskRunListResult 4873} 4874 4875// NextWithContext advances to the next page of values. If there was an error making 4876// the request the page does not advance and the error is returned. 4877func (page *TaskRunListResultPage) NextWithContext(ctx context.Context) (err error) { 4878 if tracing.IsEnabled() { 4879 ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunListResultPage.NextWithContext") 4880 defer func() { 4881 sc := -1 4882 if page.Response().Response.Response != nil { 4883 sc = page.Response().Response.Response.StatusCode 4884 } 4885 tracing.EndSpan(ctx, sc, err) 4886 }() 4887 } 4888 for { 4889 next, err := page.fn(ctx, page.trlr) 4890 if err != nil { 4891 return err 4892 } 4893 page.trlr = next 4894 if !next.hasNextLink() || !next.IsEmpty() { 4895 break 4896 } 4897 } 4898 return nil 4899} 4900 4901// Next advances to the next page of values. If there was an error making 4902// the request the page does not advance and the error is returned. 4903// Deprecated: Use NextWithContext() instead. 4904func (page *TaskRunListResultPage) Next() error { 4905 return page.NextWithContext(context.Background()) 4906} 4907 4908// NotDone returns true if the page enumeration should be started or is not yet complete. 4909func (page TaskRunListResultPage) NotDone() bool { 4910 return !page.trlr.IsEmpty() 4911} 4912 4913// Response returns the raw server response from the last page request. 4914func (page TaskRunListResultPage) Response() TaskRunListResult { 4915 return page.trlr 4916} 4917 4918// Values returns the slice of values for the current page or nil if there are no values. 4919func (page TaskRunListResultPage) Values() []TaskRun { 4920 if page.trlr.IsEmpty() { 4921 return nil 4922 } 4923 return *page.trlr.Value 4924} 4925 4926// Creates a new instance of the TaskRunListResultPage type. 4927func NewTaskRunListResultPage(cur TaskRunListResult, getNextPage func(context.Context, TaskRunListResult) (TaskRunListResult, error)) TaskRunListResultPage { 4928 return TaskRunListResultPage{ 4929 fn: getNextPage, 4930 trlr: cur, 4931 } 4932} 4933 4934// TaskRunProperties the properties of task run. 4935type TaskRunProperties struct { 4936 // ProvisioningState - READ-ONLY; The provisioning state of this task run. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' 4937 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 4938 // RunRequest - The request (parameters) for the run 4939 RunRequest BasicRunRequest `json:"runRequest,omitempty"` 4940 // RunResult - READ-ONLY; The result of this task run 4941 RunResult *Run `json:"runResult,omitempty"` 4942 // ForceUpdateTag - How the run should be forced to rerun even if the run request configuration has not changed 4943 ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` 4944} 4945 4946// MarshalJSON is the custom marshaler for TaskRunProperties. 4947func (trp TaskRunProperties) MarshalJSON() ([]byte, error) { 4948 objectMap := make(map[string]interface{}) 4949 objectMap["runRequest"] = trp.RunRequest 4950 if trp.ForceUpdateTag != nil { 4951 objectMap["forceUpdateTag"] = trp.ForceUpdateTag 4952 } 4953 return json.Marshal(objectMap) 4954} 4955 4956// UnmarshalJSON is the custom unmarshaler for TaskRunProperties struct. 4957func (trp *TaskRunProperties) UnmarshalJSON(body []byte) error { 4958 var m map[string]*json.RawMessage 4959 err := json.Unmarshal(body, &m) 4960 if err != nil { 4961 return err 4962 } 4963 for k, v := range m { 4964 switch k { 4965 case "provisioningState": 4966 if v != nil { 4967 var provisioningState ProvisioningState 4968 err = json.Unmarshal(*v, &provisioningState) 4969 if err != nil { 4970 return err 4971 } 4972 trp.ProvisioningState = provisioningState 4973 } 4974 case "runRequest": 4975 if v != nil { 4976 runRequest, err := unmarshalBasicRunRequest(*v) 4977 if err != nil { 4978 return err 4979 } 4980 trp.RunRequest = runRequest 4981 } 4982 case "runResult": 4983 if v != nil { 4984 var runResult Run 4985 err = json.Unmarshal(*v, &runResult) 4986 if err != nil { 4987 return err 4988 } 4989 trp.RunResult = &runResult 4990 } 4991 case "forceUpdateTag": 4992 if v != nil { 4993 var forceUpdateTag string 4994 err = json.Unmarshal(*v, &forceUpdateTag) 4995 if err != nil { 4996 return err 4997 } 4998 trp.ForceUpdateTag = &forceUpdateTag 4999 } 5000 } 5001 } 5002 5003 return nil 5004} 5005 5006// TaskRunPropertiesUpdateParameters the properties of a task run update parameters. 5007type TaskRunPropertiesUpdateParameters struct { 5008 // RunRequest - The request (parameters) for the new run 5009 RunRequest BasicRunRequest `json:"runRequest,omitempty"` 5010 // ForceUpdateTag - How the run should be forced to rerun even if the run request configuration has not changed 5011 ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` 5012} 5013 5014// UnmarshalJSON is the custom unmarshaler for TaskRunPropertiesUpdateParameters struct. 5015func (trpup *TaskRunPropertiesUpdateParameters) UnmarshalJSON(body []byte) error { 5016 var m map[string]*json.RawMessage 5017 err := json.Unmarshal(body, &m) 5018 if err != nil { 5019 return err 5020 } 5021 for k, v := range m { 5022 switch k { 5023 case "runRequest": 5024 if v != nil { 5025 runRequest, err := unmarshalBasicRunRequest(*v) 5026 if err != nil { 5027 return err 5028 } 5029 trpup.RunRequest = runRequest 5030 } 5031 case "forceUpdateTag": 5032 if v != nil { 5033 var forceUpdateTag string 5034 err = json.Unmarshal(*v, &forceUpdateTag) 5035 if err != nil { 5036 return err 5037 } 5038 trpup.ForceUpdateTag = &forceUpdateTag 5039 } 5040 } 5041 } 5042 5043 return nil 5044} 5045 5046// TaskRunRequest the parameters for a task run request. 5047type TaskRunRequest struct { 5048 // TaskID - The resource ID of task against which run has to be queued. 5049 TaskID *string `json:"taskId,omitempty"` 5050 // OverrideTaskStepProperties - Set of overridable parameters that can be passed when running a Task. 5051 OverrideTaskStepProperties *OverrideTaskStepProperties `json:"overrideTaskStepProperties,omitempty"` 5052 // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. 5053 IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` 5054 // AgentPoolName - The dedicated agent pool for the run. 5055 AgentPoolName *string `json:"agentPoolName,omitempty"` 5056 // LogTemplate - The template that describes the repository and tag information for run log artifact. 5057 LogTemplate *string `json:"logTemplate,omitempty"` 5058 // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' 5059 Type Type `json:"type,omitempty"` 5060} 5061 5062// MarshalJSON is the custom marshaler for TaskRunRequest. 5063func (trr TaskRunRequest) MarshalJSON() ([]byte, error) { 5064 trr.Type = TypeTaskRunRequest 5065 objectMap := make(map[string]interface{}) 5066 if trr.TaskID != nil { 5067 objectMap["taskId"] = trr.TaskID 5068 } 5069 if trr.OverrideTaskStepProperties != nil { 5070 objectMap["overrideTaskStepProperties"] = trr.OverrideTaskStepProperties 5071 } 5072 if trr.IsArchiveEnabled != nil { 5073 objectMap["isArchiveEnabled"] = trr.IsArchiveEnabled 5074 } 5075 if trr.AgentPoolName != nil { 5076 objectMap["agentPoolName"] = trr.AgentPoolName 5077 } 5078 if trr.LogTemplate != nil { 5079 objectMap["logTemplate"] = trr.LogTemplate 5080 } 5081 if trr.Type != "" { 5082 objectMap["type"] = trr.Type 5083 } 5084 return json.Marshal(objectMap) 5085} 5086 5087// AsDockerBuildRequest is the BasicRunRequest implementation for TaskRunRequest. 5088func (trr TaskRunRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { 5089 return nil, false 5090} 5091 5092// AsFileTaskRunRequest is the BasicRunRequest implementation for TaskRunRequest. 5093func (trr TaskRunRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { 5094 return nil, false 5095} 5096 5097// AsTaskRunRequest is the BasicRunRequest implementation for TaskRunRequest. 5098func (trr TaskRunRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { 5099 return &trr, true 5100} 5101 5102// AsEncodedTaskRunRequest is the BasicRunRequest implementation for TaskRunRequest. 5103func (trr TaskRunRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { 5104 return nil, false 5105} 5106 5107// AsRunRequest is the BasicRunRequest implementation for TaskRunRequest. 5108func (trr TaskRunRequest) AsRunRequest() (*RunRequest, bool) { 5109 return nil, false 5110} 5111 5112// AsBasicRunRequest is the BasicRunRequest implementation for TaskRunRequest. 5113func (trr TaskRunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { 5114 return &trr, true 5115} 5116 5117// TaskRunsCreateFuture an abstraction for monitoring and retrieving the results of a long-running 5118// operation. 5119type TaskRunsCreateFuture struct { 5120 azure.FutureAPI 5121 // Result returns the result of the asynchronous operation. 5122 // If the operation has not completed it will return an error. 5123 Result func(TaskRunsClient) (TaskRun, error) 5124} 5125 5126// TaskRunsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 5127// operation. 5128type TaskRunsDeleteFuture struct { 5129 azure.FutureAPI 5130 // Result returns the result of the asynchronous operation. 5131 // If the operation has not completed it will return an error. 5132 Result func(TaskRunsClient) (autorest.Response, error) 5133} 5134 5135// TaskRunsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 5136// operation. 5137type TaskRunsUpdateFuture struct { 5138 azure.FutureAPI 5139 // Result returns the result of the asynchronous operation. 5140 // If the operation has not completed it will return an error. 5141 Result func(TaskRunsClient) (TaskRun, error) 5142} 5143 5144// TaskRunUpdateParameters the parameters for updating a task run. 5145type TaskRunUpdateParameters struct { 5146 // Identity - Identity for the resource. 5147 Identity *IdentityProperties `json:"identity,omitempty"` 5148 // TaskRunPropertiesUpdateParameters - The properties for updating a task run. 5149 *TaskRunPropertiesUpdateParameters `json:"properties,omitempty"` 5150 // Location - The location of the resource 5151 Location *string `json:"location,omitempty"` 5152 // Tags - The ARM resource tags. 5153 Tags map[string]*string `json:"tags"` 5154} 5155 5156// MarshalJSON is the custom marshaler for TaskRunUpdateParameters. 5157func (trup TaskRunUpdateParameters) MarshalJSON() ([]byte, error) { 5158 objectMap := make(map[string]interface{}) 5159 if trup.Identity != nil { 5160 objectMap["identity"] = trup.Identity 5161 } 5162 if trup.TaskRunPropertiesUpdateParameters != nil { 5163 objectMap["properties"] = trup.TaskRunPropertiesUpdateParameters 5164 } 5165 if trup.Location != nil { 5166 objectMap["location"] = trup.Location 5167 } 5168 if trup.Tags != nil { 5169 objectMap["tags"] = trup.Tags 5170 } 5171 return json.Marshal(objectMap) 5172} 5173 5174// UnmarshalJSON is the custom unmarshaler for TaskRunUpdateParameters struct. 5175func (trup *TaskRunUpdateParameters) UnmarshalJSON(body []byte) error { 5176 var m map[string]*json.RawMessage 5177 err := json.Unmarshal(body, &m) 5178 if err != nil { 5179 return err 5180 } 5181 for k, v := range m { 5182 switch k { 5183 case "identity": 5184 if v != nil { 5185 var identity IdentityProperties 5186 err = json.Unmarshal(*v, &identity) 5187 if err != nil { 5188 return err 5189 } 5190 trup.Identity = &identity 5191 } 5192 case "properties": 5193 if v != nil { 5194 var taskRunPropertiesUpdateParameters TaskRunPropertiesUpdateParameters 5195 err = json.Unmarshal(*v, &taskRunPropertiesUpdateParameters) 5196 if err != nil { 5197 return err 5198 } 5199 trup.TaskRunPropertiesUpdateParameters = &taskRunPropertiesUpdateParameters 5200 } 5201 case "location": 5202 if v != nil { 5203 var location string 5204 err = json.Unmarshal(*v, &location) 5205 if err != nil { 5206 return err 5207 } 5208 trup.Location = &location 5209 } 5210 case "tags": 5211 if v != nil { 5212 var tags map[string]*string 5213 err = json.Unmarshal(*v, &tags) 5214 if err != nil { 5215 return err 5216 } 5217 trup.Tags = tags 5218 } 5219 } 5220 } 5221 5222 return nil 5223} 5224 5225// TasksCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 5226type TasksCreateFuture struct { 5227 azure.FutureAPI 5228 // Result returns the result of the asynchronous operation. 5229 // If the operation has not completed it will return an error. 5230 Result func(TasksClient) (Task, error) 5231} 5232 5233// TasksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. 5234type TasksDeleteFuture struct { 5235 azure.FutureAPI 5236 // Result returns the result of the asynchronous operation. 5237 // If the operation has not completed it will return an error. 5238 Result func(TasksClient) (autorest.Response, error) 5239} 5240 5241// BasicTaskStepProperties base properties for any task step. 5242type BasicTaskStepProperties interface { 5243 AsDockerBuildStep() (*DockerBuildStep, bool) 5244 AsFileTaskStep() (*FileTaskStep, bool) 5245 AsEncodedTaskStep() (*EncodedTaskStep, bool) 5246 AsTaskStepProperties() (*TaskStepProperties, bool) 5247} 5248 5249// TaskStepProperties base properties for any task step. 5250type TaskStepProperties struct { 5251 // BaseImageDependencies - READ-ONLY; List of base image dependencies for a step. 5252 BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` 5253 // ContextPath - The URL(absolute or relative) of the source context for the task step. 5254 ContextPath *string `json:"contextPath,omitempty"` 5255 // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. 5256 ContextAccessToken *string `json:"contextAccessToken,omitempty"` 5257 // Type - Possible values include: 'TypeTaskStepProperties', 'TypeDocker', 'TypeFileTask', 'TypeEncodedTask' 5258 Type TypeBasicTaskStepProperties `json:"type,omitempty"` 5259} 5260 5261func unmarshalBasicTaskStepProperties(body []byte) (BasicTaskStepProperties, error) { 5262 var m map[string]interface{} 5263 err := json.Unmarshal(body, &m) 5264 if err != nil { 5265 return nil, err 5266 } 5267 5268 switch m["type"] { 5269 case string(TypeDocker): 5270 var dbs DockerBuildStep 5271 err := json.Unmarshal(body, &dbs) 5272 return dbs, err 5273 case string(TypeFileTask): 5274 var fts FileTaskStep 5275 err := json.Unmarshal(body, &fts) 5276 return fts, err 5277 case string(TypeEncodedTask): 5278 var ets EncodedTaskStep 5279 err := json.Unmarshal(body, &ets) 5280 return ets, err 5281 default: 5282 var tsp TaskStepProperties 5283 err := json.Unmarshal(body, &tsp) 5284 return tsp, err 5285 } 5286} 5287func unmarshalBasicTaskStepPropertiesArray(body []byte) ([]BasicTaskStepProperties, error) { 5288 var rawMessages []*json.RawMessage 5289 err := json.Unmarshal(body, &rawMessages) 5290 if err != nil { 5291 return nil, err 5292 } 5293 5294 tspArray := make([]BasicTaskStepProperties, len(rawMessages)) 5295 5296 for index, rawMessage := range rawMessages { 5297 tsp, err := unmarshalBasicTaskStepProperties(*rawMessage) 5298 if err != nil { 5299 return nil, err 5300 } 5301 tspArray[index] = tsp 5302 } 5303 return tspArray, nil 5304} 5305 5306// MarshalJSON is the custom marshaler for TaskStepProperties. 5307func (tsp TaskStepProperties) MarshalJSON() ([]byte, error) { 5308 tsp.Type = TypeTaskStepProperties 5309 objectMap := make(map[string]interface{}) 5310 if tsp.ContextPath != nil { 5311 objectMap["contextPath"] = tsp.ContextPath 5312 } 5313 if tsp.ContextAccessToken != nil { 5314 objectMap["contextAccessToken"] = tsp.ContextAccessToken 5315 } 5316 if tsp.Type != "" { 5317 objectMap["type"] = tsp.Type 5318 } 5319 return json.Marshal(objectMap) 5320} 5321 5322// AsDockerBuildStep is the BasicTaskStepProperties implementation for TaskStepProperties. 5323func (tsp TaskStepProperties) AsDockerBuildStep() (*DockerBuildStep, bool) { 5324 return nil, false 5325} 5326 5327// AsFileTaskStep is the BasicTaskStepProperties implementation for TaskStepProperties. 5328func (tsp TaskStepProperties) AsFileTaskStep() (*FileTaskStep, bool) { 5329 return nil, false 5330} 5331 5332// AsEncodedTaskStep is the BasicTaskStepProperties implementation for TaskStepProperties. 5333func (tsp TaskStepProperties) AsEncodedTaskStep() (*EncodedTaskStep, bool) { 5334 return nil, false 5335} 5336 5337// AsTaskStepProperties is the BasicTaskStepProperties implementation for TaskStepProperties. 5338func (tsp TaskStepProperties) AsTaskStepProperties() (*TaskStepProperties, bool) { 5339 return &tsp, true 5340} 5341 5342// AsBasicTaskStepProperties is the BasicTaskStepProperties implementation for TaskStepProperties. 5343func (tsp TaskStepProperties) AsBasicTaskStepProperties() (BasicTaskStepProperties, bool) { 5344 return &tsp, true 5345} 5346 5347// BasicTaskStepUpdateParameters base properties for updating any task step. 5348type BasicTaskStepUpdateParameters interface { 5349 AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) 5350 AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) 5351 AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) 5352 AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) 5353} 5354 5355// TaskStepUpdateParameters base properties for updating any task step. 5356type TaskStepUpdateParameters struct { 5357 // ContextPath - The URL(absolute or relative) of the source context for the task step. 5358 ContextPath *string `json:"contextPath,omitempty"` 5359 // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. 5360 ContextAccessToken *string `json:"contextAccessToken,omitempty"` 5361 // Type - Possible values include: 'TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters', 'TypeBasicTaskStepUpdateParametersTypeDocker', 'TypeBasicTaskStepUpdateParametersTypeFileTask', 'TypeBasicTaskStepUpdateParametersTypeEncodedTask' 5362 Type TypeBasicTaskStepUpdateParameters `json:"type,omitempty"` 5363} 5364 5365func unmarshalBasicTaskStepUpdateParameters(body []byte) (BasicTaskStepUpdateParameters, error) { 5366 var m map[string]interface{} 5367 err := json.Unmarshal(body, &m) 5368 if err != nil { 5369 return nil, err 5370 } 5371 5372 switch m["type"] { 5373 case string(TypeBasicTaskStepUpdateParametersTypeDocker): 5374 var dbsup DockerBuildStepUpdateParameters 5375 err := json.Unmarshal(body, &dbsup) 5376 return dbsup, err 5377 case string(TypeBasicTaskStepUpdateParametersTypeFileTask): 5378 var ftsup FileTaskStepUpdateParameters 5379 err := json.Unmarshal(body, &ftsup) 5380 return ftsup, err 5381 case string(TypeBasicTaskStepUpdateParametersTypeEncodedTask): 5382 var etsup EncodedTaskStepUpdateParameters 5383 err := json.Unmarshal(body, &etsup) 5384 return etsup, err 5385 default: 5386 var tsup TaskStepUpdateParameters 5387 err := json.Unmarshal(body, &tsup) 5388 return tsup, err 5389 } 5390} 5391func unmarshalBasicTaskStepUpdateParametersArray(body []byte) ([]BasicTaskStepUpdateParameters, error) { 5392 var rawMessages []*json.RawMessage 5393 err := json.Unmarshal(body, &rawMessages) 5394 if err != nil { 5395 return nil, err 5396 } 5397 5398 tsupArray := make([]BasicTaskStepUpdateParameters, len(rawMessages)) 5399 5400 for index, rawMessage := range rawMessages { 5401 tsup, err := unmarshalBasicTaskStepUpdateParameters(*rawMessage) 5402 if err != nil { 5403 return nil, err 5404 } 5405 tsupArray[index] = tsup 5406 } 5407 return tsupArray, nil 5408} 5409 5410// MarshalJSON is the custom marshaler for TaskStepUpdateParameters. 5411func (tsup TaskStepUpdateParameters) MarshalJSON() ([]byte, error) { 5412 tsup.Type = TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters 5413 objectMap := make(map[string]interface{}) 5414 if tsup.ContextPath != nil { 5415 objectMap["contextPath"] = tsup.ContextPath 5416 } 5417 if tsup.ContextAccessToken != nil { 5418 objectMap["contextAccessToken"] = tsup.ContextAccessToken 5419 } 5420 if tsup.Type != "" { 5421 objectMap["type"] = tsup.Type 5422 } 5423 return json.Marshal(objectMap) 5424} 5425 5426// AsDockerBuildStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. 5427func (tsup TaskStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { 5428 return nil, false 5429} 5430 5431// AsFileTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. 5432func (tsup TaskStepUpdateParameters) AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) { 5433 return nil, false 5434} 5435 5436// AsEncodedTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. 5437func (tsup TaskStepUpdateParameters) AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) { 5438 return nil, false 5439} 5440 5441// AsTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. 5442func (tsup TaskStepUpdateParameters) AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) { 5443 return &tsup, true 5444} 5445 5446// AsBasicTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. 5447func (tsup TaskStepUpdateParameters) AsBasicTaskStepUpdateParameters() (BasicTaskStepUpdateParameters, bool) { 5448 return &tsup, true 5449} 5450 5451// TasksUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 5452type TasksUpdateFuture struct { 5453 azure.FutureAPI 5454 // Result returns the result of the asynchronous operation. 5455 // If the operation has not completed it will return an error. 5456 Result func(TasksClient) (Task, error) 5457} 5458 5459// TaskUpdateParameters the parameters for updating a task. 5460type TaskUpdateParameters struct { 5461 // Identity - Identity for the resource. 5462 Identity *IdentityProperties `json:"identity,omitempty"` 5463 // TaskPropertiesUpdateParameters - The properties for updating a task. 5464 *TaskPropertiesUpdateParameters `json:"properties,omitempty"` 5465 // Tags - The ARM resource tags. 5466 Tags map[string]*string `json:"tags"` 5467} 5468 5469// MarshalJSON is the custom marshaler for TaskUpdateParameters. 5470func (tup TaskUpdateParameters) MarshalJSON() ([]byte, error) { 5471 objectMap := make(map[string]interface{}) 5472 if tup.Identity != nil { 5473 objectMap["identity"] = tup.Identity 5474 } 5475 if tup.TaskPropertiesUpdateParameters != nil { 5476 objectMap["properties"] = tup.TaskPropertiesUpdateParameters 5477 } 5478 if tup.Tags != nil { 5479 objectMap["tags"] = tup.Tags 5480 } 5481 return json.Marshal(objectMap) 5482} 5483 5484// UnmarshalJSON is the custom unmarshaler for TaskUpdateParameters struct. 5485func (tup *TaskUpdateParameters) UnmarshalJSON(body []byte) error { 5486 var m map[string]*json.RawMessage 5487 err := json.Unmarshal(body, &m) 5488 if err != nil { 5489 return err 5490 } 5491 for k, v := range m { 5492 switch k { 5493 case "identity": 5494 if v != nil { 5495 var identity IdentityProperties 5496 err = json.Unmarshal(*v, &identity) 5497 if err != nil { 5498 return err 5499 } 5500 tup.Identity = &identity 5501 } 5502 case "properties": 5503 if v != nil { 5504 var taskPropertiesUpdateParameters TaskPropertiesUpdateParameters 5505 err = json.Unmarshal(*v, &taskPropertiesUpdateParameters) 5506 if err != nil { 5507 return err 5508 } 5509 tup.TaskPropertiesUpdateParameters = &taskPropertiesUpdateParameters 5510 } 5511 case "tags": 5512 if v != nil { 5513 var tags map[string]*string 5514 err = json.Unmarshal(*v, &tags) 5515 if err != nil { 5516 return err 5517 } 5518 tup.Tags = tags 5519 } 5520 } 5521 } 5522 5523 return nil 5524} 5525 5526// TimerTrigger the properties of a timer trigger. 5527type TimerTrigger struct { 5528 // Schedule - The CRON expression for the task schedule 5529 Schedule *string `json:"schedule,omitempty"` 5530 // Status - The current status of trigger. Possible values include: 'TriggerStatusDisabled', 'TriggerStatusEnabled' 5531 Status TriggerStatus `json:"status,omitempty"` 5532 // Name - The name of the trigger. 5533 Name *string `json:"name,omitempty"` 5534} 5535 5536// TimerTriggerDescriptor ... 5537type TimerTriggerDescriptor struct { 5538 // TimerTriggerName - The timer trigger name that caused the run. 5539 TimerTriggerName *string `json:"timerTriggerName,omitempty"` 5540 // ScheduleOccurrence - The occurrence that triggered the run. 5541 ScheduleOccurrence *string `json:"scheduleOccurrence,omitempty"` 5542} 5543 5544// TimerTriggerUpdateParameters the properties for updating a timer trigger. 5545type TimerTriggerUpdateParameters struct { 5546 // Schedule - The CRON expression for the task schedule 5547 Schedule *string `json:"schedule,omitempty"` 5548 // Status - The current status of trigger. Possible values include: 'TriggerStatusDisabled', 'TriggerStatusEnabled' 5549 Status TriggerStatus `json:"status,omitempty"` 5550 // Name - The name of the trigger. 5551 Name *string `json:"name,omitempty"` 5552} 5553 5554// Token an object that represents a token for a container registry. 5555type Token struct { 5556 autorest.Response `json:"-"` 5557 // TokenProperties - The properties of the token. 5558 *TokenProperties `json:"properties,omitempty"` 5559 // ID - READ-ONLY; The resource ID. 5560 ID *string `json:"id,omitempty"` 5561 // Name - READ-ONLY; The name of the resource. 5562 Name *string `json:"name,omitempty"` 5563 // Type - READ-ONLY; The type of the resource. 5564 Type *string `json:"type,omitempty"` 5565 // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. 5566 SystemData *SystemData `json:"systemData,omitempty"` 5567} 5568 5569// MarshalJSON is the custom marshaler for Token. 5570func (t Token) MarshalJSON() ([]byte, error) { 5571 objectMap := make(map[string]interface{}) 5572 if t.TokenProperties != nil { 5573 objectMap["properties"] = t.TokenProperties 5574 } 5575 return json.Marshal(objectMap) 5576} 5577 5578// UnmarshalJSON is the custom unmarshaler for Token struct. 5579func (t *Token) UnmarshalJSON(body []byte) error { 5580 var m map[string]*json.RawMessage 5581 err := json.Unmarshal(body, &m) 5582 if err != nil { 5583 return err 5584 } 5585 for k, v := range m { 5586 switch k { 5587 case "properties": 5588 if v != nil { 5589 var tokenProperties TokenProperties 5590 err = json.Unmarshal(*v, &tokenProperties) 5591 if err != nil { 5592 return err 5593 } 5594 t.TokenProperties = &tokenProperties 5595 } 5596 case "id": 5597 if v != nil { 5598 var ID string 5599 err = json.Unmarshal(*v, &ID) 5600 if err != nil { 5601 return err 5602 } 5603 t.ID = &ID 5604 } 5605 case "name": 5606 if v != nil { 5607 var name string 5608 err = json.Unmarshal(*v, &name) 5609 if err != nil { 5610 return err 5611 } 5612 t.Name = &name 5613 } 5614 case "type": 5615 if v != nil { 5616 var typeVar string 5617 err = json.Unmarshal(*v, &typeVar) 5618 if err != nil { 5619 return err 5620 } 5621 t.Type = &typeVar 5622 } 5623 case "systemData": 5624 if v != nil { 5625 var systemData SystemData 5626 err = json.Unmarshal(*v, &systemData) 5627 if err != nil { 5628 return err 5629 } 5630 t.SystemData = &systemData 5631 } 5632 } 5633 } 5634 5635 return nil 5636} 5637 5638// TokenCertificate the properties of a certificate used for authenticating a token. 5639type TokenCertificate struct { 5640 // Name - Possible values include: 'Certificate1', 'Certificate2' 5641 Name TokenCertificateName `json:"name,omitempty"` 5642 // Expiry - The expiry datetime of the certificate. 5643 Expiry *date.Time `json:"expiry,omitempty"` 5644 // Thumbprint - The thumbprint of the certificate. 5645 Thumbprint *string `json:"thumbprint,omitempty"` 5646 // EncodedPemCertificate - Base 64 encoded string of the public certificate1 in PEM format that will be used for authenticating the token. 5647 EncodedPemCertificate *string `json:"encodedPemCertificate,omitempty"` 5648} 5649 5650// TokenCredentialsProperties the properties of the credentials that can be used for authenticating the 5651// token. 5652type TokenCredentialsProperties struct { 5653 ActiveDirectoryObject *ActiveDirectoryObject `json:"activeDirectoryObject,omitempty"` 5654 Certificates *[]TokenCertificate `json:"certificates,omitempty"` 5655 Passwords *[]TokenPassword `json:"passwords,omitempty"` 5656} 5657 5658// TokenListResult the result of a request to list tokens for a container registry. 5659type TokenListResult struct { 5660 autorest.Response `json:"-"` 5661 // Value - The list of tokens. Since this list may be incomplete, the nextLink field should be used to request the next list of tokens. 5662 Value *[]Token `json:"value,omitempty"` 5663 // NextLink - The URI that can be used to request the next list of tokens. 5664 NextLink *string `json:"nextLink,omitempty"` 5665} 5666 5667// TokenListResultIterator provides access to a complete listing of Token values. 5668type TokenListResultIterator struct { 5669 i int 5670 page TokenListResultPage 5671} 5672 5673// NextWithContext advances to the next value. If there was an error making 5674// the request the iterator does not advance and the error is returned. 5675func (iter *TokenListResultIterator) NextWithContext(ctx context.Context) (err error) { 5676 if tracing.IsEnabled() { 5677 ctx = tracing.StartSpan(ctx, fqdn+"/TokenListResultIterator.NextWithContext") 5678 defer func() { 5679 sc := -1 5680 if iter.Response().Response.Response != nil { 5681 sc = iter.Response().Response.Response.StatusCode 5682 } 5683 tracing.EndSpan(ctx, sc, err) 5684 }() 5685 } 5686 iter.i++ 5687 if iter.i < len(iter.page.Values()) { 5688 return nil 5689 } 5690 err = iter.page.NextWithContext(ctx) 5691 if err != nil { 5692 iter.i-- 5693 return err 5694 } 5695 iter.i = 0 5696 return nil 5697} 5698 5699// Next advances to the next value. If there was an error making 5700// the request the iterator does not advance and the error is returned. 5701// Deprecated: Use NextWithContext() instead. 5702func (iter *TokenListResultIterator) Next() error { 5703 return iter.NextWithContext(context.Background()) 5704} 5705 5706// NotDone returns true if the enumeration should be started or is not yet complete. 5707func (iter TokenListResultIterator) NotDone() bool { 5708 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 5709} 5710 5711// Response returns the raw server response from the last page request. 5712func (iter TokenListResultIterator) Response() TokenListResult { 5713 return iter.page.Response() 5714} 5715 5716// Value returns the current value or a zero-initialized value if the 5717// iterator has advanced beyond the end of the collection. 5718func (iter TokenListResultIterator) Value() Token { 5719 if !iter.page.NotDone() { 5720 return Token{} 5721 } 5722 return iter.page.Values()[iter.i] 5723} 5724 5725// Creates a new instance of the TokenListResultIterator type. 5726func NewTokenListResultIterator(page TokenListResultPage) TokenListResultIterator { 5727 return TokenListResultIterator{page: page} 5728} 5729 5730// IsEmpty returns true if the ListResult contains no values. 5731func (tlr TokenListResult) IsEmpty() bool { 5732 return tlr.Value == nil || len(*tlr.Value) == 0 5733} 5734 5735// hasNextLink returns true if the NextLink is not empty. 5736func (tlr TokenListResult) hasNextLink() bool { 5737 return tlr.NextLink != nil && len(*tlr.NextLink) != 0 5738} 5739 5740// tokenListResultPreparer prepares a request to retrieve the next set of results. 5741// It returns nil if no more results exist. 5742func (tlr TokenListResult) tokenListResultPreparer(ctx context.Context) (*http.Request, error) { 5743 if !tlr.hasNextLink() { 5744 return nil, nil 5745 } 5746 return autorest.Prepare((&http.Request{}).WithContext(ctx), 5747 autorest.AsJSON(), 5748 autorest.AsGet(), 5749 autorest.WithBaseURL(to.String(tlr.NextLink))) 5750} 5751 5752// TokenListResultPage contains a page of Token values. 5753type TokenListResultPage struct { 5754 fn func(context.Context, TokenListResult) (TokenListResult, error) 5755 tlr TokenListResult 5756} 5757 5758// NextWithContext advances to the next page of values. If there was an error making 5759// the request the page does not advance and the error is returned. 5760func (page *TokenListResultPage) NextWithContext(ctx context.Context) (err error) { 5761 if tracing.IsEnabled() { 5762 ctx = tracing.StartSpan(ctx, fqdn+"/TokenListResultPage.NextWithContext") 5763 defer func() { 5764 sc := -1 5765 if page.Response().Response.Response != nil { 5766 sc = page.Response().Response.Response.StatusCode 5767 } 5768 tracing.EndSpan(ctx, sc, err) 5769 }() 5770 } 5771 for { 5772 next, err := page.fn(ctx, page.tlr) 5773 if err != nil { 5774 return err 5775 } 5776 page.tlr = next 5777 if !next.hasNextLink() || !next.IsEmpty() { 5778 break 5779 } 5780 } 5781 return nil 5782} 5783 5784// Next advances to the next page of values. If there was an error making 5785// the request the page does not advance and the error is returned. 5786// Deprecated: Use NextWithContext() instead. 5787func (page *TokenListResultPage) Next() error { 5788 return page.NextWithContext(context.Background()) 5789} 5790 5791// NotDone returns true if the page enumeration should be started or is not yet complete. 5792func (page TokenListResultPage) NotDone() bool { 5793 return !page.tlr.IsEmpty() 5794} 5795 5796// Response returns the raw server response from the last page request. 5797func (page TokenListResultPage) Response() TokenListResult { 5798 return page.tlr 5799} 5800 5801// Values returns the slice of values for the current page or nil if there are no values. 5802func (page TokenListResultPage) Values() []Token { 5803 if page.tlr.IsEmpty() { 5804 return nil 5805 } 5806 return *page.tlr.Value 5807} 5808 5809// Creates a new instance of the TokenListResultPage type. 5810func NewTokenListResultPage(cur TokenListResult, getNextPage func(context.Context, TokenListResult) (TokenListResult, error)) TokenListResultPage { 5811 return TokenListResultPage{ 5812 fn: getNextPage, 5813 tlr: cur, 5814 } 5815} 5816 5817// TokenPassword the password that will be used for authenticating the token of a container registry. 5818type TokenPassword struct { 5819 // CreationTime - The creation datetime of the password. 5820 CreationTime *date.Time `json:"creationTime,omitempty"` 5821 // Expiry - The expiry datetime of the password. 5822 Expiry *date.Time `json:"expiry,omitempty"` 5823 // Name - The password name "password1" or "password2". Possible values include: 'TokenPasswordNamePassword1', 'TokenPasswordNamePassword2' 5824 Name TokenPasswordName `json:"name,omitempty"` 5825 // Value - READ-ONLY; The password value. 5826 Value *string `json:"value,omitempty"` 5827} 5828 5829// MarshalJSON is the custom marshaler for TokenPassword. 5830func (tp TokenPassword) MarshalJSON() ([]byte, error) { 5831 objectMap := make(map[string]interface{}) 5832 if tp.CreationTime != nil { 5833 objectMap["creationTime"] = tp.CreationTime 5834 } 5835 if tp.Expiry != nil { 5836 objectMap["expiry"] = tp.Expiry 5837 } 5838 if tp.Name != "" { 5839 objectMap["name"] = tp.Name 5840 } 5841 return json.Marshal(objectMap) 5842} 5843 5844// TokenProperties the properties of a token. 5845type TokenProperties struct { 5846 // CreationDate - READ-ONLY; The creation date of scope map. 5847 CreationDate *date.Time `json:"creationDate,omitempty"` 5848 // ProvisioningState - READ-ONLY; Provisioning state of the resource. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' 5849 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 5850 // ScopeMapID - The resource ID of the scope map to which the token will be associated with. 5851 ScopeMapID *string `json:"scopeMapId,omitempty"` 5852 // Credentials - The credentials that can be used for authenticating the token. 5853 Credentials *TokenCredentialsProperties `json:"credentials,omitempty"` 5854 // Status - The status of the token example enabled or disabled. Possible values include: 'TokenStatusEnabled', 'TokenStatusDisabled' 5855 Status TokenStatus `json:"status,omitempty"` 5856} 5857 5858// MarshalJSON is the custom marshaler for TokenProperties. 5859func (tp TokenProperties) MarshalJSON() ([]byte, error) { 5860 objectMap := make(map[string]interface{}) 5861 if tp.ScopeMapID != nil { 5862 objectMap["scopeMapId"] = tp.ScopeMapID 5863 } 5864 if tp.Credentials != nil { 5865 objectMap["credentials"] = tp.Credentials 5866 } 5867 if tp.Status != "" { 5868 objectMap["status"] = tp.Status 5869 } 5870 return json.Marshal(objectMap) 5871} 5872 5873// TokensCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 5874type TokensCreateFuture struct { 5875 azure.FutureAPI 5876 // Result returns the result of the asynchronous operation. 5877 // If the operation has not completed it will return an error. 5878 Result func(TokensClient) (Token, error) 5879} 5880 5881// TokensDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. 5882type TokensDeleteFuture struct { 5883 azure.FutureAPI 5884 // Result returns the result of the asynchronous operation. 5885 // If the operation has not completed it will return an error. 5886 Result func(TokensClient) (autorest.Response, error) 5887} 5888 5889// TokensUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 5890type TokensUpdateFuture struct { 5891 azure.FutureAPI 5892 // Result returns the result of the asynchronous operation. 5893 // If the operation has not completed it will return an error. 5894 Result func(TokensClient) (Token, error) 5895} 5896 5897// TokenUpdateParameters the parameters for updating a token. 5898type TokenUpdateParameters struct { 5899 // TokenUpdateProperties - The properties of the token update parameters. 5900 *TokenUpdateProperties `json:"properties,omitempty"` 5901} 5902 5903// MarshalJSON is the custom marshaler for TokenUpdateParameters. 5904func (tup TokenUpdateParameters) MarshalJSON() ([]byte, error) { 5905 objectMap := make(map[string]interface{}) 5906 if tup.TokenUpdateProperties != nil { 5907 objectMap["properties"] = tup.TokenUpdateProperties 5908 } 5909 return json.Marshal(objectMap) 5910} 5911 5912// UnmarshalJSON is the custom unmarshaler for TokenUpdateParameters struct. 5913func (tup *TokenUpdateParameters) UnmarshalJSON(body []byte) error { 5914 var m map[string]*json.RawMessage 5915 err := json.Unmarshal(body, &m) 5916 if err != nil { 5917 return err 5918 } 5919 for k, v := range m { 5920 switch k { 5921 case "properties": 5922 if v != nil { 5923 var tokenUpdateProperties TokenUpdateProperties 5924 err = json.Unmarshal(*v, &tokenUpdateProperties) 5925 if err != nil { 5926 return err 5927 } 5928 tup.TokenUpdateProperties = &tokenUpdateProperties 5929 } 5930 } 5931 } 5932 5933 return nil 5934} 5935 5936// TokenUpdateProperties the parameters for updating token properties. 5937type TokenUpdateProperties struct { 5938 // ScopeMapID - The resource ID of the scope map to which the token will be associated with. 5939 ScopeMapID *string `json:"scopeMapId,omitempty"` 5940 // Status - The status of the token example enabled or disabled. Possible values include: 'TokenStatusEnabled', 'TokenStatusDisabled' 5941 Status TokenStatus `json:"status,omitempty"` 5942 // Credentials - The credentials that can be used for authenticating the token. 5943 Credentials *TokenCredentialsProperties `json:"credentials,omitempty"` 5944} 5945 5946// TriggerProperties the properties of a trigger. 5947type TriggerProperties struct { 5948 // TimerTriggers - The collection of timer triggers. 5949 TimerTriggers *[]TimerTrigger `json:"timerTriggers,omitempty"` 5950 // SourceTriggers - The collection of triggers based on source code repository. 5951 SourceTriggers *[]SourceTrigger `json:"sourceTriggers,omitempty"` 5952 // BaseImageTrigger - The trigger based on base image dependencies. 5953 BaseImageTrigger *BaseImageTrigger `json:"baseImageTrigger,omitempty"` 5954} 5955 5956// TriggerUpdateParameters the properties for updating triggers. 5957type TriggerUpdateParameters struct { 5958 // TimerTriggers - The collection of timer triggers. 5959 TimerTriggers *[]TimerTriggerUpdateParameters `json:"timerTriggers,omitempty"` 5960 // SourceTriggers - The collection of triggers based on source code repository. 5961 SourceTriggers *[]SourceTriggerUpdateParameters `json:"sourceTriggers,omitempty"` 5962 // BaseImageTrigger - The trigger based on base image dependencies. 5963 BaseImageTrigger *BaseImageTriggerUpdateParameters `json:"baseImageTrigger,omitempty"` 5964} 5965 5966// TrustPolicy the content trust policy for a container registry. 5967type TrustPolicy struct { 5968 // Type - The type of trust policy. Possible values include: 'Notary' 5969 Type TrustPolicyType `json:"type,omitempty"` 5970 // Status - The value that indicates whether the policy is enabled or not. Possible values include: 'Enabled', 'Disabled' 5971 Status PolicyStatus `json:"status,omitempty"` 5972} 5973 5974// UserIdentityProperties ... 5975type UserIdentityProperties struct { 5976 // PrincipalID - The principal id of user assigned identity. 5977 PrincipalID *string `json:"principalId,omitempty"` 5978 // ClientID - The client id of user assigned identity. 5979 ClientID *string `json:"clientId,omitempty"` 5980} 5981 5982// VirtualNetworkRule virtual network rule. 5983type VirtualNetworkRule struct { 5984 // Action - The action of virtual network rule. Possible values include: 'Allow' 5985 Action Action `json:"action,omitempty"` 5986 // VirtualNetworkResourceID - Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. 5987 VirtualNetworkResourceID *string `json:"id,omitempty"` 5988} 5989 5990// Webhook an object that represents a webhook for a container registry. 5991type Webhook struct { 5992 autorest.Response `json:"-"` 5993 // WebhookProperties - The properties of the webhook. 5994 *WebhookProperties `json:"properties,omitempty"` 5995 // ID - READ-ONLY; The resource ID. 5996 ID *string `json:"id,omitempty"` 5997 // Name - READ-ONLY; The name of the resource. 5998 Name *string `json:"name,omitempty"` 5999 // Type - READ-ONLY; The type of the resource. 6000 Type *string `json:"type,omitempty"` 6001 // Location - The location of the resource. This cannot be changed after the resource is created. 6002 Location *string `json:"location,omitempty"` 6003 // Tags - The tags of the resource. 6004 Tags map[string]*string `json:"tags"` 6005 // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. 6006 SystemData *SystemData `json:"systemData,omitempty"` 6007} 6008 6009// MarshalJSON is the custom marshaler for Webhook. 6010func (w Webhook) MarshalJSON() ([]byte, error) { 6011 objectMap := make(map[string]interface{}) 6012 if w.WebhookProperties != nil { 6013 objectMap["properties"] = w.WebhookProperties 6014 } 6015 if w.Location != nil { 6016 objectMap["location"] = w.Location 6017 } 6018 if w.Tags != nil { 6019 objectMap["tags"] = w.Tags 6020 } 6021 return json.Marshal(objectMap) 6022} 6023 6024// UnmarshalJSON is the custom unmarshaler for Webhook struct. 6025func (w *Webhook) UnmarshalJSON(body []byte) error { 6026 var m map[string]*json.RawMessage 6027 err := json.Unmarshal(body, &m) 6028 if err != nil { 6029 return err 6030 } 6031 for k, v := range m { 6032 switch k { 6033 case "properties": 6034 if v != nil { 6035 var webhookProperties WebhookProperties 6036 err = json.Unmarshal(*v, &webhookProperties) 6037 if err != nil { 6038 return err 6039 } 6040 w.WebhookProperties = &webhookProperties 6041 } 6042 case "id": 6043 if v != nil { 6044 var ID string 6045 err = json.Unmarshal(*v, &ID) 6046 if err != nil { 6047 return err 6048 } 6049 w.ID = &ID 6050 } 6051 case "name": 6052 if v != nil { 6053 var name string 6054 err = json.Unmarshal(*v, &name) 6055 if err != nil { 6056 return err 6057 } 6058 w.Name = &name 6059 } 6060 case "type": 6061 if v != nil { 6062 var typeVar string 6063 err = json.Unmarshal(*v, &typeVar) 6064 if err != nil { 6065 return err 6066 } 6067 w.Type = &typeVar 6068 } 6069 case "location": 6070 if v != nil { 6071 var location string 6072 err = json.Unmarshal(*v, &location) 6073 if err != nil { 6074 return err 6075 } 6076 w.Location = &location 6077 } 6078 case "tags": 6079 if v != nil { 6080 var tags map[string]*string 6081 err = json.Unmarshal(*v, &tags) 6082 if err != nil { 6083 return err 6084 } 6085 w.Tags = tags 6086 } 6087 case "systemData": 6088 if v != nil { 6089 var systemData SystemData 6090 err = json.Unmarshal(*v, &systemData) 6091 if err != nil { 6092 return err 6093 } 6094 w.SystemData = &systemData 6095 } 6096 } 6097 } 6098 6099 return nil 6100} 6101 6102// WebhookCreateParameters the parameters for creating a webhook. 6103type WebhookCreateParameters struct { 6104 // Tags - The tags for the webhook. 6105 Tags map[string]*string `json:"tags"` 6106 // Location - The location of the webhook. This cannot be changed after the resource is created. 6107 Location *string `json:"location,omitempty"` 6108 // WebhookPropertiesCreateParameters - The properties that the webhook will be created with. 6109 *WebhookPropertiesCreateParameters `json:"properties,omitempty"` 6110} 6111 6112// MarshalJSON is the custom marshaler for WebhookCreateParameters. 6113func (wcp WebhookCreateParameters) MarshalJSON() ([]byte, error) { 6114 objectMap := make(map[string]interface{}) 6115 if wcp.Tags != nil { 6116 objectMap["tags"] = wcp.Tags 6117 } 6118 if wcp.Location != nil { 6119 objectMap["location"] = wcp.Location 6120 } 6121 if wcp.WebhookPropertiesCreateParameters != nil { 6122 objectMap["properties"] = wcp.WebhookPropertiesCreateParameters 6123 } 6124 return json.Marshal(objectMap) 6125} 6126 6127// UnmarshalJSON is the custom unmarshaler for WebhookCreateParameters struct. 6128func (wcp *WebhookCreateParameters) UnmarshalJSON(body []byte) error { 6129 var m map[string]*json.RawMessage 6130 err := json.Unmarshal(body, &m) 6131 if err != nil { 6132 return err 6133 } 6134 for k, v := range m { 6135 switch k { 6136 case "tags": 6137 if v != nil { 6138 var tags map[string]*string 6139 err = json.Unmarshal(*v, &tags) 6140 if err != nil { 6141 return err 6142 } 6143 wcp.Tags = tags 6144 } 6145 case "location": 6146 if v != nil { 6147 var location string 6148 err = json.Unmarshal(*v, &location) 6149 if err != nil { 6150 return err 6151 } 6152 wcp.Location = &location 6153 } 6154 case "properties": 6155 if v != nil { 6156 var webhookPropertiesCreateParameters WebhookPropertiesCreateParameters 6157 err = json.Unmarshal(*v, &webhookPropertiesCreateParameters) 6158 if err != nil { 6159 return err 6160 } 6161 wcp.WebhookPropertiesCreateParameters = &webhookPropertiesCreateParameters 6162 } 6163 } 6164 } 6165 6166 return nil 6167} 6168 6169// WebhookListResult the result of a request to list webhooks for a container registry. 6170type WebhookListResult struct { 6171 autorest.Response `json:"-"` 6172 // Value - The list of webhooks. Since this list may be incomplete, the nextLink field should be used to request the next list of webhooks. 6173 Value *[]Webhook `json:"value,omitempty"` 6174 // NextLink - The URI that can be used to request the next list of webhooks. 6175 NextLink *string `json:"nextLink,omitempty"` 6176} 6177 6178// WebhookListResultIterator provides access to a complete listing of Webhook values. 6179type WebhookListResultIterator struct { 6180 i int 6181 page WebhookListResultPage 6182} 6183 6184// NextWithContext advances to the next value. If there was an error making 6185// the request the iterator does not advance and the error is returned. 6186func (iter *WebhookListResultIterator) NextWithContext(ctx context.Context) (err error) { 6187 if tracing.IsEnabled() { 6188 ctx = tracing.StartSpan(ctx, fqdn+"/WebhookListResultIterator.NextWithContext") 6189 defer func() { 6190 sc := -1 6191 if iter.Response().Response.Response != nil { 6192 sc = iter.Response().Response.Response.StatusCode 6193 } 6194 tracing.EndSpan(ctx, sc, err) 6195 }() 6196 } 6197 iter.i++ 6198 if iter.i < len(iter.page.Values()) { 6199 return nil 6200 } 6201 err = iter.page.NextWithContext(ctx) 6202 if err != nil { 6203 iter.i-- 6204 return err 6205 } 6206 iter.i = 0 6207 return nil 6208} 6209 6210// Next advances to the next value. If there was an error making 6211// the request the iterator does not advance and the error is returned. 6212// Deprecated: Use NextWithContext() instead. 6213func (iter *WebhookListResultIterator) Next() error { 6214 return iter.NextWithContext(context.Background()) 6215} 6216 6217// NotDone returns true if the enumeration should be started or is not yet complete. 6218func (iter WebhookListResultIterator) NotDone() bool { 6219 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 6220} 6221 6222// Response returns the raw server response from the last page request. 6223func (iter WebhookListResultIterator) Response() WebhookListResult { 6224 return iter.page.Response() 6225} 6226 6227// Value returns the current value or a zero-initialized value if the 6228// iterator has advanced beyond the end of the collection. 6229func (iter WebhookListResultIterator) Value() Webhook { 6230 if !iter.page.NotDone() { 6231 return Webhook{} 6232 } 6233 return iter.page.Values()[iter.i] 6234} 6235 6236// Creates a new instance of the WebhookListResultIterator type. 6237func NewWebhookListResultIterator(page WebhookListResultPage) WebhookListResultIterator { 6238 return WebhookListResultIterator{page: page} 6239} 6240 6241// IsEmpty returns true if the ListResult contains no values. 6242func (wlr WebhookListResult) IsEmpty() bool { 6243 return wlr.Value == nil || len(*wlr.Value) == 0 6244} 6245 6246// hasNextLink returns true if the NextLink is not empty. 6247func (wlr WebhookListResult) hasNextLink() bool { 6248 return wlr.NextLink != nil && len(*wlr.NextLink) != 0 6249} 6250 6251// webhookListResultPreparer prepares a request to retrieve the next set of results. 6252// It returns nil if no more results exist. 6253func (wlr WebhookListResult) webhookListResultPreparer(ctx context.Context) (*http.Request, error) { 6254 if !wlr.hasNextLink() { 6255 return nil, nil 6256 } 6257 return autorest.Prepare((&http.Request{}).WithContext(ctx), 6258 autorest.AsJSON(), 6259 autorest.AsGet(), 6260 autorest.WithBaseURL(to.String(wlr.NextLink))) 6261} 6262 6263// WebhookListResultPage contains a page of Webhook values. 6264type WebhookListResultPage struct { 6265 fn func(context.Context, WebhookListResult) (WebhookListResult, error) 6266 wlr WebhookListResult 6267} 6268 6269// NextWithContext advances to the next page of values. If there was an error making 6270// the request the page does not advance and the error is returned. 6271func (page *WebhookListResultPage) NextWithContext(ctx context.Context) (err error) { 6272 if tracing.IsEnabled() { 6273 ctx = tracing.StartSpan(ctx, fqdn+"/WebhookListResultPage.NextWithContext") 6274 defer func() { 6275 sc := -1 6276 if page.Response().Response.Response != nil { 6277 sc = page.Response().Response.Response.StatusCode 6278 } 6279 tracing.EndSpan(ctx, sc, err) 6280 }() 6281 } 6282 for { 6283 next, err := page.fn(ctx, page.wlr) 6284 if err != nil { 6285 return err 6286 } 6287 page.wlr = next 6288 if !next.hasNextLink() || !next.IsEmpty() { 6289 break 6290 } 6291 } 6292 return nil 6293} 6294 6295// Next advances to the next page of values. If there was an error making 6296// the request the page does not advance and the error is returned. 6297// Deprecated: Use NextWithContext() instead. 6298func (page *WebhookListResultPage) Next() error { 6299 return page.NextWithContext(context.Background()) 6300} 6301 6302// NotDone returns true if the page enumeration should be started or is not yet complete. 6303func (page WebhookListResultPage) NotDone() bool { 6304 return !page.wlr.IsEmpty() 6305} 6306 6307// Response returns the raw server response from the last page request. 6308func (page WebhookListResultPage) Response() WebhookListResult { 6309 return page.wlr 6310} 6311 6312// Values returns the slice of values for the current page or nil if there are no values. 6313func (page WebhookListResultPage) Values() []Webhook { 6314 if page.wlr.IsEmpty() { 6315 return nil 6316 } 6317 return *page.wlr.Value 6318} 6319 6320// Creates a new instance of the WebhookListResultPage type. 6321func NewWebhookListResultPage(cur WebhookListResult, getNextPage func(context.Context, WebhookListResult) (WebhookListResult, error)) WebhookListResultPage { 6322 return WebhookListResultPage{ 6323 fn: getNextPage, 6324 wlr: cur, 6325 } 6326} 6327 6328// WebhookProperties the properties of a webhook. 6329type WebhookProperties struct { 6330 // Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled' 6331 Status WebhookStatus `json:"status,omitempty"` 6332 // 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. 6333 Scope *string `json:"scope,omitempty"` 6334 // Actions - The list of actions that trigger the webhook to post notifications. 6335 Actions *[]WebhookAction `json:"actions,omitempty"` 6336 // ProvisioningState - READ-ONLY; The provisioning state of the webhook at the time the operation was called. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' 6337 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 6338} 6339 6340// MarshalJSON is the custom marshaler for WebhookProperties. 6341func (wp WebhookProperties) MarshalJSON() ([]byte, error) { 6342 objectMap := make(map[string]interface{}) 6343 if wp.Status != "" { 6344 objectMap["status"] = wp.Status 6345 } 6346 if wp.Scope != nil { 6347 objectMap["scope"] = wp.Scope 6348 } 6349 if wp.Actions != nil { 6350 objectMap["actions"] = wp.Actions 6351 } 6352 return json.Marshal(objectMap) 6353} 6354 6355// WebhookPropertiesCreateParameters the parameters for creating the properties of a webhook. 6356type WebhookPropertiesCreateParameters struct { 6357 // ServiceURI - The service URI for the webhook to post notifications. 6358 ServiceURI *string `json:"serviceUri,omitempty"` 6359 // CustomHeaders - Custom headers that will be added to the webhook notifications. 6360 CustomHeaders map[string]*string `json:"customHeaders"` 6361 // Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled' 6362 Status WebhookStatus `json:"status,omitempty"` 6363 // 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. 6364 Scope *string `json:"scope,omitempty"` 6365 // Actions - The list of actions that trigger the webhook to post notifications. 6366 Actions *[]WebhookAction `json:"actions,omitempty"` 6367} 6368 6369// MarshalJSON is the custom marshaler for WebhookPropertiesCreateParameters. 6370func (wpcp WebhookPropertiesCreateParameters) MarshalJSON() ([]byte, error) { 6371 objectMap := make(map[string]interface{}) 6372 if wpcp.ServiceURI != nil { 6373 objectMap["serviceUri"] = wpcp.ServiceURI 6374 } 6375 if wpcp.CustomHeaders != nil { 6376 objectMap["customHeaders"] = wpcp.CustomHeaders 6377 } 6378 if wpcp.Status != "" { 6379 objectMap["status"] = wpcp.Status 6380 } 6381 if wpcp.Scope != nil { 6382 objectMap["scope"] = wpcp.Scope 6383 } 6384 if wpcp.Actions != nil { 6385 objectMap["actions"] = wpcp.Actions 6386 } 6387 return json.Marshal(objectMap) 6388} 6389 6390// WebhookPropertiesUpdateParameters the parameters for updating the properties of a webhook. 6391type WebhookPropertiesUpdateParameters struct { 6392 // ServiceURI - The service URI for the webhook to post notifications. 6393 ServiceURI *string `json:"serviceUri,omitempty"` 6394 // CustomHeaders - Custom headers that will be added to the webhook notifications. 6395 CustomHeaders map[string]*string `json:"customHeaders"` 6396 // Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled' 6397 Status WebhookStatus `json:"status,omitempty"` 6398 // 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. 6399 Scope *string `json:"scope,omitempty"` 6400 // Actions - The list of actions that trigger the webhook to post notifications. 6401 Actions *[]WebhookAction `json:"actions,omitempty"` 6402} 6403 6404// MarshalJSON is the custom marshaler for WebhookPropertiesUpdateParameters. 6405func (wpup WebhookPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { 6406 objectMap := make(map[string]interface{}) 6407 if wpup.ServiceURI != nil { 6408 objectMap["serviceUri"] = wpup.ServiceURI 6409 } 6410 if wpup.CustomHeaders != nil { 6411 objectMap["customHeaders"] = wpup.CustomHeaders 6412 } 6413 if wpup.Status != "" { 6414 objectMap["status"] = wpup.Status 6415 } 6416 if wpup.Scope != nil { 6417 objectMap["scope"] = wpup.Scope 6418 } 6419 if wpup.Actions != nil { 6420 objectMap["actions"] = wpup.Actions 6421 } 6422 return json.Marshal(objectMap) 6423} 6424 6425// WebhooksCreateFuture an abstraction for monitoring and retrieving the results of a long-running 6426// operation. 6427type WebhooksCreateFuture struct { 6428 azure.FutureAPI 6429 // Result returns the result of the asynchronous operation. 6430 // If the operation has not completed it will return an error. 6431 Result func(WebhooksClient) (Webhook, error) 6432} 6433 6434// WebhooksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 6435// operation. 6436type WebhooksDeleteFuture struct { 6437 azure.FutureAPI 6438 // Result returns the result of the asynchronous operation. 6439 // If the operation has not completed it will return an error. 6440 Result func(WebhooksClient) (autorest.Response, error) 6441} 6442 6443// WebhooksUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 6444// operation. 6445type WebhooksUpdateFuture struct { 6446 azure.FutureAPI 6447 // Result returns the result of the asynchronous operation. 6448 // If the operation has not completed it will return an error. 6449 Result func(WebhooksClient) (Webhook, error) 6450} 6451 6452// WebhookUpdateParameters the parameters for updating a webhook. 6453type WebhookUpdateParameters struct { 6454 // Tags - The tags for the webhook. 6455 Tags map[string]*string `json:"tags"` 6456 // WebhookPropertiesUpdateParameters - The properties that the webhook will be updated with. 6457 *WebhookPropertiesUpdateParameters `json:"properties,omitempty"` 6458} 6459 6460// MarshalJSON is the custom marshaler for WebhookUpdateParameters. 6461func (wup WebhookUpdateParameters) MarshalJSON() ([]byte, error) { 6462 objectMap := make(map[string]interface{}) 6463 if wup.Tags != nil { 6464 objectMap["tags"] = wup.Tags 6465 } 6466 if wup.WebhookPropertiesUpdateParameters != nil { 6467 objectMap["properties"] = wup.WebhookPropertiesUpdateParameters 6468 } 6469 return json.Marshal(objectMap) 6470} 6471 6472// UnmarshalJSON is the custom unmarshaler for WebhookUpdateParameters struct. 6473func (wup *WebhookUpdateParameters) UnmarshalJSON(body []byte) error { 6474 var m map[string]*json.RawMessage 6475 err := json.Unmarshal(body, &m) 6476 if err != nil { 6477 return err 6478 } 6479 for k, v := range m { 6480 switch k { 6481 case "tags": 6482 if v != nil { 6483 var tags map[string]*string 6484 err = json.Unmarshal(*v, &tags) 6485 if err != nil { 6486 return err 6487 } 6488 wup.Tags = tags 6489 } 6490 case "properties": 6491 if v != nil { 6492 var webhookPropertiesUpdateParameters WebhookPropertiesUpdateParameters 6493 err = json.Unmarshal(*v, &webhookPropertiesUpdateParameters) 6494 if err != nil { 6495 return err 6496 } 6497 wup.WebhookPropertiesUpdateParameters = &webhookPropertiesUpdateParameters 6498 } 6499 } 6500 } 6501 6502 return nil 6503} 6504