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-05-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 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// Policies the policies for a container registry. 1574type Policies struct { 1575 // QuarantinePolicy - The quarantine policy for a container registry. 1576 QuarantinePolicy *QuarantinePolicy `json:"quarantinePolicy,omitempty"` 1577 // TrustPolicy - The content trust policy for a container registry. 1578 TrustPolicy *TrustPolicy `json:"trustPolicy,omitempty"` 1579 // RetentionPolicy - The retention policy for a container registry. 1580 RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` 1581} 1582 1583// ProxyResource the resource model definition for a ARM proxy resource. It will have everything other than 1584// required location and tags. 1585type ProxyResource struct { 1586 // ID - READ-ONLY; The resource ID. 1587 ID *string `json:"id,omitempty"` 1588 // Name - READ-ONLY; The name of the resource. 1589 Name *string `json:"name,omitempty"` 1590 // Type - READ-ONLY; The type of the resource. 1591 Type *string `json:"type,omitempty"` 1592} 1593 1594// QuarantinePolicy the quarantine policy for a container registry. 1595type QuarantinePolicy struct { 1596 // Status - The value that indicates whether the policy is enabled or not. Possible values include: 'Enabled', 'Disabled' 1597 Status PolicyStatus `json:"status,omitempty"` 1598} 1599 1600// RegenerateCredentialParameters the parameters used to regenerate the login credential. 1601type RegenerateCredentialParameters struct { 1602 // Name - Specifies name of the password which should be regenerated -- password or password2. Possible values include: 'Password', 'Password2' 1603 Name PasswordName `json:"name,omitempty"` 1604} 1605 1606// RegistriesCreateFuture an abstraction for monitoring and retrieving the results of a long-running 1607// operation. 1608type RegistriesCreateFuture struct { 1609 azure.FutureAPI 1610 // Result returns the result of the asynchronous operation. 1611 // If the operation has not completed it will return an error. 1612 Result func(RegistriesClient) (Registry, error) 1613} 1614 1615// RegistriesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 1616// operation. 1617type RegistriesDeleteFuture struct { 1618 azure.FutureAPI 1619 // Result returns the result of the asynchronous operation. 1620 // If the operation has not completed it will return an error. 1621 Result func(RegistriesClient) (autorest.Response, error) 1622} 1623 1624// RegistriesImportImageFuture an abstraction for monitoring and retrieving the results of a long-running 1625// operation. 1626type RegistriesImportImageFuture struct { 1627 azure.FutureAPI 1628 // Result returns the result of the asynchronous operation. 1629 // If the operation has not completed it will return an error. 1630 Result func(RegistriesClient) (autorest.Response, error) 1631} 1632 1633// RegistriesScheduleRunFuture an abstraction for monitoring and retrieving the results of a long-running 1634// operation. 1635type RegistriesScheduleRunFuture struct { 1636 azure.FutureAPI 1637 // Result returns the result of the asynchronous operation. 1638 // If the operation has not completed it will return an error. 1639 Result func(RegistriesClient) (Run, error) 1640} 1641 1642// RegistriesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 1643// operation. 1644type RegistriesUpdateFuture struct { 1645 azure.FutureAPI 1646 // Result returns the result of the asynchronous operation. 1647 // If the operation has not completed it will return an error. 1648 Result func(RegistriesClient) (Registry, error) 1649} 1650 1651// Registry an object that represents a container registry. 1652type Registry struct { 1653 autorest.Response `json:"-"` 1654 // Sku - The SKU of the container registry. 1655 Sku *Sku `json:"sku,omitempty"` 1656 // RegistryProperties - The properties of the container registry. 1657 *RegistryProperties `json:"properties,omitempty"` 1658 // ID - READ-ONLY; The resource ID. 1659 ID *string `json:"id,omitempty"` 1660 // Name - READ-ONLY; The name of the resource. 1661 Name *string `json:"name,omitempty"` 1662 // Type - READ-ONLY; The type of the resource. 1663 Type *string `json:"type,omitempty"` 1664 // Location - The location of the resource. This cannot be changed after the resource is created. 1665 Location *string `json:"location,omitempty"` 1666 // Tags - The tags of the resource. 1667 Tags map[string]*string `json:"tags"` 1668} 1669 1670// MarshalJSON is the custom marshaler for Registry. 1671func (r Registry) MarshalJSON() ([]byte, error) { 1672 objectMap := make(map[string]interface{}) 1673 if r.Sku != nil { 1674 objectMap["sku"] = r.Sku 1675 } 1676 if r.RegistryProperties != nil { 1677 objectMap["properties"] = r.RegistryProperties 1678 } 1679 if r.Location != nil { 1680 objectMap["location"] = r.Location 1681 } 1682 if r.Tags != nil { 1683 objectMap["tags"] = r.Tags 1684 } 1685 return json.Marshal(objectMap) 1686} 1687 1688// UnmarshalJSON is the custom unmarshaler for Registry struct. 1689func (r *Registry) UnmarshalJSON(body []byte) error { 1690 var m map[string]*json.RawMessage 1691 err := json.Unmarshal(body, &m) 1692 if err != nil { 1693 return err 1694 } 1695 for k, v := range m { 1696 switch k { 1697 case "sku": 1698 if v != nil { 1699 var sku Sku 1700 err = json.Unmarshal(*v, &sku) 1701 if err != nil { 1702 return err 1703 } 1704 r.Sku = &sku 1705 } 1706 case "properties": 1707 if v != nil { 1708 var registryProperties RegistryProperties 1709 err = json.Unmarshal(*v, ®istryProperties) 1710 if err != nil { 1711 return err 1712 } 1713 r.RegistryProperties = ®istryProperties 1714 } 1715 case "id": 1716 if v != nil { 1717 var ID string 1718 err = json.Unmarshal(*v, &ID) 1719 if err != nil { 1720 return err 1721 } 1722 r.ID = &ID 1723 } 1724 case "name": 1725 if v != nil { 1726 var name string 1727 err = json.Unmarshal(*v, &name) 1728 if err != nil { 1729 return err 1730 } 1731 r.Name = &name 1732 } 1733 case "type": 1734 if v != nil { 1735 var typeVar string 1736 err = json.Unmarshal(*v, &typeVar) 1737 if err != nil { 1738 return err 1739 } 1740 r.Type = &typeVar 1741 } 1742 case "location": 1743 if v != nil { 1744 var location string 1745 err = json.Unmarshal(*v, &location) 1746 if err != nil { 1747 return err 1748 } 1749 r.Location = &location 1750 } 1751 case "tags": 1752 if v != nil { 1753 var tags map[string]*string 1754 err = json.Unmarshal(*v, &tags) 1755 if err != nil { 1756 return err 1757 } 1758 r.Tags = tags 1759 } 1760 } 1761 } 1762 1763 return nil 1764} 1765 1766// RegistryListCredentialsResult the response from the ListCredentials operation. 1767type RegistryListCredentialsResult struct { 1768 autorest.Response `json:"-"` 1769 // Username - The username for a container registry. 1770 Username *string `json:"username,omitempty"` 1771 // Passwords - The list of passwords for a container registry. 1772 Passwords *[]RegistryPassword `json:"passwords,omitempty"` 1773} 1774 1775// RegistryListResult the result of a request to list container registries. 1776type RegistryListResult struct { 1777 autorest.Response `json:"-"` 1778 // 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. 1779 Value *[]Registry `json:"value,omitempty"` 1780 // NextLink - The URI that can be used to request the next list of container registries. 1781 NextLink *string `json:"nextLink,omitempty"` 1782} 1783 1784// RegistryListResultIterator provides access to a complete listing of Registry values. 1785type RegistryListResultIterator struct { 1786 i int 1787 page RegistryListResultPage 1788} 1789 1790// NextWithContext advances to the next value. If there was an error making 1791// the request the iterator does not advance and the error is returned. 1792func (iter *RegistryListResultIterator) NextWithContext(ctx context.Context) (err error) { 1793 if tracing.IsEnabled() { 1794 ctx = tracing.StartSpan(ctx, fqdn+"/RegistryListResultIterator.NextWithContext") 1795 defer func() { 1796 sc := -1 1797 if iter.Response().Response.Response != nil { 1798 sc = iter.Response().Response.Response.StatusCode 1799 } 1800 tracing.EndSpan(ctx, sc, err) 1801 }() 1802 } 1803 iter.i++ 1804 if iter.i < len(iter.page.Values()) { 1805 return nil 1806 } 1807 err = iter.page.NextWithContext(ctx) 1808 if err != nil { 1809 iter.i-- 1810 return err 1811 } 1812 iter.i = 0 1813 return nil 1814} 1815 1816// Next advances to the next value. If there was an error making 1817// the request the iterator does not advance and the error is returned. 1818// Deprecated: Use NextWithContext() instead. 1819func (iter *RegistryListResultIterator) Next() error { 1820 return iter.NextWithContext(context.Background()) 1821} 1822 1823// NotDone returns true if the enumeration should be started or is not yet complete. 1824func (iter RegistryListResultIterator) NotDone() bool { 1825 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1826} 1827 1828// Response returns the raw server response from the last page request. 1829func (iter RegistryListResultIterator) Response() RegistryListResult { 1830 return iter.page.Response() 1831} 1832 1833// Value returns the current value or a zero-initialized value if the 1834// iterator has advanced beyond the end of the collection. 1835func (iter RegistryListResultIterator) Value() Registry { 1836 if !iter.page.NotDone() { 1837 return Registry{} 1838 } 1839 return iter.page.Values()[iter.i] 1840} 1841 1842// Creates a new instance of the RegistryListResultIterator type. 1843func NewRegistryListResultIterator(page RegistryListResultPage) RegistryListResultIterator { 1844 return RegistryListResultIterator{page: page} 1845} 1846 1847// IsEmpty returns true if the ListResult contains no values. 1848func (rlr RegistryListResult) IsEmpty() bool { 1849 return rlr.Value == nil || len(*rlr.Value) == 0 1850} 1851 1852// hasNextLink returns true if the NextLink is not empty. 1853func (rlr RegistryListResult) hasNextLink() bool { 1854 return rlr.NextLink != nil && len(*rlr.NextLink) != 0 1855} 1856 1857// registryListResultPreparer prepares a request to retrieve the next set of results. 1858// It returns nil if no more results exist. 1859func (rlr RegistryListResult) registryListResultPreparer(ctx context.Context) (*http.Request, error) { 1860 if !rlr.hasNextLink() { 1861 return nil, nil 1862 } 1863 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1864 autorest.AsJSON(), 1865 autorest.AsGet(), 1866 autorest.WithBaseURL(to.String(rlr.NextLink))) 1867} 1868 1869// RegistryListResultPage contains a page of Registry values. 1870type RegistryListResultPage struct { 1871 fn func(context.Context, RegistryListResult) (RegistryListResult, error) 1872 rlr RegistryListResult 1873} 1874 1875// NextWithContext advances to the next page of values. If there was an error making 1876// the request the page does not advance and the error is returned. 1877func (page *RegistryListResultPage) NextWithContext(ctx context.Context) (err error) { 1878 if tracing.IsEnabled() { 1879 ctx = tracing.StartSpan(ctx, fqdn+"/RegistryListResultPage.NextWithContext") 1880 defer func() { 1881 sc := -1 1882 if page.Response().Response.Response != nil { 1883 sc = page.Response().Response.Response.StatusCode 1884 } 1885 tracing.EndSpan(ctx, sc, err) 1886 }() 1887 } 1888 for { 1889 next, err := page.fn(ctx, page.rlr) 1890 if err != nil { 1891 return err 1892 } 1893 page.rlr = next 1894 if !next.hasNextLink() || !next.IsEmpty() { 1895 break 1896 } 1897 } 1898 return nil 1899} 1900 1901// Next advances to the next page of values. If there was an error making 1902// the request the page does not advance and the error is returned. 1903// Deprecated: Use NextWithContext() instead. 1904func (page *RegistryListResultPage) Next() error { 1905 return page.NextWithContext(context.Background()) 1906} 1907 1908// NotDone returns true if the page enumeration should be started or is not yet complete. 1909func (page RegistryListResultPage) NotDone() bool { 1910 return !page.rlr.IsEmpty() 1911} 1912 1913// Response returns the raw server response from the last page request. 1914func (page RegistryListResultPage) Response() RegistryListResult { 1915 return page.rlr 1916} 1917 1918// Values returns the slice of values for the current page or nil if there are no values. 1919func (page RegistryListResultPage) Values() []Registry { 1920 if page.rlr.IsEmpty() { 1921 return nil 1922 } 1923 return *page.rlr.Value 1924} 1925 1926// Creates a new instance of the RegistryListResultPage type. 1927func NewRegistryListResultPage(cur RegistryListResult, getNextPage func(context.Context, RegistryListResult) (RegistryListResult, error)) RegistryListResultPage { 1928 return RegistryListResultPage{ 1929 fn: getNextPage, 1930 rlr: cur, 1931 } 1932} 1933 1934// RegistryNameCheckRequest a request to check whether a container registry name is available. 1935type RegistryNameCheckRequest struct { 1936 // Name - The name of the container registry. 1937 Name *string `json:"name,omitempty"` 1938 // Type - The resource type of the container registry. This field must be set to 'Microsoft.ContainerRegistry/registries'. 1939 Type *string `json:"type,omitempty"` 1940} 1941 1942// RegistryNameStatus the result of a request to check the availability of a container registry name. 1943type RegistryNameStatus struct { 1944 autorest.Response `json:"-"` 1945 // NameAvailable - The value that indicates whether the name is available. 1946 NameAvailable *bool `json:"nameAvailable,omitempty"` 1947 // Reason - If any, the reason that the name is not available. 1948 Reason *string `json:"reason,omitempty"` 1949 // Message - If any, the error message that provides more detail for the reason that the name is not available. 1950 Message *string `json:"message,omitempty"` 1951} 1952 1953// RegistryPassword the login password for the container registry. 1954type RegistryPassword struct { 1955 // Name - The password name. Possible values include: 'Password', 'Password2' 1956 Name PasswordName `json:"name,omitempty"` 1957 // Value - The password value. 1958 Value *string `json:"value,omitempty"` 1959} 1960 1961// RegistryProperties the properties of a container registry. 1962type RegistryProperties struct { 1963 // LoginServer - READ-ONLY; The URL that can be used to log into the container registry. 1964 LoginServer *string `json:"loginServer,omitempty"` 1965 // CreationDate - READ-ONLY; The creation date of the container registry in ISO8601 format. 1966 CreationDate *date.Time `json:"creationDate,omitempty"` 1967 // 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' 1968 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 1969 // Status - READ-ONLY; The status of the container registry at the time the operation was called. 1970 Status *Status `json:"status,omitempty"` 1971 // AdminUserEnabled - The value that indicates whether the admin user is enabled. 1972 AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"` 1973 // StorageAccount - The properties of the storage account for the container registry. Only applicable to Classic SKU. 1974 StorageAccount *StorageAccountProperties `json:"storageAccount,omitempty"` 1975 // NetworkRuleSet - The network rule set for a container registry. 1976 NetworkRuleSet *NetworkRuleSet `json:"networkRuleSet,omitempty"` 1977 // Policies - The policies for a container registry. 1978 Policies *Policies `json:"policies,omitempty"` 1979} 1980 1981// MarshalJSON is the custom marshaler for RegistryProperties. 1982func (rp RegistryProperties) MarshalJSON() ([]byte, error) { 1983 objectMap := make(map[string]interface{}) 1984 if rp.AdminUserEnabled != nil { 1985 objectMap["adminUserEnabled"] = rp.AdminUserEnabled 1986 } 1987 if rp.StorageAccount != nil { 1988 objectMap["storageAccount"] = rp.StorageAccount 1989 } 1990 if rp.NetworkRuleSet != nil { 1991 objectMap["networkRuleSet"] = rp.NetworkRuleSet 1992 } 1993 if rp.Policies != nil { 1994 objectMap["policies"] = rp.Policies 1995 } 1996 return json.Marshal(objectMap) 1997} 1998 1999// RegistryPropertiesUpdateParameters the parameters for updating the properties of a container registry. 2000type RegistryPropertiesUpdateParameters struct { 2001 // AdminUserEnabled - The value that indicates whether the admin user is enabled. 2002 AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"` 2003 // NetworkRuleSet - The network rule set for a container registry. 2004 NetworkRuleSet *NetworkRuleSet `json:"networkRuleSet,omitempty"` 2005 // Policies - The policies for a container registry. 2006 Policies *Policies `json:"policies,omitempty"` 2007} 2008 2009// RegistryUpdateParameters the parameters for updating a container registry. 2010type RegistryUpdateParameters struct { 2011 // Tags - The tags for the container registry. 2012 Tags map[string]*string `json:"tags"` 2013 // Sku - The SKU of the container registry. 2014 Sku *Sku `json:"sku,omitempty"` 2015 // RegistryPropertiesUpdateParameters - The properties that the container registry will be updated with. 2016 *RegistryPropertiesUpdateParameters `json:"properties,omitempty"` 2017} 2018 2019// MarshalJSON is the custom marshaler for RegistryUpdateParameters. 2020func (rup RegistryUpdateParameters) MarshalJSON() ([]byte, error) { 2021 objectMap := make(map[string]interface{}) 2022 if rup.Tags != nil { 2023 objectMap["tags"] = rup.Tags 2024 } 2025 if rup.Sku != nil { 2026 objectMap["sku"] = rup.Sku 2027 } 2028 if rup.RegistryPropertiesUpdateParameters != nil { 2029 objectMap["properties"] = rup.RegistryPropertiesUpdateParameters 2030 } 2031 return json.Marshal(objectMap) 2032} 2033 2034// UnmarshalJSON is the custom unmarshaler for RegistryUpdateParameters struct. 2035func (rup *RegistryUpdateParameters) UnmarshalJSON(body []byte) error { 2036 var m map[string]*json.RawMessage 2037 err := json.Unmarshal(body, &m) 2038 if err != nil { 2039 return err 2040 } 2041 for k, v := range m { 2042 switch k { 2043 case "tags": 2044 if v != nil { 2045 var tags map[string]*string 2046 err = json.Unmarshal(*v, &tags) 2047 if err != nil { 2048 return err 2049 } 2050 rup.Tags = tags 2051 } 2052 case "sku": 2053 if v != nil { 2054 var sku Sku 2055 err = json.Unmarshal(*v, &sku) 2056 if err != nil { 2057 return err 2058 } 2059 rup.Sku = &sku 2060 } 2061 case "properties": 2062 if v != nil { 2063 var registryPropertiesUpdateParameters RegistryPropertiesUpdateParameters 2064 err = json.Unmarshal(*v, ®istryPropertiesUpdateParameters) 2065 if err != nil { 2066 return err 2067 } 2068 rup.RegistryPropertiesUpdateParameters = ®istryPropertiesUpdateParameters 2069 } 2070 } 2071 } 2072 2073 return nil 2074} 2075 2076// RegistryUsage the quota usage for a container registry. 2077type RegistryUsage struct { 2078 // Name - The name of the usage. 2079 Name *string `json:"name,omitempty"` 2080 // Limit - The limit of the usage. 2081 Limit *int64 `json:"limit,omitempty"` 2082 // CurrentValue - The current value of the usage. 2083 CurrentValue *int64 `json:"currentValue,omitempty"` 2084 // Unit - The unit of measurement. Possible values include: 'Count', 'Bytes' 2085 Unit RegistryUsageUnit `json:"unit,omitempty"` 2086} 2087 2088// RegistryUsageListResult the result of a request to get container registry quota usages. 2089type RegistryUsageListResult struct { 2090 autorest.Response `json:"-"` 2091 // Value - The list of container registry quota usages. 2092 Value *[]RegistryUsage `json:"value,omitempty"` 2093} 2094 2095// Replication an object that represents a replication for a container registry. 2096type Replication struct { 2097 autorest.Response `json:"-"` 2098 // ReplicationProperties - The properties of the replication. 2099 *ReplicationProperties `json:"properties,omitempty"` 2100 // ID - READ-ONLY; The resource ID. 2101 ID *string `json:"id,omitempty"` 2102 // Name - READ-ONLY; The name of the resource. 2103 Name *string `json:"name,omitempty"` 2104 // Type - READ-ONLY; The type of the resource. 2105 Type *string `json:"type,omitempty"` 2106 // Location - The location of the resource. This cannot be changed after the resource is created. 2107 Location *string `json:"location,omitempty"` 2108 // Tags - The tags of the resource. 2109 Tags map[string]*string `json:"tags"` 2110} 2111 2112// MarshalJSON is the custom marshaler for Replication. 2113func (r Replication) MarshalJSON() ([]byte, error) { 2114 objectMap := make(map[string]interface{}) 2115 if r.ReplicationProperties != nil { 2116 objectMap["properties"] = r.ReplicationProperties 2117 } 2118 if r.Location != nil { 2119 objectMap["location"] = r.Location 2120 } 2121 if r.Tags != nil { 2122 objectMap["tags"] = r.Tags 2123 } 2124 return json.Marshal(objectMap) 2125} 2126 2127// UnmarshalJSON is the custom unmarshaler for Replication struct. 2128func (r *Replication) UnmarshalJSON(body []byte) error { 2129 var m map[string]*json.RawMessage 2130 err := json.Unmarshal(body, &m) 2131 if err != nil { 2132 return err 2133 } 2134 for k, v := range m { 2135 switch k { 2136 case "properties": 2137 if v != nil { 2138 var replicationProperties ReplicationProperties 2139 err = json.Unmarshal(*v, &replicationProperties) 2140 if err != nil { 2141 return err 2142 } 2143 r.ReplicationProperties = &replicationProperties 2144 } 2145 case "id": 2146 if v != nil { 2147 var ID string 2148 err = json.Unmarshal(*v, &ID) 2149 if err != nil { 2150 return err 2151 } 2152 r.ID = &ID 2153 } 2154 case "name": 2155 if v != nil { 2156 var name string 2157 err = json.Unmarshal(*v, &name) 2158 if err != nil { 2159 return err 2160 } 2161 r.Name = &name 2162 } 2163 case "type": 2164 if v != nil { 2165 var typeVar string 2166 err = json.Unmarshal(*v, &typeVar) 2167 if err != nil { 2168 return err 2169 } 2170 r.Type = &typeVar 2171 } 2172 case "location": 2173 if v != nil { 2174 var location string 2175 err = json.Unmarshal(*v, &location) 2176 if err != nil { 2177 return err 2178 } 2179 r.Location = &location 2180 } 2181 case "tags": 2182 if v != nil { 2183 var tags map[string]*string 2184 err = json.Unmarshal(*v, &tags) 2185 if err != nil { 2186 return err 2187 } 2188 r.Tags = tags 2189 } 2190 } 2191 } 2192 2193 return nil 2194} 2195 2196// ReplicationListResult the result of a request to list replications for a container registry. 2197type ReplicationListResult struct { 2198 autorest.Response `json:"-"` 2199 // Value - The list of replications. Since this list may be incomplete, the nextLink field should be used to request the next list of replications. 2200 Value *[]Replication `json:"value,omitempty"` 2201 // NextLink - The URI that can be used to request the next list of replications. 2202 NextLink *string `json:"nextLink,omitempty"` 2203} 2204 2205// ReplicationListResultIterator provides access to a complete listing of Replication values. 2206type ReplicationListResultIterator struct { 2207 i int 2208 page ReplicationListResultPage 2209} 2210 2211// NextWithContext advances to the next value. If there was an error making 2212// the request the iterator does not advance and the error is returned. 2213func (iter *ReplicationListResultIterator) NextWithContext(ctx context.Context) (err error) { 2214 if tracing.IsEnabled() { 2215 ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationListResultIterator.NextWithContext") 2216 defer func() { 2217 sc := -1 2218 if iter.Response().Response.Response != nil { 2219 sc = iter.Response().Response.Response.StatusCode 2220 } 2221 tracing.EndSpan(ctx, sc, err) 2222 }() 2223 } 2224 iter.i++ 2225 if iter.i < len(iter.page.Values()) { 2226 return nil 2227 } 2228 err = iter.page.NextWithContext(ctx) 2229 if err != nil { 2230 iter.i-- 2231 return err 2232 } 2233 iter.i = 0 2234 return nil 2235} 2236 2237// Next advances to the next value. If there was an error making 2238// the request the iterator does not advance and the error is returned. 2239// Deprecated: Use NextWithContext() instead. 2240func (iter *ReplicationListResultIterator) Next() error { 2241 return iter.NextWithContext(context.Background()) 2242} 2243 2244// NotDone returns true if the enumeration should be started or is not yet complete. 2245func (iter ReplicationListResultIterator) NotDone() bool { 2246 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2247} 2248 2249// Response returns the raw server response from the last page request. 2250func (iter ReplicationListResultIterator) Response() ReplicationListResult { 2251 return iter.page.Response() 2252} 2253 2254// Value returns the current value or a zero-initialized value if the 2255// iterator has advanced beyond the end of the collection. 2256func (iter ReplicationListResultIterator) Value() Replication { 2257 if !iter.page.NotDone() { 2258 return Replication{} 2259 } 2260 return iter.page.Values()[iter.i] 2261} 2262 2263// Creates a new instance of the ReplicationListResultIterator type. 2264func NewReplicationListResultIterator(page ReplicationListResultPage) ReplicationListResultIterator { 2265 return ReplicationListResultIterator{page: page} 2266} 2267 2268// IsEmpty returns true if the ListResult contains no values. 2269func (rlr ReplicationListResult) IsEmpty() bool { 2270 return rlr.Value == nil || len(*rlr.Value) == 0 2271} 2272 2273// hasNextLink returns true if the NextLink is not empty. 2274func (rlr ReplicationListResult) hasNextLink() bool { 2275 return rlr.NextLink != nil && len(*rlr.NextLink) != 0 2276} 2277 2278// replicationListResultPreparer prepares a request to retrieve the next set of results. 2279// It returns nil if no more results exist. 2280func (rlr ReplicationListResult) replicationListResultPreparer(ctx context.Context) (*http.Request, error) { 2281 if !rlr.hasNextLink() { 2282 return nil, nil 2283 } 2284 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2285 autorest.AsJSON(), 2286 autorest.AsGet(), 2287 autorest.WithBaseURL(to.String(rlr.NextLink))) 2288} 2289 2290// ReplicationListResultPage contains a page of Replication values. 2291type ReplicationListResultPage struct { 2292 fn func(context.Context, ReplicationListResult) (ReplicationListResult, error) 2293 rlr ReplicationListResult 2294} 2295 2296// NextWithContext advances to the next page of values. If there was an error making 2297// the request the page does not advance and the error is returned. 2298func (page *ReplicationListResultPage) NextWithContext(ctx context.Context) (err error) { 2299 if tracing.IsEnabled() { 2300 ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationListResultPage.NextWithContext") 2301 defer func() { 2302 sc := -1 2303 if page.Response().Response.Response != nil { 2304 sc = page.Response().Response.Response.StatusCode 2305 } 2306 tracing.EndSpan(ctx, sc, err) 2307 }() 2308 } 2309 for { 2310 next, err := page.fn(ctx, page.rlr) 2311 if err != nil { 2312 return err 2313 } 2314 page.rlr = next 2315 if !next.hasNextLink() || !next.IsEmpty() { 2316 break 2317 } 2318 } 2319 return nil 2320} 2321 2322// Next advances to the next page of values. If there was an error making 2323// the request the page does not advance and the error is returned. 2324// Deprecated: Use NextWithContext() instead. 2325func (page *ReplicationListResultPage) Next() error { 2326 return page.NextWithContext(context.Background()) 2327} 2328 2329// NotDone returns true if the page enumeration should be started or is not yet complete. 2330func (page ReplicationListResultPage) NotDone() bool { 2331 return !page.rlr.IsEmpty() 2332} 2333 2334// Response returns the raw server response from the last page request. 2335func (page ReplicationListResultPage) Response() ReplicationListResult { 2336 return page.rlr 2337} 2338 2339// Values returns the slice of values for the current page or nil if there are no values. 2340func (page ReplicationListResultPage) Values() []Replication { 2341 if page.rlr.IsEmpty() { 2342 return nil 2343 } 2344 return *page.rlr.Value 2345} 2346 2347// Creates a new instance of the ReplicationListResultPage type. 2348func NewReplicationListResultPage(cur ReplicationListResult, getNextPage func(context.Context, ReplicationListResult) (ReplicationListResult, error)) ReplicationListResultPage { 2349 return ReplicationListResultPage{ 2350 fn: getNextPage, 2351 rlr: cur, 2352 } 2353} 2354 2355// ReplicationProperties the properties of a replication. 2356type ReplicationProperties struct { 2357 // 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' 2358 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 2359 // Status - READ-ONLY; The status of the replication at the time the operation was called. 2360 Status *Status `json:"status,omitempty"` 2361} 2362 2363// ReplicationsCreateFuture an abstraction for monitoring and retrieving the results of a long-running 2364// operation. 2365type ReplicationsCreateFuture struct { 2366 azure.FutureAPI 2367 // Result returns the result of the asynchronous operation. 2368 // If the operation has not completed it will return an error. 2369 Result func(ReplicationsClient) (Replication, error) 2370} 2371 2372// ReplicationsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 2373// operation. 2374type ReplicationsDeleteFuture struct { 2375 azure.FutureAPI 2376 // Result returns the result of the asynchronous operation. 2377 // If the operation has not completed it will return an error. 2378 Result func(ReplicationsClient) (autorest.Response, error) 2379} 2380 2381// ReplicationsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 2382// operation. 2383type ReplicationsUpdateFuture struct { 2384 azure.FutureAPI 2385 // Result returns the result of the asynchronous operation. 2386 // If the operation has not completed it will return an error. 2387 Result func(ReplicationsClient) (Replication, error) 2388} 2389 2390// ReplicationUpdateParameters the parameters for updating a replication. 2391type ReplicationUpdateParameters struct { 2392 // Tags - The tags for the replication. 2393 Tags map[string]*string `json:"tags"` 2394} 2395 2396// MarshalJSON is the custom marshaler for ReplicationUpdateParameters. 2397func (rup ReplicationUpdateParameters) MarshalJSON() ([]byte, error) { 2398 objectMap := make(map[string]interface{}) 2399 if rup.Tags != nil { 2400 objectMap["tags"] = rup.Tags 2401 } 2402 return json.Marshal(objectMap) 2403} 2404 2405// Request the request that generated the event. 2406type Request struct { 2407 // ID - The ID of the request that initiated the event. 2408 ID *string `json:"id,omitempty"` 2409 // 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. 2410 Addr *string `json:"addr,omitempty"` 2411 // Host - The externally accessible hostname of the registry instance, as specified by the http host header on incoming requests. 2412 Host *string `json:"host,omitempty"` 2413 // Method - The request method that generated the event. 2414 Method *string `json:"method,omitempty"` 2415 // Useragent - The user agent header of the request. 2416 Useragent *string `json:"useragent,omitempty"` 2417} 2418 2419// Resource an Azure resource. 2420type Resource struct { 2421 // ID - READ-ONLY; The resource ID. 2422 ID *string `json:"id,omitempty"` 2423 // Name - READ-ONLY; The name of the resource. 2424 Name *string `json:"name,omitempty"` 2425 // Type - READ-ONLY; The type of the resource. 2426 Type *string `json:"type,omitempty"` 2427 // Location - The location of the resource. This cannot be changed after the resource is created. 2428 Location *string `json:"location,omitempty"` 2429 // Tags - The tags of the resource. 2430 Tags map[string]*string `json:"tags"` 2431} 2432 2433// MarshalJSON is the custom marshaler for Resource. 2434func (r Resource) MarshalJSON() ([]byte, error) { 2435 objectMap := make(map[string]interface{}) 2436 if r.Location != nil { 2437 objectMap["location"] = r.Location 2438 } 2439 if r.Tags != nil { 2440 objectMap["tags"] = r.Tags 2441 } 2442 return json.Marshal(objectMap) 2443} 2444 2445// RetentionPolicy the retention policy for a container registry. 2446type RetentionPolicy struct { 2447 // Days - The number of days to retain an untagged manifest after which it gets purged. 2448 Days *int32 `json:"days,omitempty"` 2449 // LastUpdatedTime - READ-ONLY; The timestamp when the policy was last updated. 2450 LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` 2451 // Status - The value that indicates whether the policy is enabled or not. Possible values include: 'Enabled', 'Disabled' 2452 Status PolicyStatus `json:"status,omitempty"` 2453} 2454 2455// MarshalJSON is the custom marshaler for RetentionPolicy. 2456func (rp RetentionPolicy) MarshalJSON() ([]byte, error) { 2457 objectMap := make(map[string]interface{}) 2458 if rp.Days != nil { 2459 objectMap["days"] = rp.Days 2460 } 2461 if rp.Status != "" { 2462 objectMap["status"] = rp.Status 2463 } 2464 return json.Marshal(objectMap) 2465} 2466 2467// Run run resource properties 2468type Run struct { 2469 autorest.Response `json:"-"` 2470 // RunProperties - The properties of a run. 2471 *RunProperties `json:"properties,omitempty"` 2472 // ID - READ-ONLY; The resource ID. 2473 ID *string `json:"id,omitempty"` 2474 // Name - READ-ONLY; The name of the resource. 2475 Name *string `json:"name,omitempty"` 2476 // Type - READ-ONLY; The type of the resource. 2477 Type *string `json:"type,omitempty"` 2478} 2479 2480// MarshalJSON is the custom marshaler for Run. 2481func (r Run) MarshalJSON() ([]byte, error) { 2482 objectMap := make(map[string]interface{}) 2483 if r.RunProperties != nil { 2484 objectMap["properties"] = r.RunProperties 2485 } 2486 return json.Marshal(objectMap) 2487} 2488 2489// UnmarshalJSON is the custom unmarshaler for Run struct. 2490func (r *Run) UnmarshalJSON(body []byte) error { 2491 var m map[string]*json.RawMessage 2492 err := json.Unmarshal(body, &m) 2493 if err != nil { 2494 return err 2495 } 2496 for k, v := range m { 2497 switch k { 2498 case "properties": 2499 if v != nil { 2500 var runProperties RunProperties 2501 err = json.Unmarshal(*v, &runProperties) 2502 if err != nil { 2503 return err 2504 } 2505 r.RunProperties = &runProperties 2506 } 2507 case "id": 2508 if v != nil { 2509 var ID string 2510 err = json.Unmarshal(*v, &ID) 2511 if err != nil { 2512 return err 2513 } 2514 r.ID = &ID 2515 } 2516 case "name": 2517 if v != nil { 2518 var name string 2519 err = json.Unmarshal(*v, &name) 2520 if err != nil { 2521 return err 2522 } 2523 r.Name = &name 2524 } 2525 case "type": 2526 if v != nil { 2527 var typeVar string 2528 err = json.Unmarshal(*v, &typeVar) 2529 if err != nil { 2530 return err 2531 } 2532 r.Type = &typeVar 2533 } 2534 } 2535 } 2536 2537 return nil 2538} 2539 2540// RunFilter properties that are enabled for Odata querying on runs. 2541type RunFilter struct { 2542 // RunID - The unique identifier for the run. 2543 RunID *string `json:"runId,omitempty"` 2544 // RunType - The type of run. Possible values include: 'QuickBuild', 'QuickRun', 'AutoBuild', 'AutoRun' 2545 RunType RunType `json:"runType,omitempty"` 2546 // Status - The current status of the run. Possible values include: 'RunStatusQueued', 'RunStatusStarted', 'RunStatusRunning', 'RunStatusSucceeded', 'RunStatusFailed', 'RunStatusCanceled', 'RunStatusError', 'RunStatusTimeout' 2547 Status RunStatus `json:"status,omitempty"` 2548 // CreateTime - The create time for a run. 2549 CreateTime *date.Time `json:"createTime,omitempty"` 2550 // FinishTime - The time the run finished. 2551 FinishTime *date.Time `json:"finishTime,omitempty"` 2552 // OutputImageManifests - The list of comma-separated image manifests that were generated from the run. This is applicable if the run is of 2553 // build type. 2554 OutputImageManifests *string `json:"outputImageManifests,omitempty"` 2555 // IsArchiveEnabled - The value that indicates whether archiving is enabled or not. 2556 IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` 2557 // TaskName - The name of the task that the run corresponds to. 2558 TaskName *string `json:"taskName,omitempty"` 2559} 2560 2561// RunGetLogResult the result of get log link operation. 2562type RunGetLogResult struct { 2563 autorest.Response `json:"-"` 2564 // LogLink - The link to logs for a run on a azure container registry. 2565 LogLink *string `json:"logLink,omitempty"` 2566} 2567 2568// RunListResult collection of runs. 2569type RunListResult struct { 2570 autorest.Response `json:"-"` 2571 // Value - The collection value. 2572 Value *[]Run `json:"value,omitempty"` 2573 // NextLink - The URI that can be used to request the next set of paged results. 2574 NextLink *string `json:"nextLink,omitempty"` 2575} 2576 2577// RunListResultIterator provides access to a complete listing of Run values. 2578type RunListResultIterator struct { 2579 i int 2580 page RunListResultPage 2581} 2582 2583// NextWithContext advances to the next value. If there was an error making 2584// the request the iterator does not advance and the error is returned. 2585func (iter *RunListResultIterator) NextWithContext(ctx context.Context) (err error) { 2586 if tracing.IsEnabled() { 2587 ctx = tracing.StartSpan(ctx, fqdn+"/RunListResultIterator.NextWithContext") 2588 defer func() { 2589 sc := -1 2590 if iter.Response().Response.Response != nil { 2591 sc = iter.Response().Response.Response.StatusCode 2592 } 2593 tracing.EndSpan(ctx, sc, err) 2594 }() 2595 } 2596 iter.i++ 2597 if iter.i < len(iter.page.Values()) { 2598 return nil 2599 } 2600 err = iter.page.NextWithContext(ctx) 2601 if err != nil { 2602 iter.i-- 2603 return err 2604 } 2605 iter.i = 0 2606 return nil 2607} 2608 2609// Next advances to the next value. If there was an error making 2610// the request the iterator does not advance and the error is returned. 2611// Deprecated: Use NextWithContext() instead. 2612func (iter *RunListResultIterator) Next() error { 2613 return iter.NextWithContext(context.Background()) 2614} 2615 2616// NotDone returns true if the enumeration should be started or is not yet complete. 2617func (iter RunListResultIterator) NotDone() bool { 2618 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2619} 2620 2621// Response returns the raw server response from the last page request. 2622func (iter RunListResultIterator) Response() RunListResult { 2623 return iter.page.Response() 2624} 2625 2626// Value returns the current value or a zero-initialized value if the 2627// iterator has advanced beyond the end of the collection. 2628func (iter RunListResultIterator) Value() Run { 2629 if !iter.page.NotDone() { 2630 return Run{} 2631 } 2632 return iter.page.Values()[iter.i] 2633} 2634 2635// Creates a new instance of the RunListResultIterator type. 2636func NewRunListResultIterator(page RunListResultPage) RunListResultIterator { 2637 return RunListResultIterator{page: page} 2638} 2639 2640// IsEmpty returns true if the ListResult contains no values. 2641func (rlr RunListResult) IsEmpty() bool { 2642 return rlr.Value == nil || len(*rlr.Value) == 0 2643} 2644 2645// hasNextLink returns true if the NextLink is not empty. 2646func (rlr RunListResult) hasNextLink() bool { 2647 return rlr.NextLink != nil && len(*rlr.NextLink) != 0 2648} 2649 2650// runListResultPreparer prepares a request to retrieve the next set of results. 2651// It returns nil if no more results exist. 2652func (rlr RunListResult) runListResultPreparer(ctx context.Context) (*http.Request, error) { 2653 if !rlr.hasNextLink() { 2654 return nil, nil 2655 } 2656 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2657 autorest.AsJSON(), 2658 autorest.AsGet(), 2659 autorest.WithBaseURL(to.String(rlr.NextLink))) 2660} 2661 2662// RunListResultPage contains a page of Run values. 2663type RunListResultPage struct { 2664 fn func(context.Context, RunListResult) (RunListResult, error) 2665 rlr RunListResult 2666} 2667 2668// NextWithContext advances to the next page of values. If there was an error making 2669// the request the page does not advance and the error is returned. 2670func (page *RunListResultPage) NextWithContext(ctx context.Context) (err error) { 2671 if tracing.IsEnabled() { 2672 ctx = tracing.StartSpan(ctx, fqdn+"/RunListResultPage.NextWithContext") 2673 defer func() { 2674 sc := -1 2675 if page.Response().Response.Response != nil { 2676 sc = page.Response().Response.Response.StatusCode 2677 } 2678 tracing.EndSpan(ctx, sc, err) 2679 }() 2680 } 2681 for { 2682 next, err := page.fn(ctx, page.rlr) 2683 if err != nil { 2684 return err 2685 } 2686 page.rlr = next 2687 if !next.hasNextLink() || !next.IsEmpty() { 2688 break 2689 } 2690 } 2691 return nil 2692} 2693 2694// Next advances to the next page of values. If there was an error making 2695// the request the page does not advance and the error is returned. 2696// Deprecated: Use NextWithContext() instead. 2697func (page *RunListResultPage) Next() error { 2698 return page.NextWithContext(context.Background()) 2699} 2700 2701// NotDone returns true if the page enumeration should be started or is not yet complete. 2702func (page RunListResultPage) NotDone() bool { 2703 return !page.rlr.IsEmpty() 2704} 2705 2706// Response returns the raw server response from the last page request. 2707func (page RunListResultPage) Response() RunListResult { 2708 return page.rlr 2709} 2710 2711// Values returns the slice of values for the current page or nil if there are no values. 2712func (page RunListResultPage) Values() []Run { 2713 if page.rlr.IsEmpty() { 2714 return nil 2715 } 2716 return *page.rlr.Value 2717} 2718 2719// Creates a new instance of the RunListResultPage type. 2720func NewRunListResultPage(cur RunListResult, getNextPage func(context.Context, RunListResult) (RunListResult, error)) RunListResultPage { 2721 return RunListResultPage{ 2722 fn: getNextPage, 2723 rlr: cur, 2724 } 2725} 2726 2727// RunProperties the properties for a run. 2728type RunProperties struct { 2729 // RunID - The unique identifier for the run. 2730 RunID *string `json:"runId,omitempty"` 2731 // Status - The current status of the run. Possible values include: 'RunStatusQueued', 'RunStatusStarted', 'RunStatusRunning', 'RunStatusSucceeded', 'RunStatusFailed', 'RunStatusCanceled', 'RunStatusError', 'RunStatusTimeout' 2732 Status RunStatus `json:"status,omitempty"` 2733 // LastUpdatedTime - The last updated time for the run. 2734 LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` 2735 // RunType - The type of run. Possible values include: 'QuickBuild', 'QuickRun', 'AutoBuild', 'AutoRun' 2736 RunType RunType `json:"runType,omitempty"` 2737 // CreateTime - The time the run was scheduled. 2738 CreateTime *date.Time `json:"createTime,omitempty"` 2739 // StartTime - The time the run started. 2740 StartTime *date.Time `json:"startTime,omitempty"` 2741 // FinishTime - The time the run finished. 2742 FinishTime *date.Time `json:"finishTime,omitempty"` 2743 // OutputImages - The list of all images that were generated from the run. This is applicable if the run generates base image dependencies. 2744 OutputImages *[]ImageDescriptor `json:"outputImages,omitempty"` 2745 // Task - The task against which run was scheduled. 2746 Task *string `json:"task,omitempty"` 2747 // ImageUpdateTrigger - The image update trigger that caused the run. This is applicable if the task has base image trigger configured. 2748 ImageUpdateTrigger *ImageUpdateTrigger `json:"imageUpdateTrigger,omitempty"` 2749 // SourceTrigger - The source trigger that caused the run. 2750 SourceTrigger *SourceTriggerDescriptor `json:"sourceTrigger,omitempty"` 2751 // Platform - The platform properties against which the run will happen. 2752 Platform *PlatformProperties `json:"platform,omitempty"` 2753 // AgentConfiguration - The machine configuration of the run agent. 2754 AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` 2755 // SourceRegistryAuth - The scope of the credentials that were used to login to the source registry during this run. 2756 SourceRegistryAuth *string `json:"sourceRegistryAuth,omitempty"` 2757 // CustomRegistries - The list of custom registries that were logged in during this run. 2758 CustomRegistries *[]string `json:"customRegistries,omitempty"` 2759 // RunErrorMessage - READ-ONLY; The error message received from backend systems after the run is scheduled. 2760 RunErrorMessage *string `json:"runErrorMessage,omitempty"` 2761 // ProvisioningState - The provisioning state of a run. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' 2762 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 2763 // IsArchiveEnabled - The value that indicates whether archiving is enabled or not. 2764 IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` 2765 // TimerTrigger - The timer trigger that caused the run. 2766 TimerTrigger *TimerTriggerDescriptor `json:"timerTrigger,omitempty"` 2767} 2768 2769// MarshalJSON is the custom marshaler for RunProperties. 2770func (rp RunProperties) MarshalJSON() ([]byte, error) { 2771 objectMap := make(map[string]interface{}) 2772 if rp.RunID != nil { 2773 objectMap["runId"] = rp.RunID 2774 } 2775 if rp.Status != "" { 2776 objectMap["status"] = rp.Status 2777 } 2778 if rp.LastUpdatedTime != nil { 2779 objectMap["lastUpdatedTime"] = rp.LastUpdatedTime 2780 } 2781 if rp.RunType != "" { 2782 objectMap["runType"] = rp.RunType 2783 } 2784 if rp.CreateTime != nil { 2785 objectMap["createTime"] = rp.CreateTime 2786 } 2787 if rp.StartTime != nil { 2788 objectMap["startTime"] = rp.StartTime 2789 } 2790 if rp.FinishTime != nil { 2791 objectMap["finishTime"] = rp.FinishTime 2792 } 2793 if rp.OutputImages != nil { 2794 objectMap["outputImages"] = rp.OutputImages 2795 } 2796 if rp.Task != nil { 2797 objectMap["task"] = rp.Task 2798 } 2799 if rp.ImageUpdateTrigger != nil { 2800 objectMap["imageUpdateTrigger"] = rp.ImageUpdateTrigger 2801 } 2802 if rp.SourceTrigger != nil { 2803 objectMap["sourceTrigger"] = rp.SourceTrigger 2804 } 2805 if rp.Platform != nil { 2806 objectMap["platform"] = rp.Platform 2807 } 2808 if rp.AgentConfiguration != nil { 2809 objectMap["agentConfiguration"] = rp.AgentConfiguration 2810 } 2811 if rp.SourceRegistryAuth != nil { 2812 objectMap["sourceRegistryAuth"] = rp.SourceRegistryAuth 2813 } 2814 if rp.CustomRegistries != nil { 2815 objectMap["customRegistries"] = rp.CustomRegistries 2816 } 2817 if rp.ProvisioningState != "" { 2818 objectMap["provisioningState"] = rp.ProvisioningState 2819 } 2820 if rp.IsArchiveEnabled != nil { 2821 objectMap["isArchiveEnabled"] = rp.IsArchiveEnabled 2822 } 2823 if rp.TimerTrigger != nil { 2824 objectMap["timerTrigger"] = rp.TimerTrigger 2825 } 2826 return json.Marshal(objectMap) 2827} 2828 2829// BasicRunRequest the request parameters for scheduling a run. 2830type BasicRunRequest interface { 2831 AsDockerBuildRequest() (*DockerBuildRequest, bool) 2832 AsFileTaskRunRequest() (*FileTaskRunRequest, bool) 2833 AsTaskRunRequest() (*TaskRunRequest, bool) 2834 AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) 2835 AsRunRequest() (*RunRequest, bool) 2836} 2837 2838// RunRequest the request parameters for scheduling a run. 2839type RunRequest struct { 2840 // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. 2841 IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` 2842 // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' 2843 Type Type `json:"type,omitempty"` 2844} 2845 2846func unmarshalBasicRunRequest(body []byte) (BasicRunRequest, error) { 2847 var m map[string]interface{} 2848 err := json.Unmarshal(body, &m) 2849 if err != nil { 2850 return nil, err 2851 } 2852 2853 switch m["type"] { 2854 case string(TypeDockerBuildRequest): 2855 var dbr DockerBuildRequest 2856 err := json.Unmarshal(body, &dbr) 2857 return dbr, err 2858 case string(TypeFileTaskRunRequest): 2859 var ftrr FileTaskRunRequest 2860 err := json.Unmarshal(body, &ftrr) 2861 return ftrr, err 2862 case string(TypeTaskRunRequest): 2863 var trr TaskRunRequest 2864 err := json.Unmarshal(body, &trr) 2865 return trr, err 2866 case string(TypeEncodedTaskRunRequest): 2867 var etrr EncodedTaskRunRequest 2868 err := json.Unmarshal(body, &etrr) 2869 return etrr, err 2870 default: 2871 var rr RunRequest 2872 err := json.Unmarshal(body, &rr) 2873 return rr, err 2874 } 2875} 2876func unmarshalBasicRunRequestArray(body []byte) ([]BasicRunRequest, error) { 2877 var rawMessages []*json.RawMessage 2878 err := json.Unmarshal(body, &rawMessages) 2879 if err != nil { 2880 return nil, err 2881 } 2882 2883 rrArray := make([]BasicRunRequest, len(rawMessages)) 2884 2885 for index, rawMessage := range rawMessages { 2886 rr, err := unmarshalBasicRunRequest(*rawMessage) 2887 if err != nil { 2888 return nil, err 2889 } 2890 rrArray[index] = rr 2891 } 2892 return rrArray, nil 2893} 2894 2895// MarshalJSON is the custom marshaler for RunRequest. 2896func (rr RunRequest) MarshalJSON() ([]byte, error) { 2897 rr.Type = TypeRunRequest 2898 objectMap := make(map[string]interface{}) 2899 if rr.IsArchiveEnabled != nil { 2900 objectMap["isArchiveEnabled"] = rr.IsArchiveEnabled 2901 } 2902 if rr.Type != "" { 2903 objectMap["type"] = rr.Type 2904 } 2905 return json.Marshal(objectMap) 2906} 2907 2908// AsDockerBuildRequest is the BasicRunRequest implementation for RunRequest. 2909func (rr RunRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { 2910 return nil, false 2911} 2912 2913// AsFileTaskRunRequest is the BasicRunRequest implementation for RunRequest. 2914func (rr RunRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { 2915 return nil, false 2916} 2917 2918// AsTaskRunRequest is the BasicRunRequest implementation for RunRequest. 2919func (rr RunRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { 2920 return nil, false 2921} 2922 2923// AsEncodedTaskRunRequest is the BasicRunRequest implementation for RunRequest. 2924func (rr RunRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { 2925 return nil, false 2926} 2927 2928// AsRunRequest is the BasicRunRequest implementation for RunRequest. 2929func (rr RunRequest) AsRunRequest() (*RunRequest, bool) { 2930 return &rr, true 2931} 2932 2933// AsBasicRunRequest is the BasicRunRequest implementation for RunRequest. 2934func (rr RunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { 2935 return &rr, true 2936} 2937 2938// RunsCancelFuture an abstraction for monitoring and retrieving the results of a long-running operation. 2939type RunsCancelFuture struct { 2940 azure.FutureAPI 2941 // Result returns the result of the asynchronous operation. 2942 // If the operation has not completed it will return an error. 2943 Result func(RunsClient) (autorest.Response, error) 2944} 2945 2946// RunsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 2947type RunsUpdateFuture struct { 2948 azure.FutureAPI 2949 // Result returns the result of the asynchronous operation. 2950 // If the operation has not completed it will return an error. 2951 Result func(RunsClient) (Run, error) 2952} 2953 2954// RunUpdateParameters the set of run properties that can be updated. 2955type RunUpdateParameters struct { 2956 // IsArchiveEnabled - The value that indicates whether archiving is enabled or not. 2957 IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` 2958} 2959 2960// SecretObject describes the properties of a secret object value. 2961type SecretObject struct { 2962 // Value - The value of the secret. The format of this value will be determined 2963 // based on the type of the secret object. If the type is Opaque, the value will be 2964 // used as is without any modification. 2965 Value *string `json:"value,omitempty"` 2966 // Type - The type of the secret object which determines how the value of the secret object has to be 2967 // interpreted. Possible values include: 'Opaque', 'Vaultsecret' 2968 Type SecretObjectType `json:"type,omitempty"` 2969} 2970 2971// SetValue the properties of a overridable value that can be passed to a task template. 2972type SetValue struct { 2973 // Name - The name of the overridable value. 2974 Name *string `json:"name,omitempty"` 2975 // Value - The overridable value. 2976 Value *string `json:"value,omitempty"` 2977 // IsSecret - Flag to indicate whether the value represents a secret or not. 2978 IsSecret *bool `json:"isSecret,omitempty"` 2979} 2980 2981// Sku the SKU of a container registry. 2982type Sku struct { 2983 // Name - The SKU name of the container registry. Required for registry creation. Possible values include: 'Classic', 'Basic', 'Standard', 'Premium' 2984 Name SkuName `json:"name,omitempty"` 2985 // Tier - READ-ONLY; The SKU tier based on the SKU name. Possible values include: 'SkuTierClassic', 'SkuTierBasic', 'SkuTierStandard', 'SkuTierPremium' 2986 Tier SkuTier `json:"tier,omitempty"` 2987} 2988 2989// MarshalJSON is the custom marshaler for Sku. 2990func (s Sku) MarshalJSON() ([]byte, error) { 2991 objectMap := make(map[string]interface{}) 2992 if s.Name != "" { 2993 objectMap["name"] = s.Name 2994 } 2995 return json.Marshal(objectMap) 2996} 2997 2998// Source the registry node that generated the event. Put differently, while the actor initiates the event, 2999// the source generates it. 3000type Source struct { 3001 // 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. 3002 Addr *string `json:"addr,omitempty"` 3003 // InstanceID - The running instance of an application. Changes after each restart. 3004 InstanceID *string `json:"instanceID,omitempty"` 3005} 3006 3007// SourceProperties the properties of the source code repository. 3008type SourceProperties struct { 3009 // SourceControlType - The type of source control service. Possible values include: 'Github', 'VisualStudioTeamService' 3010 SourceControlType SourceControlType `json:"sourceControlType,omitempty"` 3011 // RepositoryURL - The full URL to the source code repository 3012 RepositoryURL *string `json:"repositoryUrl,omitempty"` 3013 // Branch - The branch name of the source code. 3014 Branch *string `json:"branch,omitempty"` 3015 // SourceControlAuthProperties - The authorization properties for accessing the source code repository and to set up 3016 // webhooks for notifications. 3017 SourceControlAuthProperties *AuthInfo `json:"sourceControlAuthProperties,omitempty"` 3018} 3019 3020// SourceRegistryCredentials describes the credential parameters for accessing the source registry. 3021type SourceRegistryCredentials struct { 3022 // LoginMode - The authentication mode which determines the source registry login scope. The credentials for the source registry 3023 // will be generated using the given scope. These credentials will be used to login to 3024 // the source registry during the run. Possible values include: 'SourceRegistryLoginModeNone', 'SourceRegistryLoginModeDefault' 3025 LoginMode SourceRegistryLoginMode `json:"loginMode,omitempty"` 3026} 3027 3028// SourceTrigger the properties of a source based trigger. 3029type SourceTrigger struct { 3030 // SourceRepository - The properties that describes the source(code) for the task. 3031 SourceRepository *SourceProperties `json:"sourceRepository,omitempty"` 3032 // SourceTriggerEvents - The source event corresponding to the trigger. 3033 SourceTriggerEvents *[]SourceTriggerEvent `json:"sourceTriggerEvents,omitempty"` 3034 // Status - The current status of trigger. Possible values include: 'TriggerStatusDisabled', 'TriggerStatusEnabled' 3035 Status TriggerStatus `json:"status,omitempty"` 3036 // Name - The name of the trigger. 3037 Name *string `json:"name,omitempty"` 3038} 3039 3040// SourceTriggerDescriptor the source trigger that caused a run. 3041type SourceTriggerDescriptor struct { 3042 // ID - The unique ID of the trigger. 3043 ID *string `json:"id,omitempty"` 3044 // EventType - The event type of the trigger. 3045 EventType *string `json:"eventType,omitempty"` 3046 // CommitID - The unique ID that identifies a commit. 3047 CommitID *string `json:"commitId,omitempty"` 3048 // PullRequestID - The unique ID that identifies pull request. 3049 PullRequestID *string `json:"pullRequestId,omitempty"` 3050 // RepositoryURL - The repository URL. 3051 RepositoryURL *string `json:"repositoryUrl,omitempty"` 3052 // BranchName - The branch name in the repository. 3053 BranchName *string `json:"branchName,omitempty"` 3054 // ProviderType - The source control provider type. 3055 ProviderType *string `json:"providerType,omitempty"` 3056} 3057 3058// SourceTriggerUpdateParameters the properties for updating a source based trigger. 3059type SourceTriggerUpdateParameters struct { 3060 // SourceRepository - The properties that describes the source(code) for the task. 3061 SourceRepository *SourceUpdateParameters `json:"sourceRepository,omitempty"` 3062 // SourceTriggerEvents - The source event corresponding to the trigger. 3063 SourceTriggerEvents *[]SourceTriggerEvent `json:"sourceTriggerEvents,omitempty"` 3064 // Status - The current status of trigger. Possible values include: 'TriggerStatusDisabled', 'TriggerStatusEnabled' 3065 Status TriggerStatus `json:"status,omitempty"` 3066 // Name - The name of the trigger. 3067 Name *string `json:"name,omitempty"` 3068} 3069 3070// SourceUpdateParameters the properties for updating the source code repository. 3071type SourceUpdateParameters struct { 3072 // SourceControlType - The type of source control service. Possible values include: 'Github', 'VisualStudioTeamService' 3073 SourceControlType SourceControlType `json:"sourceControlType,omitempty"` 3074 // RepositoryURL - The full URL to the source code repository 3075 RepositoryURL *string `json:"repositoryUrl,omitempty"` 3076 // Branch - The branch name of the source code. 3077 Branch *string `json:"branch,omitempty"` 3078 // SourceControlAuthProperties - The authorization properties for accessing the source code repository and to set up 3079 // webhooks for notifications. 3080 SourceControlAuthProperties *AuthInfoUpdateParameters `json:"sourceControlAuthProperties,omitempty"` 3081} 3082 3083// SourceUploadDefinition the properties of a response to source upload request. 3084type SourceUploadDefinition struct { 3085 autorest.Response `json:"-"` 3086 // UploadURL - The URL where the client can upload the source. 3087 UploadURL *string `json:"uploadUrl,omitempty"` 3088 // RelativePath - The relative path to the source. This is used to submit the subsequent queue build request. 3089 RelativePath *string `json:"relativePath,omitempty"` 3090} 3091 3092// Status the status of an Azure resource at the time the operation was called. 3093type Status struct { 3094 // DisplayStatus - READ-ONLY; The short label for the status. 3095 DisplayStatus *string `json:"displayStatus,omitempty"` 3096 // Message - READ-ONLY; The detailed message for the status, including alerts and error messages. 3097 Message *string `json:"message,omitempty"` 3098 // Timestamp - READ-ONLY; The timestamp when the status was changed to the current value. 3099 Timestamp *date.Time `json:"timestamp,omitempty"` 3100} 3101 3102// StorageAccountProperties the properties of a storage account for a container registry. Only applicable 3103// to Classic SKU. 3104type StorageAccountProperties struct { 3105 // ID - The resource ID of the storage account. 3106 ID *string `json:"id,omitempty"` 3107} 3108 3109// Target the target of the event. 3110type Target struct { 3111 // MediaType - The MIME type of the referenced object. 3112 MediaType *string `json:"mediaType,omitempty"` 3113 // Size - The number of bytes of the content. Same as Length field. 3114 Size *int64 `json:"size,omitempty"` 3115 // Digest - The digest of the content, as defined by the Registry V2 HTTP API Specification. 3116 Digest *string `json:"digest,omitempty"` 3117 // Length - The number of bytes of the content. Same as Size field. 3118 Length *int64 `json:"length,omitempty"` 3119 // Repository - The repository name. 3120 Repository *string `json:"repository,omitempty"` 3121 // URL - The direct URL to the content. 3122 URL *string `json:"url,omitempty"` 3123 // Tag - The tag name. 3124 Tag *string `json:"tag,omitempty"` 3125 // Name - The name of the artifact. 3126 Name *string `json:"name,omitempty"` 3127 // Version - The version of the artifact. 3128 Version *string `json:"version,omitempty"` 3129} 3130 3131// Task the task that has the ARM resource and task properties. 3132// The task will have all information to schedule a run against it. 3133type Task struct { 3134 autorest.Response `json:"-"` 3135 // Identity - Identity for the resource. 3136 Identity *IdentityProperties `json:"identity,omitempty"` 3137 // TaskProperties - The properties of a task. 3138 *TaskProperties `json:"properties,omitempty"` 3139 // ID - READ-ONLY; The resource ID. 3140 ID *string `json:"id,omitempty"` 3141 // Name - READ-ONLY; The name of the resource. 3142 Name *string `json:"name,omitempty"` 3143 // Type - READ-ONLY; The type of the resource. 3144 Type *string `json:"type,omitempty"` 3145 // Location - The location of the resource. This cannot be changed after the resource is created. 3146 Location *string `json:"location,omitempty"` 3147 // Tags - The tags of the resource. 3148 Tags map[string]*string `json:"tags"` 3149} 3150 3151// MarshalJSON is the custom marshaler for Task. 3152func (t Task) MarshalJSON() ([]byte, error) { 3153 objectMap := make(map[string]interface{}) 3154 if t.Identity != nil { 3155 objectMap["identity"] = t.Identity 3156 } 3157 if t.TaskProperties != nil { 3158 objectMap["properties"] = t.TaskProperties 3159 } 3160 if t.Location != nil { 3161 objectMap["location"] = t.Location 3162 } 3163 if t.Tags != nil { 3164 objectMap["tags"] = t.Tags 3165 } 3166 return json.Marshal(objectMap) 3167} 3168 3169// UnmarshalJSON is the custom unmarshaler for Task struct. 3170func (t *Task) UnmarshalJSON(body []byte) error { 3171 var m map[string]*json.RawMessage 3172 err := json.Unmarshal(body, &m) 3173 if err != nil { 3174 return err 3175 } 3176 for k, v := range m { 3177 switch k { 3178 case "identity": 3179 if v != nil { 3180 var identity IdentityProperties 3181 err = json.Unmarshal(*v, &identity) 3182 if err != nil { 3183 return err 3184 } 3185 t.Identity = &identity 3186 } 3187 case "properties": 3188 if v != nil { 3189 var taskProperties TaskProperties 3190 err = json.Unmarshal(*v, &taskProperties) 3191 if err != nil { 3192 return err 3193 } 3194 t.TaskProperties = &taskProperties 3195 } 3196 case "id": 3197 if v != nil { 3198 var ID string 3199 err = json.Unmarshal(*v, &ID) 3200 if err != nil { 3201 return err 3202 } 3203 t.ID = &ID 3204 } 3205 case "name": 3206 if v != nil { 3207 var name string 3208 err = json.Unmarshal(*v, &name) 3209 if err != nil { 3210 return err 3211 } 3212 t.Name = &name 3213 } 3214 case "type": 3215 if v != nil { 3216 var typeVar string 3217 err = json.Unmarshal(*v, &typeVar) 3218 if err != nil { 3219 return err 3220 } 3221 t.Type = &typeVar 3222 } 3223 case "location": 3224 if v != nil { 3225 var location string 3226 err = json.Unmarshal(*v, &location) 3227 if err != nil { 3228 return err 3229 } 3230 t.Location = &location 3231 } 3232 case "tags": 3233 if v != nil { 3234 var tags map[string]*string 3235 err = json.Unmarshal(*v, &tags) 3236 if err != nil { 3237 return err 3238 } 3239 t.Tags = tags 3240 } 3241 } 3242 } 3243 3244 return nil 3245} 3246 3247// TaskListResult the collection of tasks. 3248type TaskListResult struct { 3249 autorest.Response `json:"-"` 3250 // Value - The collection value. 3251 Value *[]Task `json:"value,omitempty"` 3252 // NextLink - The URI that can be used to request the next set of paged results. 3253 NextLink *string `json:"nextLink,omitempty"` 3254} 3255 3256// TaskListResultIterator provides access to a complete listing of Task values. 3257type TaskListResultIterator struct { 3258 i int 3259 page TaskListResultPage 3260} 3261 3262// NextWithContext advances to the next value. If there was an error making 3263// the request the iterator does not advance and the error is returned. 3264func (iter *TaskListResultIterator) NextWithContext(ctx context.Context) (err error) { 3265 if tracing.IsEnabled() { 3266 ctx = tracing.StartSpan(ctx, fqdn+"/TaskListResultIterator.NextWithContext") 3267 defer func() { 3268 sc := -1 3269 if iter.Response().Response.Response != nil { 3270 sc = iter.Response().Response.Response.StatusCode 3271 } 3272 tracing.EndSpan(ctx, sc, err) 3273 }() 3274 } 3275 iter.i++ 3276 if iter.i < len(iter.page.Values()) { 3277 return nil 3278 } 3279 err = iter.page.NextWithContext(ctx) 3280 if err != nil { 3281 iter.i-- 3282 return err 3283 } 3284 iter.i = 0 3285 return nil 3286} 3287 3288// Next advances to the next value. If there was an error making 3289// the request the iterator does not advance and the error is returned. 3290// Deprecated: Use NextWithContext() instead. 3291func (iter *TaskListResultIterator) Next() error { 3292 return iter.NextWithContext(context.Background()) 3293} 3294 3295// NotDone returns true if the enumeration should be started or is not yet complete. 3296func (iter TaskListResultIterator) NotDone() bool { 3297 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3298} 3299 3300// Response returns the raw server response from the last page request. 3301func (iter TaskListResultIterator) Response() TaskListResult { 3302 return iter.page.Response() 3303} 3304 3305// Value returns the current value or a zero-initialized value if the 3306// iterator has advanced beyond the end of the collection. 3307func (iter TaskListResultIterator) Value() Task { 3308 if !iter.page.NotDone() { 3309 return Task{} 3310 } 3311 return iter.page.Values()[iter.i] 3312} 3313 3314// Creates a new instance of the TaskListResultIterator type. 3315func NewTaskListResultIterator(page TaskListResultPage) TaskListResultIterator { 3316 return TaskListResultIterator{page: page} 3317} 3318 3319// IsEmpty returns true if the ListResult contains no values. 3320func (tlr TaskListResult) IsEmpty() bool { 3321 return tlr.Value == nil || len(*tlr.Value) == 0 3322} 3323 3324// hasNextLink returns true if the NextLink is not empty. 3325func (tlr TaskListResult) hasNextLink() bool { 3326 return tlr.NextLink != nil && len(*tlr.NextLink) != 0 3327} 3328 3329// taskListResultPreparer prepares a request to retrieve the next set of results. 3330// It returns nil if no more results exist. 3331func (tlr TaskListResult) taskListResultPreparer(ctx context.Context) (*http.Request, error) { 3332 if !tlr.hasNextLink() { 3333 return nil, nil 3334 } 3335 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3336 autorest.AsJSON(), 3337 autorest.AsGet(), 3338 autorest.WithBaseURL(to.String(tlr.NextLink))) 3339} 3340 3341// TaskListResultPage contains a page of Task values. 3342type TaskListResultPage struct { 3343 fn func(context.Context, TaskListResult) (TaskListResult, error) 3344 tlr TaskListResult 3345} 3346 3347// NextWithContext advances to the next page of values. If there was an error making 3348// the request the page does not advance and the error is returned. 3349func (page *TaskListResultPage) NextWithContext(ctx context.Context) (err error) { 3350 if tracing.IsEnabled() { 3351 ctx = tracing.StartSpan(ctx, fqdn+"/TaskListResultPage.NextWithContext") 3352 defer func() { 3353 sc := -1 3354 if page.Response().Response.Response != nil { 3355 sc = page.Response().Response.Response.StatusCode 3356 } 3357 tracing.EndSpan(ctx, sc, err) 3358 }() 3359 } 3360 for { 3361 next, err := page.fn(ctx, page.tlr) 3362 if err != nil { 3363 return err 3364 } 3365 page.tlr = next 3366 if !next.hasNextLink() || !next.IsEmpty() { 3367 break 3368 } 3369 } 3370 return nil 3371} 3372 3373// Next advances to the next page of values. If there was an error making 3374// the request the page does not advance and the error is returned. 3375// Deprecated: Use NextWithContext() instead. 3376func (page *TaskListResultPage) Next() error { 3377 return page.NextWithContext(context.Background()) 3378} 3379 3380// NotDone returns true if the page enumeration should be started or is not yet complete. 3381func (page TaskListResultPage) NotDone() bool { 3382 return !page.tlr.IsEmpty() 3383} 3384 3385// Response returns the raw server response from the last page request. 3386func (page TaskListResultPage) Response() TaskListResult { 3387 return page.tlr 3388} 3389 3390// Values returns the slice of values for the current page or nil if there are no values. 3391func (page TaskListResultPage) Values() []Task { 3392 if page.tlr.IsEmpty() { 3393 return nil 3394 } 3395 return *page.tlr.Value 3396} 3397 3398// Creates a new instance of the TaskListResultPage type. 3399func NewTaskListResultPage(cur TaskListResult, getNextPage func(context.Context, TaskListResult) (TaskListResult, error)) TaskListResultPage { 3400 return TaskListResultPage{ 3401 fn: getNextPage, 3402 tlr: cur, 3403 } 3404} 3405 3406// TaskProperties the properties of a task. 3407type TaskProperties struct { 3408 // ProvisioningState - READ-ONLY; The provisioning state of the task. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' 3409 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 3410 // CreationDate - READ-ONLY; The creation date of task. 3411 CreationDate *date.Time `json:"creationDate,omitempty"` 3412 // Status - The current status of task. Possible values include: 'TaskStatusDisabled', 'TaskStatusEnabled' 3413 Status TaskStatus `json:"status,omitempty"` 3414 // Platform - The platform properties against which the run has to happen. 3415 Platform *PlatformProperties `json:"platform,omitempty"` 3416 // AgentConfiguration - The machine configuration of the run agent. 3417 AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` 3418 // Timeout - Run timeout in seconds. 3419 Timeout *int32 `json:"timeout,omitempty"` 3420 // Step - The properties of a task step. 3421 Step BasicTaskStepProperties `json:"step,omitempty"` 3422 // Trigger - The properties that describe all triggers for the task. 3423 Trigger *TriggerProperties `json:"trigger,omitempty"` 3424 // Credentials - The properties that describes a set of credentials that will be used when this run is invoked. 3425 Credentials *Credentials `json:"credentials,omitempty"` 3426} 3427 3428// MarshalJSON is the custom marshaler for TaskProperties. 3429func (tp TaskProperties) MarshalJSON() ([]byte, error) { 3430 objectMap := make(map[string]interface{}) 3431 if tp.Status != "" { 3432 objectMap["status"] = tp.Status 3433 } 3434 if tp.Platform != nil { 3435 objectMap["platform"] = tp.Platform 3436 } 3437 if tp.AgentConfiguration != nil { 3438 objectMap["agentConfiguration"] = tp.AgentConfiguration 3439 } 3440 if tp.Timeout != nil { 3441 objectMap["timeout"] = tp.Timeout 3442 } 3443 objectMap["step"] = tp.Step 3444 if tp.Trigger != nil { 3445 objectMap["trigger"] = tp.Trigger 3446 } 3447 if tp.Credentials != nil { 3448 objectMap["credentials"] = tp.Credentials 3449 } 3450 return json.Marshal(objectMap) 3451} 3452 3453// UnmarshalJSON is the custom unmarshaler for TaskProperties struct. 3454func (tp *TaskProperties) UnmarshalJSON(body []byte) error { 3455 var m map[string]*json.RawMessage 3456 err := json.Unmarshal(body, &m) 3457 if err != nil { 3458 return err 3459 } 3460 for k, v := range m { 3461 switch k { 3462 case "provisioningState": 3463 if v != nil { 3464 var provisioningState ProvisioningState 3465 err = json.Unmarshal(*v, &provisioningState) 3466 if err != nil { 3467 return err 3468 } 3469 tp.ProvisioningState = provisioningState 3470 } 3471 case "creationDate": 3472 if v != nil { 3473 var creationDate date.Time 3474 err = json.Unmarshal(*v, &creationDate) 3475 if err != nil { 3476 return err 3477 } 3478 tp.CreationDate = &creationDate 3479 } 3480 case "status": 3481 if v != nil { 3482 var status TaskStatus 3483 err = json.Unmarshal(*v, &status) 3484 if err != nil { 3485 return err 3486 } 3487 tp.Status = status 3488 } 3489 case "platform": 3490 if v != nil { 3491 var platform PlatformProperties 3492 err = json.Unmarshal(*v, &platform) 3493 if err != nil { 3494 return err 3495 } 3496 tp.Platform = &platform 3497 } 3498 case "agentConfiguration": 3499 if v != nil { 3500 var agentConfiguration AgentProperties 3501 err = json.Unmarshal(*v, &agentConfiguration) 3502 if err != nil { 3503 return err 3504 } 3505 tp.AgentConfiguration = &agentConfiguration 3506 } 3507 case "timeout": 3508 if v != nil { 3509 var timeout int32 3510 err = json.Unmarshal(*v, &timeout) 3511 if err != nil { 3512 return err 3513 } 3514 tp.Timeout = &timeout 3515 } 3516 case "step": 3517 if v != nil { 3518 step, err := unmarshalBasicTaskStepProperties(*v) 3519 if err != nil { 3520 return err 3521 } 3522 tp.Step = step 3523 } 3524 case "trigger": 3525 if v != nil { 3526 var trigger TriggerProperties 3527 err = json.Unmarshal(*v, &trigger) 3528 if err != nil { 3529 return err 3530 } 3531 tp.Trigger = &trigger 3532 } 3533 case "credentials": 3534 if v != nil { 3535 var credentials Credentials 3536 err = json.Unmarshal(*v, &credentials) 3537 if err != nil { 3538 return err 3539 } 3540 tp.Credentials = &credentials 3541 } 3542 } 3543 } 3544 3545 return nil 3546} 3547 3548// TaskPropertiesUpdateParameters the properties for updating a task. 3549type TaskPropertiesUpdateParameters struct { 3550 // Status - The current status of task. Possible values include: 'TaskStatusDisabled', 'TaskStatusEnabled' 3551 Status TaskStatus `json:"status,omitempty"` 3552 // Platform - The platform properties against which the run has to happen. 3553 Platform *PlatformUpdateParameters `json:"platform,omitempty"` 3554 // AgentConfiguration - The machine configuration of the run agent. 3555 AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` 3556 // Timeout - Run timeout in seconds. 3557 Timeout *int32 `json:"timeout,omitempty"` 3558 // Step - The properties for updating a task step. 3559 Step BasicTaskStepUpdateParameters `json:"step,omitempty"` 3560 // Trigger - The properties for updating trigger properties. 3561 Trigger *TriggerUpdateParameters `json:"trigger,omitempty"` 3562 // Credentials - The parameters that describes a set of credentials that will be used when this run is invoked. 3563 Credentials *Credentials `json:"credentials,omitempty"` 3564} 3565 3566// UnmarshalJSON is the custom unmarshaler for TaskPropertiesUpdateParameters struct. 3567func (tpup *TaskPropertiesUpdateParameters) UnmarshalJSON(body []byte) error { 3568 var m map[string]*json.RawMessage 3569 err := json.Unmarshal(body, &m) 3570 if err != nil { 3571 return err 3572 } 3573 for k, v := range m { 3574 switch k { 3575 case "status": 3576 if v != nil { 3577 var status TaskStatus 3578 err = json.Unmarshal(*v, &status) 3579 if err != nil { 3580 return err 3581 } 3582 tpup.Status = status 3583 } 3584 case "platform": 3585 if v != nil { 3586 var platform PlatformUpdateParameters 3587 err = json.Unmarshal(*v, &platform) 3588 if err != nil { 3589 return err 3590 } 3591 tpup.Platform = &platform 3592 } 3593 case "agentConfiguration": 3594 if v != nil { 3595 var agentConfiguration AgentProperties 3596 err = json.Unmarshal(*v, &agentConfiguration) 3597 if err != nil { 3598 return err 3599 } 3600 tpup.AgentConfiguration = &agentConfiguration 3601 } 3602 case "timeout": 3603 if v != nil { 3604 var timeout int32 3605 err = json.Unmarshal(*v, &timeout) 3606 if err != nil { 3607 return err 3608 } 3609 tpup.Timeout = &timeout 3610 } 3611 case "step": 3612 if v != nil { 3613 step, err := unmarshalBasicTaskStepUpdateParameters(*v) 3614 if err != nil { 3615 return err 3616 } 3617 tpup.Step = step 3618 } 3619 case "trigger": 3620 if v != nil { 3621 var trigger TriggerUpdateParameters 3622 err = json.Unmarshal(*v, &trigger) 3623 if err != nil { 3624 return err 3625 } 3626 tpup.Trigger = &trigger 3627 } 3628 case "credentials": 3629 if v != nil { 3630 var credentials Credentials 3631 err = json.Unmarshal(*v, &credentials) 3632 if err != nil { 3633 return err 3634 } 3635 tpup.Credentials = &credentials 3636 } 3637 } 3638 } 3639 3640 return nil 3641} 3642 3643// TaskRunRequest the parameters for a task run request. 3644type TaskRunRequest struct { 3645 // TaskName - The name of task against which run has to be queued. 3646 TaskName *string `json:"taskName,omitempty"` 3647 // Values - The collection of overridable values that can be passed when running a task. 3648 Values *[]SetValue `json:"values,omitempty"` 3649 // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. 3650 IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` 3651 // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' 3652 Type Type `json:"type,omitempty"` 3653} 3654 3655// MarshalJSON is the custom marshaler for TaskRunRequest. 3656func (trr TaskRunRequest) MarshalJSON() ([]byte, error) { 3657 trr.Type = TypeTaskRunRequest 3658 objectMap := make(map[string]interface{}) 3659 if trr.TaskName != nil { 3660 objectMap["taskName"] = trr.TaskName 3661 } 3662 if trr.Values != nil { 3663 objectMap["values"] = trr.Values 3664 } 3665 if trr.IsArchiveEnabled != nil { 3666 objectMap["isArchiveEnabled"] = trr.IsArchiveEnabled 3667 } 3668 if trr.Type != "" { 3669 objectMap["type"] = trr.Type 3670 } 3671 return json.Marshal(objectMap) 3672} 3673 3674// AsDockerBuildRequest is the BasicRunRequest implementation for TaskRunRequest. 3675func (trr TaskRunRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { 3676 return nil, false 3677} 3678 3679// AsFileTaskRunRequest is the BasicRunRequest implementation for TaskRunRequest. 3680func (trr TaskRunRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { 3681 return nil, false 3682} 3683 3684// AsTaskRunRequest is the BasicRunRequest implementation for TaskRunRequest. 3685func (trr TaskRunRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { 3686 return &trr, true 3687} 3688 3689// AsEncodedTaskRunRequest is the BasicRunRequest implementation for TaskRunRequest. 3690func (trr TaskRunRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { 3691 return nil, false 3692} 3693 3694// AsRunRequest is the BasicRunRequest implementation for TaskRunRequest. 3695func (trr TaskRunRequest) AsRunRequest() (*RunRequest, bool) { 3696 return nil, false 3697} 3698 3699// AsBasicRunRequest is the BasicRunRequest implementation for TaskRunRequest. 3700func (trr TaskRunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { 3701 return &trr, true 3702} 3703 3704// TasksCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 3705type TasksCreateFuture struct { 3706 azure.FutureAPI 3707 // Result returns the result of the asynchronous operation. 3708 // If the operation has not completed it will return an error. 3709 Result func(TasksClient) (Task, error) 3710} 3711 3712// TasksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. 3713type TasksDeleteFuture struct { 3714 azure.FutureAPI 3715 // Result returns the result of the asynchronous operation. 3716 // If the operation has not completed it will return an error. 3717 Result func(TasksClient) (autorest.Response, error) 3718} 3719 3720// BasicTaskStepProperties base properties for any task step. 3721type BasicTaskStepProperties interface { 3722 AsDockerBuildStep() (*DockerBuildStep, bool) 3723 AsFileTaskStep() (*FileTaskStep, bool) 3724 AsEncodedTaskStep() (*EncodedTaskStep, bool) 3725 AsTaskStepProperties() (*TaskStepProperties, bool) 3726} 3727 3728// TaskStepProperties base properties for any task step. 3729type TaskStepProperties struct { 3730 // BaseImageDependencies - READ-ONLY; List of base image dependencies for a step. 3731 BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` 3732 // ContextPath - The URL(absolute or relative) of the source context for the task step. 3733 ContextPath *string `json:"contextPath,omitempty"` 3734 // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. 3735 ContextAccessToken *string `json:"contextAccessToken,omitempty"` 3736 // Type - Possible values include: 'TypeTaskStepProperties', 'TypeDocker', 'TypeFileTask', 'TypeEncodedTask' 3737 Type TypeBasicTaskStepProperties `json:"type,omitempty"` 3738} 3739 3740func unmarshalBasicTaskStepProperties(body []byte) (BasicTaskStepProperties, error) { 3741 var m map[string]interface{} 3742 err := json.Unmarshal(body, &m) 3743 if err != nil { 3744 return nil, err 3745 } 3746 3747 switch m["type"] { 3748 case string(TypeDocker): 3749 var dbs DockerBuildStep 3750 err := json.Unmarshal(body, &dbs) 3751 return dbs, err 3752 case string(TypeFileTask): 3753 var fts FileTaskStep 3754 err := json.Unmarshal(body, &fts) 3755 return fts, err 3756 case string(TypeEncodedTask): 3757 var ets EncodedTaskStep 3758 err := json.Unmarshal(body, &ets) 3759 return ets, err 3760 default: 3761 var tsp TaskStepProperties 3762 err := json.Unmarshal(body, &tsp) 3763 return tsp, err 3764 } 3765} 3766func unmarshalBasicTaskStepPropertiesArray(body []byte) ([]BasicTaskStepProperties, error) { 3767 var rawMessages []*json.RawMessage 3768 err := json.Unmarshal(body, &rawMessages) 3769 if err != nil { 3770 return nil, err 3771 } 3772 3773 tspArray := make([]BasicTaskStepProperties, len(rawMessages)) 3774 3775 for index, rawMessage := range rawMessages { 3776 tsp, err := unmarshalBasicTaskStepProperties(*rawMessage) 3777 if err != nil { 3778 return nil, err 3779 } 3780 tspArray[index] = tsp 3781 } 3782 return tspArray, nil 3783} 3784 3785// MarshalJSON is the custom marshaler for TaskStepProperties. 3786func (tsp TaskStepProperties) MarshalJSON() ([]byte, error) { 3787 tsp.Type = TypeTaskStepProperties 3788 objectMap := make(map[string]interface{}) 3789 if tsp.ContextPath != nil { 3790 objectMap["contextPath"] = tsp.ContextPath 3791 } 3792 if tsp.ContextAccessToken != nil { 3793 objectMap["contextAccessToken"] = tsp.ContextAccessToken 3794 } 3795 if tsp.Type != "" { 3796 objectMap["type"] = tsp.Type 3797 } 3798 return json.Marshal(objectMap) 3799} 3800 3801// AsDockerBuildStep is the BasicTaskStepProperties implementation for TaskStepProperties. 3802func (tsp TaskStepProperties) AsDockerBuildStep() (*DockerBuildStep, bool) { 3803 return nil, false 3804} 3805 3806// AsFileTaskStep is the BasicTaskStepProperties implementation for TaskStepProperties. 3807func (tsp TaskStepProperties) AsFileTaskStep() (*FileTaskStep, bool) { 3808 return nil, false 3809} 3810 3811// AsEncodedTaskStep is the BasicTaskStepProperties implementation for TaskStepProperties. 3812func (tsp TaskStepProperties) AsEncodedTaskStep() (*EncodedTaskStep, bool) { 3813 return nil, false 3814} 3815 3816// AsTaskStepProperties is the BasicTaskStepProperties implementation for TaskStepProperties. 3817func (tsp TaskStepProperties) AsTaskStepProperties() (*TaskStepProperties, bool) { 3818 return &tsp, true 3819} 3820 3821// AsBasicTaskStepProperties is the BasicTaskStepProperties implementation for TaskStepProperties. 3822func (tsp TaskStepProperties) AsBasicTaskStepProperties() (BasicTaskStepProperties, bool) { 3823 return &tsp, true 3824} 3825 3826// BasicTaskStepUpdateParameters base properties for updating any task step. 3827type BasicTaskStepUpdateParameters interface { 3828 AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) 3829 AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) 3830 AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) 3831 AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) 3832} 3833 3834// TaskStepUpdateParameters base properties for updating any task step. 3835type TaskStepUpdateParameters struct { 3836 // ContextPath - The URL(absolute or relative) of the source context for the task step. 3837 ContextPath *string `json:"contextPath,omitempty"` 3838 // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. 3839 ContextAccessToken *string `json:"contextAccessToken,omitempty"` 3840 // Type - Possible values include: 'TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters', 'TypeBasicTaskStepUpdateParametersTypeDocker', 'TypeBasicTaskStepUpdateParametersTypeFileTask', 'TypeBasicTaskStepUpdateParametersTypeEncodedTask' 3841 Type TypeBasicTaskStepUpdateParameters `json:"type,omitempty"` 3842} 3843 3844func unmarshalBasicTaskStepUpdateParameters(body []byte) (BasicTaskStepUpdateParameters, error) { 3845 var m map[string]interface{} 3846 err := json.Unmarshal(body, &m) 3847 if err != nil { 3848 return nil, err 3849 } 3850 3851 switch m["type"] { 3852 case string(TypeBasicTaskStepUpdateParametersTypeDocker): 3853 var dbsup DockerBuildStepUpdateParameters 3854 err := json.Unmarshal(body, &dbsup) 3855 return dbsup, err 3856 case string(TypeBasicTaskStepUpdateParametersTypeFileTask): 3857 var ftsup FileTaskStepUpdateParameters 3858 err := json.Unmarshal(body, &ftsup) 3859 return ftsup, err 3860 case string(TypeBasicTaskStepUpdateParametersTypeEncodedTask): 3861 var etsup EncodedTaskStepUpdateParameters 3862 err := json.Unmarshal(body, &etsup) 3863 return etsup, err 3864 default: 3865 var tsup TaskStepUpdateParameters 3866 err := json.Unmarshal(body, &tsup) 3867 return tsup, err 3868 } 3869} 3870func unmarshalBasicTaskStepUpdateParametersArray(body []byte) ([]BasicTaskStepUpdateParameters, error) { 3871 var rawMessages []*json.RawMessage 3872 err := json.Unmarshal(body, &rawMessages) 3873 if err != nil { 3874 return nil, err 3875 } 3876 3877 tsupArray := make([]BasicTaskStepUpdateParameters, len(rawMessages)) 3878 3879 for index, rawMessage := range rawMessages { 3880 tsup, err := unmarshalBasicTaskStepUpdateParameters(*rawMessage) 3881 if err != nil { 3882 return nil, err 3883 } 3884 tsupArray[index] = tsup 3885 } 3886 return tsupArray, nil 3887} 3888 3889// MarshalJSON is the custom marshaler for TaskStepUpdateParameters. 3890func (tsup TaskStepUpdateParameters) MarshalJSON() ([]byte, error) { 3891 tsup.Type = TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters 3892 objectMap := make(map[string]interface{}) 3893 if tsup.ContextPath != nil { 3894 objectMap["contextPath"] = tsup.ContextPath 3895 } 3896 if tsup.ContextAccessToken != nil { 3897 objectMap["contextAccessToken"] = tsup.ContextAccessToken 3898 } 3899 if tsup.Type != "" { 3900 objectMap["type"] = tsup.Type 3901 } 3902 return json.Marshal(objectMap) 3903} 3904 3905// AsDockerBuildStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. 3906func (tsup TaskStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { 3907 return nil, false 3908} 3909 3910// AsFileTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. 3911func (tsup TaskStepUpdateParameters) AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) { 3912 return nil, false 3913} 3914 3915// AsEncodedTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. 3916func (tsup TaskStepUpdateParameters) AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) { 3917 return nil, false 3918} 3919 3920// AsTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. 3921func (tsup TaskStepUpdateParameters) AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) { 3922 return &tsup, true 3923} 3924 3925// AsBasicTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. 3926func (tsup TaskStepUpdateParameters) AsBasicTaskStepUpdateParameters() (BasicTaskStepUpdateParameters, bool) { 3927 return &tsup, true 3928} 3929 3930// TasksUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 3931type TasksUpdateFuture struct { 3932 azure.FutureAPI 3933 // Result returns the result of the asynchronous operation. 3934 // If the operation has not completed it will return an error. 3935 Result func(TasksClient) (Task, error) 3936} 3937 3938// TaskUpdateParameters the parameters for updating a task. 3939type TaskUpdateParameters struct { 3940 // Identity - Identity for the resource. 3941 Identity *IdentityProperties `json:"identity,omitempty"` 3942 // TaskPropertiesUpdateParameters - The properties for updating a task. 3943 *TaskPropertiesUpdateParameters `json:"properties,omitempty"` 3944 // Tags - The ARM resource tags. 3945 Tags map[string]*string `json:"tags"` 3946} 3947 3948// MarshalJSON is the custom marshaler for TaskUpdateParameters. 3949func (tup TaskUpdateParameters) MarshalJSON() ([]byte, error) { 3950 objectMap := make(map[string]interface{}) 3951 if tup.Identity != nil { 3952 objectMap["identity"] = tup.Identity 3953 } 3954 if tup.TaskPropertiesUpdateParameters != nil { 3955 objectMap["properties"] = tup.TaskPropertiesUpdateParameters 3956 } 3957 if tup.Tags != nil { 3958 objectMap["tags"] = tup.Tags 3959 } 3960 return json.Marshal(objectMap) 3961} 3962 3963// UnmarshalJSON is the custom unmarshaler for TaskUpdateParameters struct. 3964func (tup *TaskUpdateParameters) UnmarshalJSON(body []byte) error { 3965 var m map[string]*json.RawMessage 3966 err := json.Unmarshal(body, &m) 3967 if err != nil { 3968 return err 3969 } 3970 for k, v := range m { 3971 switch k { 3972 case "identity": 3973 if v != nil { 3974 var identity IdentityProperties 3975 err = json.Unmarshal(*v, &identity) 3976 if err != nil { 3977 return err 3978 } 3979 tup.Identity = &identity 3980 } 3981 case "properties": 3982 if v != nil { 3983 var taskPropertiesUpdateParameters TaskPropertiesUpdateParameters 3984 err = json.Unmarshal(*v, &taskPropertiesUpdateParameters) 3985 if err != nil { 3986 return err 3987 } 3988 tup.TaskPropertiesUpdateParameters = &taskPropertiesUpdateParameters 3989 } 3990 case "tags": 3991 if v != nil { 3992 var tags map[string]*string 3993 err = json.Unmarshal(*v, &tags) 3994 if err != nil { 3995 return err 3996 } 3997 tup.Tags = tags 3998 } 3999 } 4000 } 4001 4002 return nil 4003} 4004 4005// TimerTrigger the properties of a timer trigger. 4006type TimerTrigger struct { 4007 // Schedule - The CRON expression for the task schedule 4008 Schedule *string `json:"schedule,omitempty"` 4009 // Status - The current status of trigger. Possible values include: 'TriggerStatusDisabled', 'TriggerStatusEnabled' 4010 Status TriggerStatus `json:"status,omitempty"` 4011 // Name - The name of the trigger. 4012 Name *string `json:"name,omitempty"` 4013} 4014 4015// TimerTriggerDescriptor ... 4016type TimerTriggerDescriptor struct { 4017 // TimerTriggerName - The timer trigger name that caused the run. 4018 TimerTriggerName *string `json:"timerTriggerName,omitempty"` 4019 // ScheduleOccurrence - The occurrence that triggered the run. 4020 ScheduleOccurrence *string `json:"scheduleOccurrence,omitempty"` 4021} 4022 4023// TimerTriggerUpdateParameters the properties for updating a timer trigger. 4024type TimerTriggerUpdateParameters struct { 4025 // Schedule - The CRON expression for the task schedule 4026 Schedule *string `json:"schedule,omitempty"` 4027 // Status - The current status of trigger. Possible values include: 'TriggerStatusDisabled', 'TriggerStatusEnabled' 4028 Status TriggerStatus `json:"status,omitempty"` 4029 // Name - The name of the trigger. 4030 Name *string `json:"name,omitempty"` 4031} 4032 4033// TriggerProperties the properties of a trigger. 4034type TriggerProperties struct { 4035 // TimerTriggers - The collection of timer triggers. 4036 TimerTriggers *[]TimerTrigger `json:"timerTriggers,omitempty"` 4037 // SourceTriggers - The collection of triggers based on source code repository. 4038 SourceTriggers *[]SourceTrigger `json:"sourceTriggers,omitempty"` 4039 // BaseImageTrigger - The trigger based on base image dependencies. 4040 BaseImageTrigger *BaseImageTrigger `json:"baseImageTrigger,omitempty"` 4041} 4042 4043// TriggerUpdateParameters the properties for updating triggers. 4044type TriggerUpdateParameters struct { 4045 // TimerTriggers - The collection of timer triggers. 4046 TimerTriggers *[]TimerTriggerUpdateParameters `json:"timerTriggers,omitempty"` 4047 // SourceTriggers - The collection of triggers based on source code repository. 4048 SourceTriggers *[]SourceTriggerUpdateParameters `json:"sourceTriggers,omitempty"` 4049 // BaseImageTrigger - The trigger based on base image dependencies. 4050 BaseImageTrigger *BaseImageTriggerUpdateParameters `json:"baseImageTrigger,omitempty"` 4051} 4052 4053// TrustPolicy the content trust policy for a container registry. 4054type TrustPolicy struct { 4055 // Type - The type of trust policy. Possible values include: 'Notary' 4056 Type TrustPolicyType `json:"type,omitempty"` 4057 // Status - The value that indicates whether the policy is enabled or not. Possible values include: 'Enabled', 'Disabled' 4058 Status PolicyStatus `json:"status,omitempty"` 4059} 4060 4061// UserIdentityProperties ... 4062type UserIdentityProperties struct { 4063 // PrincipalID - The principal id of user assigned identity. 4064 PrincipalID *string `json:"principalId,omitempty"` 4065 // ClientID - The client id of user assigned identity. 4066 ClientID *string `json:"clientId,omitempty"` 4067} 4068 4069// VirtualNetworkRule virtual network rule. 4070type VirtualNetworkRule struct { 4071 // Action - The action of virtual network rule. Possible values include: 'Allow' 4072 Action Action `json:"action,omitempty"` 4073 // VirtualNetworkResourceID - Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. 4074 VirtualNetworkResourceID *string `json:"id,omitempty"` 4075} 4076 4077// Webhook an object that represents a webhook for a container registry. 4078type Webhook struct { 4079 autorest.Response `json:"-"` 4080 // WebhookProperties - The properties of the webhook. 4081 *WebhookProperties `json:"properties,omitempty"` 4082 // ID - READ-ONLY; The resource ID. 4083 ID *string `json:"id,omitempty"` 4084 // Name - READ-ONLY; The name of the resource. 4085 Name *string `json:"name,omitempty"` 4086 // Type - READ-ONLY; The type of the resource. 4087 Type *string `json:"type,omitempty"` 4088 // Location - The location of the resource. This cannot be changed after the resource is created. 4089 Location *string `json:"location,omitempty"` 4090 // Tags - The tags of the resource. 4091 Tags map[string]*string `json:"tags"` 4092} 4093 4094// MarshalJSON is the custom marshaler for Webhook. 4095func (w Webhook) MarshalJSON() ([]byte, error) { 4096 objectMap := make(map[string]interface{}) 4097 if w.WebhookProperties != nil { 4098 objectMap["properties"] = w.WebhookProperties 4099 } 4100 if w.Location != nil { 4101 objectMap["location"] = w.Location 4102 } 4103 if w.Tags != nil { 4104 objectMap["tags"] = w.Tags 4105 } 4106 return json.Marshal(objectMap) 4107} 4108 4109// UnmarshalJSON is the custom unmarshaler for Webhook struct. 4110func (w *Webhook) UnmarshalJSON(body []byte) error { 4111 var m map[string]*json.RawMessage 4112 err := json.Unmarshal(body, &m) 4113 if err != nil { 4114 return err 4115 } 4116 for k, v := range m { 4117 switch k { 4118 case "properties": 4119 if v != nil { 4120 var webhookProperties WebhookProperties 4121 err = json.Unmarshal(*v, &webhookProperties) 4122 if err != nil { 4123 return err 4124 } 4125 w.WebhookProperties = &webhookProperties 4126 } 4127 case "id": 4128 if v != nil { 4129 var ID string 4130 err = json.Unmarshal(*v, &ID) 4131 if err != nil { 4132 return err 4133 } 4134 w.ID = &ID 4135 } 4136 case "name": 4137 if v != nil { 4138 var name string 4139 err = json.Unmarshal(*v, &name) 4140 if err != nil { 4141 return err 4142 } 4143 w.Name = &name 4144 } 4145 case "type": 4146 if v != nil { 4147 var typeVar string 4148 err = json.Unmarshal(*v, &typeVar) 4149 if err != nil { 4150 return err 4151 } 4152 w.Type = &typeVar 4153 } 4154 case "location": 4155 if v != nil { 4156 var location string 4157 err = json.Unmarshal(*v, &location) 4158 if err != nil { 4159 return err 4160 } 4161 w.Location = &location 4162 } 4163 case "tags": 4164 if v != nil { 4165 var tags map[string]*string 4166 err = json.Unmarshal(*v, &tags) 4167 if err != nil { 4168 return err 4169 } 4170 w.Tags = tags 4171 } 4172 } 4173 } 4174 4175 return nil 4176} 4177 4178// WebhookCreateParameters the parameters for creating a webhook. 4179type WebhookCreateParameters struct { 4180 // Tags - The tags for the webhook. 4181 Tags map[string]*string `json:"tags"` 4182 // Location - The location of the webhook. This cannot be changed after the resource is created. 4183 Location *string `json:"location,omitempty"` 4184 // WebhookPropertiesCreateParameters - The properties that the webhook will be created with. 4185 *WebhookPropertiesCreateParameters `json:"properties,omitempty"` 4186} 4187 4188// MarshalJSON is the custom marshaler for WebhookCreateParameters. 4189func (wcp WebhookCreateParameters) MarshalJSON() ([]byte, error) { 4190 objectMap := make(map[string]interface{}) 4191 if wcp.Tags != nil { 4192 objectMap["tags"] = wcp.Tags 4193 } 4194 if wcp.Location != nil { 4195 objectMap["location"] = wcp.Location 4196 } 4197 if wcp.WebhookPropertiesCreateParameters != nil { 4198 objectMap["properties"] = wcp.WebhookPropertiesCreateParameters 4199 } 4200 return json.Marshal(objectMap) 4201} 4202 4203// UnmarshalJSON is the custom unmarshaler for WebhookCreateParameters struct. 4204func (wcp *WebhookCreateParameters) UnmarshalJSON(body []byte) error { 4205 var m map[string]*json.RawMessage 4206 err := json.Unmarshal(body, &m) 4207 if err != nil { 4208 return err 4209 } 4210 for k, v := range m { 4211 switch k { 4212 case "tags": 4213 if v != nil { 4214 var tags map[string]*string 4215 err = json.Unmarshal(*v, &tags) 4216 if err != nil { 4217 return err 4218 } 4219 wcp.Tags = tags 4220 } 4221 case "location": 4222 if v != nil { 4223 var location string 4224 err = json.Unmarshal(*v, &location) 4225 if err != nil { 4226 return err 4227 } 4228 wcp.Location = &location 4229 } 4230 case "properties": 4231 if v != nil { 4232 var webhookPropertiesCreateParameters WebhookPropertiesCreateParameters 4233 err = json.Unmarshal(*v, &webhookPropertiesCreateParameters) 4234 if err != nil { 4235 return err 4236 } 4237 wcp.WebhookPropertiesCreateParameters = &webhookPropertiesCreateParameters 4238 } 4239 } 4240 } 4241 4242 return nil 4243} 4244 4245// WebhookListResult the result of a request to list webhooks for a container registry. 4246type WebhookListResult struct { 4247 autorest.Response `json:"-"` 4248 // Value - The list of webhooks. Since this list may be incomplete, the nextLink field should be used to request the next list of webhooks. 4249 Value *[]Webhook `json:"value,omitempty"` 4250 // NextLink - The URI that can be used to request the next list of webhooks. 4251 NextLink *string `json:"nextLink,omitempty"` 4252} 4253 4254// WebhookListResultIterator provides access to a complete listing of Webhook values. 4255type WebhookListResultIterator struct { 4256 i int 4257 page WebhookListResultPage 4258} 4259 4260// NextWithContext advances to the next value. If there was an error making 4261// the request the iterator does not advance and the error is returned. 4262func (iter *WebhookListResultIterator) NextWithContext(ctx context.Context) (err error) { 4263 if tracing.IsEnabled() { 4264 ctx = tracing.StartSpan(ctx, fqdn+"/WebhookListResultIterator.NextWithContext") 4265 defer func() { 4266 sc := -1 4267 if iter.Response().Response.Response != nil { 4268 sc = iter.Response().Response.Response.StatusCode 4269 } 4270 tracing.EndSpan(ctx, sc, err) 4271 }() 4272 } 4273 iter.i++ 4274 if iter.i < len(iter.page.Values()) { 4275 return nil 4276 } 4277 err = iter.page.NextWithContext(ctx) 4278 if err != nil { 4279 iter.i-- 4280 return err 4281 } 4282 iter.i = 0 4283 return nil 4284} 4285 4286// Next advances to the next value. If there was an error making 4287// the request the iterator does not advance and the error is returned. 4288// Deprecated: Use NextWithContext() instead. 4289func (iter *WebhookListResultIterator) Next() error { 4290 return iter.NextWithContext(context.Background()) 4291} 4292 4293// NotDone returns true if the enumeration should be started or is not yet complete. 4294func (iter WebhookListResultIterator) NotDone() bool { 4295 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 4296} 4297 4298// Response returns the raw server response from the last page request. 4299func (iter WebhookListResultIterator) Response() WebhookListResult { 4300 return iter.page.Response() 4301} 4302 4303// Value returns the current value or a zero-initialized value if the 4304// iterator has advanced beyond the end of the collection. 4305func (iter WebhookListResultIterator) Value() Webhook { 4306 if !iter.page.NotDone() { 4307 return Webhook{} 4308 } 4309 return iter.page.Values()[iter.i] 4310} 4311 4312// Creates a new instance of the WebhookListResultIterator type. 4313func NewWebhookListResultIterator(page WebhookListResultPage) WebhookListResultIterator { 4314 return WebhookListResultIterator{page: page} 4315} 4316 4317// IsEmpty returns true if the ListResult contains no values. 4318func (wlr WebhookListResult) IsEmpty() bool { 4319 return wlr.Value == nil || len(*wlr.Value) == 0 4320} 4321 4322// hasNextLink returns true if the NextLink is not empty. 4323func (wlr WebhookListResult) hasNextLink() bool { 4324 return wlr.NextLink != nil && len(*wlr.NextLink) != 0 4325} 4326 4327// webhookListResultPreparer prepares a request to retrieve the next set of results. 4328// It returns nil if no more results exist. 4329func (wlr WebhookListResult) webhookListResultPreparer(ctx context.Context) (*http.Request, error) { 4330 if !wlr.hasNextLink() { 4331 return nil, nil 4332 } 4333 return autorest.Prepare((&http.Request{}).WithContext(ctx), 4334 autorest.AsJSON(), 4335 autorest.AsGet(), 4336 autorest.WithBaseURL(to.String(wlr.NextLink))) 4337} 4338 4339// WebhookListResultPage contains a page of Webhook values. 4340type WebhookListResultPage struct { 4341 fn func(context.Context, WebhookListResult) (WebhookListResult, error) 4342 wlr WebhookListResult 4343} 4344 4345// NextWithContext advances to the next page of values. If there was an error making 4346// the request the page does not advance and the error is returned. 4347func (page *WebhookListResultPage) NextWithContext(ctx context.Context) (err error) { 4348 if tracing.IsEnabled() { 4349 ctx = tracing.StartSpan(ctx, fqdn+"/WebhookListResultPage.NextWithContext") 4350 defer func() { 4351 sc := -1 4352 if page.Response().Response.Response != nil { 4353 sc = page.Response().Response.Response.StatusCode 4354 } 4355 tracing.EndSpan(ctx, sc, err) 4356 }() 4357 } 4358 for { 4359 next, err := page.fn(ctx, page.wlr) 4360 if err != nil { 4361 return err 4362 } 4363 page.wlr = next 4364 if !next.hasNextLink() || !next.IsEmpty() { 4365 break 4366 } 4367 } 4368 return nil 4369} 4370 4371// Next advances to the next page of values. If there was an error making 4372// the request the page does not advance and the error is returned. 4373// Deprecated: Use NextWithContext() instead. 4374func (page *WebhookListResultPage) Next() error { 4375 return page.NextWithContext(context.Background()) 4376} 4377 4378// NotDone returns true if the page enumeration should be started or is not yet complete. 4379func (page WebhookListResultPage) NotDone() bool { 4380 return !page.wlr.IsEmpty() 4381} 4382 4383// Response returns the raw server response from the last page request. 4384func (page WebhookListResultPage) Response() WebhookListResult { 4385 return page.wlr 4386} 4387 4388// Values returns the slice of values for the current page or nil if there are no values. 4389func (page WebhookListResultPage) Values() []Webhook { 4390 if page.wlr.IsEmpty() { 4391 return nil 4392 } 4393 return *page.wlr.Value 4394} 4395 4396// Creates a new instance of the WebhookListResultPage type. 4397func NewWebhookListResultPage(cur WebhookListResult, getNextPage func(context.Context, WebhookListResult) (WebhookListResult, error)) WebhookListResultPage { 4398 return WebhookListResultPage{ 4399 fn: getNextPage, 4400 wlr: cur, 4401 } 4402} 4403 4404// WebhookProperties the properties of a webhook. 4405type WebhookProperties struct { 4406 // Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled' 4407 Status WebhookStatus `json:"status,omitempty"` 4408 // 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. 4409 Scope *string `json:"scope,omitempty"` 4410 // Actions - The list of actions that trigger the webhook to post notifications. 4411 Actions *[]WebhookAction `json:"actions,omitempty"` 4412 // 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' 4413 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 4414} 4415 4416// MarshalJSON is the custom marshaler for WebhookProperties. 4417func (wp WebhookProperties) MarshalJSON() ([]byte, error) { 4418 objectMap := make(map[string]interface{}) 4419 if wp.Status != "" { 4420 objectMap["status"] = wp.Status 4421 } 4422 if wp.Scope != nil { 4423 objectMap["scope"] = wp.Scope 4424 } 4425 if wp.Actions != nil { 4426 objectMap["actions"] = wp.Actions 4427 } 4428 return json.Marshal(objectMap) 4429} 4430 4431// WebhookPropertiesCreateParameters the parameters for creating the properties of a webhook. 4432type WebhookPropertiesCreateParameters struct { 4433 // ServiceURI - The service URI for the webhook to post notifications. 4434 ServiceURI *string `json:"serviceUri,omitempty"` 4435 // CustomHeaders - Custom headers that will be added to the webhook notifications. 4436 CustomHeaders map[string]*string `json:"customHeaders"` 4437 // Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled' 4438 Status WebhookStatus `json:"status,omitempty"` 4439 // 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. 4440 Scope *string `json:"scope,omitempty"` 4441 // Actions - The list of actions that trigger the webhook to post notifications. 4442 Actions *[]WebhookAction `json:"actions,omitempty"` 4443} 4444 4445// MarshalJSON is the custom marshaler for WebhookPropertiesCreateParameters. 4446func (wpcp WebhookPropertiesCreateParameters) MarshalJSON() ([]byte, error) { 4447 objectMap := make(map[string]interface{}) 4448 if wpcp.ServiceURI != nil { 4449 objectMap["serviceUri"] = wpcp.ServiceURI 4450 } 4451 if wpcp.CustomHeaders != nil { 4452 objectMap["customHeaders"] = wpcp.CustomHeaders 4453 } 4454 if wpcp.Status != "" { 4455 objectMap["status"] = wpcp.Status 4456 } 4457 if wpcp.Scope != nil { 4458 objectMap["scope"] = wpcp.Scope 4459 } 4460 if wpcp.Actions != nil { 4461 objectMap["actions"] = wpcp.Actions 4462 } 4463 return json.Marshal(objectMap) 4464} 4465 4466// WebhookPropertiesUpdateParameters the parameters for updating the properties of a webhook. 4467type WebhookPropertiesUpdateParameters struct { 4468 // ServiceURI - The service URI for the webhook to post notifications. 4469 ServiceURI *string `json:"serviceUri,omitempty"` 4470 // CustomHeaders - Custom headers that will be added to the webhook notifications. 4471 CustomHeaders map[string]*string `json:"customHeaders"` 4472 // Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled' 4473 Status WebhookStatus `json:"status,omitempty"` 4474 // 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. 4475 Scope *string `json:"scope,omitempty"` 4476 // Actions - The list of actions that trigger the webhook to post notifications. 4477 Actions *[]WebhookAction `json:"actions,omitempty"` 4478} 4479 4480// MarshalJSON is the custom marshaler for WebhookPropertiesUpdateParameters. 4481func (wpup WebhookPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { 4482 objectMap := make(map[string]interface{}) 4483 if wpup.ServiceURI != nil { 4484 objectMap["serviceUri"] = wpup.ServiceURI 4485 } 4486 if wpup.CustomHeaders != nil { 4487 objectMap["customHeaders"] = wpup.CustomHeaders 4488 } 4489 if wpup.Status != "" { 4490 objectMap["status"] = wpup.Status 4491 } 4492 if wpup.Scope != nil { 4493 objectMap["scope"] = wpup.Scope 4494 } 4495 if wpup.Actions != nil { 4496 objectMap["actions"] = wpup.Actions 4497 } 4498 return json.Marshal(objectMap) 4499} 4500 4501// WebhooksCreateFuture an abstraction for monitoring and retrieving the results of a long-running 4502// operation. 4503type WebhooksCreateFuture struct { 4504 azure.FutureAPI 4505 // Result returns the result of the asynchronous operation. 4506 // If the operation has not completed it will return an error. 4507 Result func(WebhooksClient) (Webhook, error) 4508} 4509 4510// WebhooksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 4511// operation. 4512type WebhooksDeleteFuture struct { 4513 azure.FutureAPI 4514 // Result returns the result of the asynchronous operation. 4515 // If the operation has not completed it will return an error. 4516 Result func(WebhooksClient) (autorest.Response, error) 4517} 4518 4519// WebhooksUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 4520// operation. 4521type WebhooksUpdateFuture struct { 4522 azure.FutureAPI 4523 // Result returns the result of the asynchronous operation. 4524 // If the operation has not completed it will return an error. 4525 Result func(WebhooksClient) (Webhook, error) 4526} 4527 4528// WebhookUpdateParameters the parameters for updating a webhook. 4529type WebhookUpdateParameters struct { 4530 // Tags - The tags for the webhook. 4531 Tags map[string]*string `json:"tags"` 4532 // WebhookPropertiesUpdateParameters - The properties that the webhook will be updated with. 4533 *WebhookPropertiesUpdateParameters `json:"properties,omitempty"` 4534} 4535 4536// MarshalJSON is the custom marshaler for WebhookUpdateParameters. 4537func (wup WebhookUpdateParameters) MarshalJSON() ([]byte, error) { 4538 objectMap := make(map[string]interface{}) 4539 if wup.Tags != nil { 4540 objectMap["tags"] = wup.Tags 4541 } 4542 if wup.WebhookPropertiesUpdateParameters != nil { 4543 objectMap["properties"] = wup.WebhookPropertiesUpdateParameters 4544 } 4545 return json.Marshal(objectMap) 4546} 4547 4548// UnmarshalJSON is the custom unmarshaler for WebhookUpdateParameters struct. 4549func (wup *WebhookUpdateParameters) UnmarshalJSON(body []byte) error { 4550 var m map[string]*json.RawMessage 4551 err := json.Unmarshal(body, &m) 4552 if err != nil { 4553 return err 4554 } 4555 for k, v := range m { 4556 switch k { 4557 case "tags": 4558 if v != nil { 4559 var tags map[string]*string 4560 err = json.Unmarshal(*v, &tags) 4561 if err != nil { 4562 return err 4563 } 4564 wup.Tags = tags 4565 } 4566 case "properties": 4567 if v != nil { 4568 var webhookPropertiesUpdateParameters WebhookPropertiesUpdateParameters 4569 err = json.Unmarshal(*v, &webhookPropertiesUpdateParameters) 4570 if err != nil { 4571 return err 4572 } 4573 wup.WebhookPropertiesUpdateParameters = &webhookPropertiesUpdateParameters 4574 } 4575 } 4576 } 4577 4578 return nil 4579} 4580