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