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