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