1# coding=utf-8 2# -------------------------------------------------------------------------- 3# Copyright (c) Microsoft Corporation. All rights reserved. 4# Licensed under the MIT License. See License.txt in the project root for 5# license information. 6# 7# Code generated by Microsoft (R) AutoRest Code Generator. 8# Changes may cause incorrect behavior and will be lost if the code is 9# regenerated. 10# -------------------------------------------------------------------------- 11 12from msrest.serialization import Model 13from msrest.exceptions import HttpOperationError 14 15 16class ApiError(Model): 17 """Api error. 18 19 :param details: The Api error details 20 :type details: list[~azure.mgmt.imagebuilder.models.ApiErrorBase] 21 :param inner_error: The Api inner error 22 :type inner_error: ~azure.mgmt.imagebuilder.models.InnerError 23 :param code: The error code. 24 :type code: str 25 :param target: The target of the particular error. 26 :type target: str 27 :param message: The error message. 28 :type message: str 29 """ 30 31 _attribute_map = { 32 'details': {'key': 'details', 'type': '[ApiErrorBase]'}, 33 'inner_error': {'key': 'innerError', 'type': 'InnerError'}, 34 'code': {'key': 'code', 'type': 'str'}, 35 'target': {'key': 'target', 'type': 'str'}, 36 'message': {'key': 'message', 'type': 'str'}, 37 } 38 39 def __init__(self, *, details=None, inner_error=None, code: str=None, target: str=None, message: str=None, **kwargs) -> None: 40 super(ApiError, self).__init__(**kwargs) 41 self.details = details 42 self.inner_error = inner_error 43 self.code = code 44 self.target = target 45 self.message = message 46 47 48class ApiErrorException(HttpOperationError): 49 """Server responsed with exception of type: 'ApiError'. 50 51 :param deserialize: A deserializer 52 :param response: Server response to be deserialized. 53 """ 54 55 def __init__(self, deserialize, response, *args): 56 57 super(ApiErrorException, self).__init__(deserialize, response, 'ApiError', *args) 58 59 60class ApiErrorBase(Model): 61 """Api error base. 62 63 :param code: The error code. 64 :type code: str 65 :param target: The target of the particular error. 66 :type target: str 67 :param message: The error message. 68 :type message: str 69 """ 70 71 _attribute_map = { 72 'code': {'key': 'code', 'type': 'str'}, 73 'target': {'key': 'target', 'type': 'str'}, 74 'message': {'key': 'message', 'type': 'str'}, 75 } 76 77 def __init__(self, *, code: str=None, target: str=None, message: str=None, **kwargs) -> None: 78 super(ApiErrorBase, self).__init__(**kwargs) 79 self.code = code 80 self.target = target 81 self.message = message 82 83 84class CloudError(Model): 85 """CloudError. 86 """ 87 88 _attribute_map = { 89 } 90 91 92class Resource(Model): 93 """The Resource model definition. 94 95 Variables are only populated by the server, and will be ignored when 96 sending a request. 97 98 All required parameters must be populated in order to send to Azure. 99 100 :ivar id: Resource Id 101 :vartype id: str 102 :ivar name: Resource name 103 :vartype name: str 104 :ivar type: Resource type 105 :vartype type: str 106 :param location: Required. Resource location 107 :type location: str 108 :param tags: Resource tags 109 :type tags: dict[str, str] 110 """ 111 112 _validation = { 113 'id': {'readonly': True}, 114 'name': {'readonly': True}, 115 'type': {'readonly': True}, 116 'location': {'required': True}, 117 } 118 119 _attribute_map = { 120 'id': {'key': 'id', 'type': 'str'}, 121 'name': {'key': 'name', 'type': 'str'}, 122 'type': {'key': 'type', 'type': 'str'}, 123 'location': {'key': 'location', 'type': 'str'}, 124 'tags': {'key': 'tags', 'type': '{str}'}, 125 } 126 127 def __init__(self, *, location: str, tags=None, **kwargs) -> None: 128 super(Resource, self).__init__(**kwargs) 129 self.id = None 130 self.name = None 131 self.type = None 132 self.location = location 133 self.tags = tags 134 135 136class ImageTemplate(Resource): 137 """Image template is an ARM resource managed by Microsoft.VirtualMachineImages 138 provider. 139 140 Variables are only populated by the server, and will be ignored when 141 sending a request. 142 143 All required parameters must be populated in order to send to Azure. 144 145 :ivar id: Resource Id 146 :vartype id: str 147 :ivar name: Resource name 148 :vartype name: str 149 :ivar type: Resource type 150 :vartype type: str 151 :param location: Required. Resource location 152 :type location: str 153 :param tags: Resource tags 154 :type tags: dict[str, str] 155 :param source: Required. Specifies the properties used to describe the 156 source image. 157 :type source: ~azure.mgmt.imagebuilder.models.ImageTemplateSource 158 :param customize: Specifies the properties used to describe the 159 customization steps of the image, like Image source etc 160 :type customize: 161 list[~azure.mgmt.imagebuilder.models.ImageTemplateCustomizer] 162 :param distribute: Required. The distribution targets where the image 163 output needs to go to. 164 :type distribute: 165 list[~azure.mgmt.imagebuilder.models.ImageTemplateDistributor] 166 :ivar provisioning_state: Provisioning state of the resource. Possible 167 values include: 'Creating', 'Updating', 'Succeeded', 'Failed', 'Deleting' 168 :vartype provisioning_state: str or 169 ~azure.mgmt.imagebuilder.models.ProvisioningState 170 :ivar provisioning_error: Provisioning error, if any 171 :vartype provisioning_error: 172 ~azure.mgmt.imagebuilder.models.ProvisioningError 173 :ivar last_run_status: State of 'run' that is currently executing or was 174 last executed. 175 :vartype last_run_status: 176 ~azure.mgmt.imagebuilder.models.ImageTemplateLastRunStatus 177 :param build_timeout_in_minutes: Maximum duration to wait while building 178 the image template. Omit or specify 0 to use the default (4 hours). 179 :type build_timeout_in_minutes: int 180 :param vm_profile: Describes how virtual machine is set up to build images 181 :type vm_profile: ~azure.mgmt.imagebuilder.models.ImageTemplateVmProfile 182 :param identity: Required. The identity of the image template, if 183 configured. 184 :type identity: ~azure.mgmt.imagebuilder.models.ImageTemplateIdentity 185 """ 186 187 _validation = { 188 'id': {'readonly': True}, 189 'name': {'readonly': True}, 190 'type': {'readonly': True}, 191 'location': {'required': True}, 192 'source': {'required': True}, 193 'distribute': {'required': True}, 194 'provisioning_state': {'readonly': True}, 195 'provisioning_error': {'readonly': True}, 196 'last_run_status': {'readonly': True}, 197 'build_timeout_in_minutes': {'maximum': 960, 'minimum': 0}, 198 'identity': {'required': True}, 199 } 200 201 _attribute_map = { 202 'id': {'key': 'id', 'type': 'str'}, 203 'name': {'key': 'name', 'type': 'str'}, 204 'type': {'key': 'type', 'type': 'str'}, 205 'location': {'key': 'location', 'type': 'str'}, 206 'tags': {'key': 'tags', 'type': '{str}'}, 207 'source': {'key': 'properties.source', 'type': 'ImageTemplateSource'}, 208 'customize': {'key': 'properties.customize', 'type': '[ImageTemplateCustomizer]'}, 209 'distribute': {'key': 'properties.distribute', 'type': '[ImageTemplateDistributor]'}, 210 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, 211 'provisioning_error': {'key': 'properties.provisioningError', 'type': 'ProvisioningError'}, 212 'last_run_status': {'key': 'properties.lastRunStatus', 'type': 'ImageTemplateLastRunStatus'}, 213 'build_timeout_in_minutes': {'key': 'properties.buildTimeoutInMinutes', 'type': 'int'}, 214 'vm_profile': {'key': 'properties.vmProfile', 'type': 'ImageTemplateVmProfile'}, 215 'identity': {'key': 'identity', 'type': 'ImageTemplateIdentity'}, 216 } 217 218 def __init__(self, *, location: str, source, distribute, identity, tags=None, customize=None, build_timeout_in_minutes: int=None, vm_profile=None, **kwargs) -> None: 219 super(ImageTemplate, self).__init__(location=location, tags=tags, **kwargs) 220 self.source = source 221 self.customize = customize 222 self.distribute = distribute 223 self.provisioning_state = None 224 self.provisioning_error = None 225 self.last_run_status = None 226 self.build_timeout_in_minutes = build_timeout_in_minutes 227 self.vm_profile = vm_profile 228 self.identity = identity 229 230 231class ImageTemplateCustomizer(Model): 232 """Describes a unit of image customization. 233 234 You probably want to use the sub-classes and not this class directly. Known 235 sub-classes are: ImageTemplateShellCustomizer, 236 ImageTemplateRestartCustomizer, ImageTemplateWindowsUpdateCustomizer, 237 ImageTemplatePowerShellCustomizer, ImageTemplateFileCustomizer 238 239 All required parameters must be populated in order to send to Azure. 240 241 :param name: Friendly Name to provide context on what this customization 242 step does 243 :type name: str 244 :param type: Required. Constant filled by server. 245 :type type: str 246 """ 247 248 _validation = { 249 'type': {'required': True}, 250 } 251 252 _attribute_map = { 253 'name': {'key': 'name', 'type': 'str'}, 254 'type': {'key': 'type', 'type': 'str'}, 255 } 256 257 _subtype_map = { 258 'type': {'Shell': 'ImageTemplateShellCustomizer', 'WindowsRestart': 'ImageTemplateRestartCustomizer', 'WindowsUpdate': 'ImageTemplateWindowsUpdateCustomizer', 'PowerShell': 'ImageTemplatePowerShellCustomizer', 'File': 'ImageTemplateFileCustomizer'} 259 } 260 261 def __init__(self, *, name: str=None, **kwargs) -> None: 262 super(ImageTemplateCustomizer, self).__init__(**kwargs) 263 self.name = name 264 self.type = None 265 266 267class ImageTemplateDistributor(Model): 268 """Generic distribution object. 269 270 You probably want to use the sub-classes and not this class directly. Known 271 sub-classes are: ImageTemplateManagedImageDistributor, 272 ImageTemplateSharedImageDistributor, ImageTemplateVhdDistributor 273 274 All required parameters must be populated in order to send to Azure. 275 276 :param run_output_name: Required. The name to be used for the associated 277 RunOutput. 278 :type run_output_name: str 279 :param artifact_tags: Tags that will be applied to the artifact once it 280 has been created/updated by the distributor. 281 :type artifact_tags: dict[str, str] 282 :param type: Required. Constant filled by server. 283 :type type: str 284 """ 285 286 _validation = { 287 'run_output_name': {'required': True, 'pattern': r'^[A-Za-z0-9-_.]{1,64}$'}, 288 'type': {'required': True}, 289 } 290 291 _attribute_map = { 292 'run_output_name': {'key': 'runOutputName', 'type': 'str'}, 293 'artifact_tags': {'key': 'artifactTags', 'type': '{str}'}, 294 'type': {'key': 'type', 'type': 'str'}, 295 } 296 297 _subtype_map = { 298 'type': {'ManagedImage': 'ImageTemplateManagedImageDistributor', 'SharedImage': 'ImageTemplateSharedImageDistributor', 'VHD': 'ImageTemplateVhdDistributor'} 299 } 300 301 def __init__(self, *, run_output_name: str, artifact_tags=None, **kwargs) -> None: 302 super(ImageTemplateDistributor, self).__init__(**kwargs) 303 self.run_output_name = run_output_name 304 self.artifact_tags = artifact_tags 305 self.type = None 306 307 308class ImageTemplateFileCustomizer(ImageTemplateCustomizer): 309 """Uploads files to VMs (Linux, Windows). Corresponds to Packer file 310 provisioner. 311 312 All required parameters must be populated in order to send to Azure. 313 314 :param name: Friendly Name to provide context on what this customization 315 step does 316 :type name: str 317 :param type: Required. Constant filled by server. 318 :type type: str 319 :param source_uri: The URI of the file to be uploaded for customizing the 320 VM. It can be a github link, SAS URI for Azure Storage, etc 321 :type source_uri: str 322 :param sha256_checksum: SHA256 checksum of the file provided in the 323 sourceUri field above 324 :type sha256_checksum: str 325 :param destination: The absolute path to a file (with nested directory 326 structures already created) where the file (from sourceUri) will be 327 uploaded to in the VM 328 :type destination: str 329 """ 330 331 _validation = { 332 'type': {'required': True}, 333 } 334 335 _attribute_map = { 336 'name': {'key': 'name', 'type': 'str'}, 337 'type': {'key': 'type', 'type': 'str'}, 338 'source_uri': {'key': 'sourceUri', 'type': 'str'}, 339 'sha256_checksum': {'key': 'sha256Checksum', 'type': 'str'}, 340 'destination': {'key': 'destination', 'type': 'str'}, 341 } 342 343 def __init__(self, *, name: str=None, source_uri: str=None, sha256_checksum: str=None, destination: str=None, **kwargs) -> None: 344 super(ImageTemplateFileCustomizer, self).__init__(name=name, **kwargs) 345 self.source_uri = source_uri 346 self.sha256_checksum = sha256_checksum 347 self.destination = destination 348 self.type = 'File' 349 350 351class ImageTemplateIdentity(Model): 352 """Identity for the image template. 353 354 :param type: The type of identity used for the image template. Possible 355 values include: 'UserAssigned' 356 :type type: str or ~azure.mgmt.imagebuilder.models.ResourceIdentityType 357 :param user_assigned_identities: The list of user identities associated 358 with the image template. The user identity dictionary key references will 359 be ARM resource ids in the form: 360 '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. 361 :type user_assigned_identities: dict[str, 362 ~azure.mgmt.imagebuilder.models.ImageTemplateIdentityUserAssignedIdentitiesValue] 363 """ 364 365 _attribute_map = { 366 'type': {'key': 'type', 'type': 'ResourceIdentityType'}, 367 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ImageTemplateIdentityUserAssignedIdentitiesValue}'}, 368 } 369 370 def __init__(self, *, type=None, user_assigned_identities=None, **kwargs) -> None: 371 super(ImageTemplateIdentity, self).__init__(**kwargs) 372 self.type = type 373 self.user_assigned_identities = user_assigned_identities 374 375 376class ImageTemplateIdentityUserAssignedIdentitiesValue(Model): 377 """ImageTemplateIdentityUserAssignedIdentitiesValue. 378 379 Variables are only populated by the server, and will be ignored when 380 sending a request. 381 382 :ivar principal_id: The principal id of user assigned identity. 383 :vartype principal_id: str 384 :ivar client_id: The client id of user assigned identity. 385 :vartype client_id: str 386 """ 387 388 _validation = { 389 'principal_id': {'readonly': True}, 390 'client_id': {'readonly': True}, 391 } 392 393 _attribute_map = { 394 'principal_id': {'key': 'principalId', 'type': 'str'}, 395 'client_id': {'key': 'clientId', 'type': 'str'}, 396 } 397 398 def __init__(self, **kwargs) -> None: 399 super(ImageTemplateIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) 400 self.principal_id = None 401 self.client_id = None 402 403 404class ImageTemplateLastRunStatus(Model): 405 """Describes the latest status of running an image template. 406 407 :param start_time: Start time of the last run (UTC) 408 :type start_time: datetime 409 :param end_time: End time of the last run (UTC) 410 :type end_time: datetime 411 :param run_state: State of the last run. Possible values include: 412 'Running', 'Canceling', 'Succeeded', 'PartiallySucceeded', 'Failed', 413 'Canceled' 414 :type run_state: str or ~azure.mgmt.imagebuilder.models.RunState 415 :param run_sub_state: Sub-state of the last run. Possible values include: 416 'Queued', 'Building', 'Customizing', 'Distributing' 417 :type run_sub_state: str or ~azure.mgmt.imagebuilder.models.RunSubState 418 :param message: Verbose information about the last run state 419 :type message: str 420 """ 421 422 _attribute_map = { 423 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, 424 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, 425 'run_state': {'key': 'runState', 'type': 'RunState'}, 426 'run_sub_state': {'key': 'runSubState', 'type': 'RunSubState'}, 427 'message': {'key': 'message', 'type': 'str'}, 428 } 429 430 def __init__(self, *, start_time=None, end_time=None, run_state=None, run_sub_state=None, message: str=None, **kwargs) -> None: 431 super(ImageTemplateLastRunStatus, self).__init__(**kwargs) 432 self.start_time = start_time 433 self.end_time = end_time 434 self.run_state = run_state 435 self.run_sub_state = run_sub_state 436 self.message = message 437 438 439class ImageTemplateManagedImageDistributor(ImageTemplateDistributor): 440 """Distribute as a Managed Disk Image. 441 442 All required parameters must be populated in order to send to Azure. 443 444 :param run_output_name: Required. The name to be used for the associated 445 RunOutput. 446 :type run_output_name: str 447 :param artifact_tags: Tags that will be applied to the artifact once it 448 has been created/updated by the distributor. 449 :type artifact_tags: dict[str, str] 450 :param type: Required. Constant filled by server. 451 :type type: str 452 :param image_id: Required. Resource Id of the Managed Disk Image 453 :type image_id: str 454 :param location: Required. Azure location for the image, should match if 455 image already exists 456 :type location: str 457 """ 458 459 _validation = { 460 'run_output_name': {'required': True, 'pattern': r'^[A-Za-z0-9-_.]{1,64}$'}, 461 'type': {'required': True}, 462 'image_id': {'required': True}, 463 'location': {'required': True}, 464 } 465 466 _attribute_map = { 467 'run_output_name': {'key': 'runOutputName', 'type': 'str'}, 468 'artifact_tags': {'key': 'artifactTags', 'type': '{str}'}, 469 'type': {'key': 'type', 'type': 'str'}, 470 'image_id': {'key': 'imageId', 'type': 'str'}, 471 'location': {'key': 'location', 'type': 'str'}, 472 } 473 474 def __init__(self, *, run_output_name: str, image_id: str, location: str, artifact_tags=None, **kwargs) -> None: 475 super(ImageTemplateManagedImageDistributor, self).__init__(run_output_name=run_output_name, artifact_tags=artifact_tags, **kwargs) 476 self.image_id = image_id 477 self.location = location 478 self.type = 'ManagedImage' 479 480 481class ImageTemplateSource(Model): 482 """Describes a virtual machine image source for building, customizing and 483 distributing. 484 485 You probably want to use the sub-classes and not this class directly. Known 486 sub-classes are: ImageTemplatePlatformImageSource, 487 ImageTemplateManagedImageSource, ImageTemplateSharedImageVersionSource 488 489 All required parameters must be populated in order to send to Azure. 490 491 :param type: Required. Constant filled by server. 492 :type type: str 493 """ 494 495 _validation = { 496 'type': {'required': True}, 497 } 498 499 _attribute_map = { 500 'type': {'key': 'type', 'type': 'str'}, 501 } 502 503 _subtype_map = { 504 'type': {'PlatformImage': 'ImageTemplatePlatformImageSource', 'ManagedImage': 'ImageTemplateManagedImageSource', 'SharedImageVersion': 'ImageTemplateSharedImageVersionSource'} 505 } 506 507 def __init__(self, **kwargs) -> None: 508 super(ImageTemplateSource, self).__init__(**kwargs) 509 self.type = None 510 511 512class ImageTemplateManagedImageSource(ImageTemplateSource): 513 """Describes an image source that is a managed image in customer subscription. 514 515 All required parameters must be populated in order to send to Azure. 516 517 :param type: Required. Constant filled by server. 518 :type type: str 519 :param image_id: Required. ARM resource id of the managed image in 520 customer subscription 521 :type image_id: str 522 """ 523 524 _validation = { 525 'type': {'required': True}, 526 'image_id': {'required': True}, 527 } 528 529 _attribute_map = { 530 'type': {'key': 'type', 'type': 'str'}, 531 'image_id': {'key': 'imageId', 'type': 'str'}, 532 } 533 534 def __init__(self, *, image_id: str, **kwargs) -> None: 535 super(ImageTemplateManagedImageSource, self).__init__(**kwargs) 536 self.image_id = image_id 537 self.type = 'ManagedImage' 538 539 540class ImageTemplatePlatformImageSource(ImageTemplateSource): 541 """Describes an image source from [Azure Gallery 542 Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). 543 544 All required parameters must be populated in order to send to Azure. 545 546 :param type: Required. Constant filled by server. 547 :type type: str 548 :param publisher: Image Publisher in [Azure Gallery 549 Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). 550 :type publisher: str 551 :param offer: Image offer from the [Azure Gallery 552 Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). 553 :type offer: str 554 :param sku: Image sku from the [Azure Gallery 555 Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). 556 :type sku: str 557 :param version: Image version from the [Azure Gallery 558 Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). 559 :type version: str 560 :param plan_info: Optional configuration of purchase plan for platform 561 image. 562 :type plan_info: ~azure.mgmt.imagebuilder.models.PlatformImagePurchasePlan 563 """ 564 565 _validation = { 566 'type': {'required': True}, 567 } 568 569 _attribute_map = { 570 'type': {'key': 'type', 'type': 'str'}, 571 'publisher': {'key': 'publisher', 'type': 'str'}, 572 'offer': {'key': 'offer', 'type': 'str'}, 573 'sku': {'key': 'sku', 'type': 'str'}, 574 'version': {'key': 'version', 'type': 'str'}, 575 'plan_info': {'key': 'planInfo', 'type': 'PlatformImagePurchasePlan'}, 576 } 577 578 def __init__(self, *, publisher: str=None, offer: str=None, sku: str=None, version: str=None, plan_info=None, **kwargs) -> None: 579 super(ImageTemplatePlatformImageSource, self).__init__(**kwargs) 580 self.publisher = publisher 581 self.offer = offer 582 self.sku = sku 583 self.version = version 584 self.plan_info = plan_info 585 self.type = 'PlatformImage' 586 587 588class ImageTemplatePowerShellCustomizer(ImageTemplateCustomizer): 589 """Runs the specified PowerShell on the VM (Windows). Corresponds to Packer 590 powershell provisioner. Exactly one of 'scriptUri' or 'inline' can be 591 specified. 592 593 All required parameters must be populated in order to send to Azure. 594 595 :param name: Friendly Name to provide context on what this customization 596 step does 597 :type name: str 598 :param type: Required. Constant filled by server. 599 :type type: str 600 :param script_uri: URI of the PowerShell script to be run for customizing. 601 It can be a github link, SAS URI for Azure Storage, etc 602 :type script_uri: str 603 :param sha256_checksum: SHA256 checksum of the power shell script provided 604 in the scriptUri field above 605 :type sha256_checksum: str 606 :param inline: Array of PowerShell commands to execute 607 :type inline: list[str] 608 :param run_elevated: If specified, the PowerShell script will be run with 609 elevated privileges 610 :type run_elevated: bool 611 :param valid_exit_codes: Valid exit codes for the PowerShell script. 612 [Default: 0] 613 :type valid_exit_codes: list[int] 614 """ 615 616 _validation = { 617 'type': {'required': True}, 618 } 619 620 _attribute_map = { 621 'name': {'key': 'name', 'type': 'str'}, 622 'type': {'key': 'type', 'type': 'str'}, 623 'script_uri': {'key': 'scriptUri', 'type': 'str'}, 624 'sha256_checksum': {'key': 'sha256Checksum', 'type': 'str'}, 625 'inline': {'key': 'inline', 'type': '[str]'}, 626 'run_elevated': {'key': 'runElevated', 'type': 'bool'}, 627 'valid_exit_codes': {'key': 'validExitCodes', 'type': '[int]'}, 628 } 629 630 def __init__(self, *, name: str=None, script_uri: str=None, sha256_checksum: str=None, inline=None, run_elevated: bool=None, valid_exit_codes=None, **kwargs) -> None: 631 super(ImageTemplatePowerShellCustomizer, self).__init__(name=name, **kwargs) 632 self.script_uri = script_uri 633 self.sha256_checksum = sha256_checksum 634 self.inline = inline 635 self.run_elevated = run_elevated 636 self.valid_exit_codes = valid_exit_codes 637 self.type = 'PowerShell' 638 639 640class ImageTemplateRestartCustomizer(ImageTemplateCustomizer): 641 """Reboots a VM and waits for it to come back online (Windows). Corresponds to 642 Packer windows-restart provisioner. 643 644 All required parameters must be populated in order to send to Azure. 645 646 :param name: Friendly Name to provide context on what this customization 647 step does 648 :type name: str 649 :param type: Required. Constant filled by server. 650 :type type: str 651 :param restart_command: Command to execute the restart [Default: 'shutdown 652 /r /f /t 0 /c "packer restart"'] 653 :type restart_command: str 654 :param restart_check_command: Command to check if restart succeeded 655 [Default: ''] 656 :type restart_check_command: str 657 :param restart_timeout: Restart timeout specified as a string of magnitude 658 and unit, e.g. '5m' (5 minutes) or '2h' (2 hours) [Default: '5m'] 659 :type restart_timeout: str 660 """ 661 662 _validation = { 663 'type': {'required': True}, 664 } 665 666 _attribute_map = { 667 'name': {'key': 'name', 'type': 'str'}, 668 'type': {'key': 'type', 'type': 'str'}, 669 'restart_command': {'key': 'restartCommand', 'type': 'str'}, 670 'restart_check_command': {'key': 'restartCheckCommand', 'type': 'str'}, 671 'restart_timeout': {'key': 'restartTimeout', 'type': 'str'}, 672 } 673 674 def __init__(self, *, name: str=None, restart_command: str=None, restart_check_command: str=None, restart_timeout: str=None, **kwargs) -> None: 675 super(ImageTemplateRestartCustomizer, self).__init__(name=name, **kwargs) 676 self.restart_command = restart_command 677 self.restart_check_command = restart_check_command 678 self.restart_timeout = restart_timeout 679 self.type = 'WindowsRestart' 680 681 682class ImageTemplateSharedImageDistributor(ImageTemplateDistributor): 683 """Distribute via Shared Image Gallery. 684 685 All required parameters must be populated in order to send to Azure. 686 687 :param run_output_name: Required. The name to be used for the associated 688 RunOutput. 689 :type run_output_name: str 690 :param artifact_tags: Tags that will be applied to the artifact once it 691 has been created/updated by the distributor. 692 :type artifact_tags: dict[str, str] 693 :param type: Required. Constant filled by server. 694 :type type: str 695 :param gallery_image_id: Required. Resource Id of the Shared Image Gallery 696 image 697 :type gallery_image_id: str 698 :param replication_regions: Required. A list of regions that the image 699 will be replicated to 700 :type replication_regions: list[str] 701 :param exclude_from_latest: Flag that indicates whether created image 702 version should be excluded from latest. Omit to use the default (false). 703 :type exclude_from_latest: bool 704 :param storage_account_type: Storage account type to be used to store the 705 shared image. Omit to use the default (Standard_LRS). Possible values 706 include: 'Standard_LRS', 'Standard_ZRS' 707 :type storage_account_type: str or 708 ~azure.mgmt.imagebuilder.models.SharedImageStorageAccountType 709 """ 710 711 _validation = { 712 'run_output_name': {'required': True, 'pattern': r'^[A-Za-z0-9-_.]{1,64}$'}, 713 'type': {'required': True}, 714 'gallery_image_id': {'required': True}, 715 'replication_regions': {'required': True}, 716 } 717 718 _attribute_map = { 719 'run_output_name': {'key': 'runOutputName', 'type': 'str'}, 720 'artifact_tags': {'key': 'artifactTags', 'type': '{str}'}, 721 'type': {'key': 'type', 'type': 'str'}, 722 'gallery_image_id': {'key': 'galleryImageId', 'type': 'str'}, 723 'replication_regions': {'key': 'replicationRegions', 'type': '[str]'}, 724 'exclude_from_latest': {'key': 'excludeFromLatest', 'type': 'bool'}, 725 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, 726 } 727 728 def __init__(self, *, run_output_name: str, gallery_image_id: str, replication_regions, artifact_tags=None, exclude_from_latest: bool=None, storage_account_type=None, **kwargs) -> None: 729 super(ImageTemplateSharedImageDistributor, self).__init__(run_output_name=run_output_name, artifact_tags=artifact_tags, **kwargs) 730 self.gallery_image_id = gallery_image_id 731 self.replication_regions = replication_regions 732 self.exclude_from_latest = exclude_from_latest 733 self.storage_account_type = storage_account_type 734 self.type = 'SharedImage' 735 736 737class ImageTemplateSharedImageVersionSource(ImageTemplateSource): 738 """Describes an image source that is an image version in a shared image 739 gallery. 740 741 All required parameters must be populated in order to send to Azure. 742 743 :param type: Required. Constant filled by server. 744 :type type: str 745 :param image_version_id: Required. ARM resource id of the image version in 746 the shared image gallery 747 :type image_version_id: str 748 """ 749 750 _validation = { 751 'type': {'required': True}, 752 'image_version_id': {'required': True}, 753 } 754 755 _attribute_map = { 756 'type': {'key': 'type', 'type': 'str'}, 757 'image_version_id': {'key': 'imageVersionId', 'type': 'str'}, 758 } 759 760 def __init__(self, *, image_version_id: str, **kwargs) -> None: 761 super(ImageTemplateSharedImageVersionSource, self).__init__(**kwargs) 762 self.image_version_id = image_version_id 763 self.type = 'SharedImageVersion' 764 765 766class ImageTemplateShellCustomizer(ImageTemplateCustomizer): 767 """Runs a shell script during the customization phase (Linux). Corresponds to 768 Packer shell provisioner. Exactly one of 'scriptUri' or 'inline' can be 769 specified. 770 771 All required parameters must be populated in order to send to Azure. 772 773 :param name: Friendly Name to provide context on what this customization 774 step does 775 :type name: str 776 :param type: Required. Constant filled by server. 777 :type type: str 778 :param script_uri: URI of the shell script to be run for customizing. It 779 can be a github link, SAS URI for Azure Storage, etc 780 :type script_uri: str 781 :param sha256_checksum: SHA256 checksum of the shell script provided in 782 the scriptUri field 783 :type sha256_checksum: str 784 :param inline: Array of shell commands to execute 785 :type inline: list[str] 786 """ 787 788 _validation = { 789 'type': {'required': True}, 790 } 791 792 _attribute_map = { 793 'name': {'key': 'name', 'type': 'str'}, 794 'type': {'key': 'type', 'type': 'str'}, 795 'script_uri': {'key': 'scriptUri', 'type': 'str'}, 796 'sha256_checksum': {'key': 'sha256Checksum', 'type': 'str'}, 797 'inline': {'key': 'inline', 'type': '[str]'}, 798 } 799 800 def __init__(self, *, name: str=None, script_uri: str=None, sha256_checksum: str=None, inline=None, **kwargs) -> None: 801 super(ImageTemplateShellCustomizer, self).__init__(name=name, **kwargs) 802 self.script_uri = script_uri 803 self.sha256_checksum = sha256_checksum 804 self.inline = inline 805 self.type = 'Shell' 806 807 808class ImageTemplateUpdateParameters(Model): 809 """Parameters for updating an image template. 810 811 :param identity: The identity of the image template, if configured. 812 :type identity: ~azure.mgmt.imagebuilder.models.ImageTemplateIdentity 813 :param tags: The user-specified tags associated with the image template. 814 :type tags: dict[str, str] 815 """ 816 817 _attribute_map = { 818 'identity': {'key': 'identity', 'type': 'ImageTemplateIdentity'}, 819 'tags': {'key': 'tags', 'type': '{str}'}, 820 } 821 822 def __init__(self, *, identity=None, tags=None, **kwargs) -> None: 823 super(ImageTemplateUpdateParameters, self).__init__(**kwargs) 824 self.identity = identity 825 self.tags = tags 826 827 828class ImageTemplateVhdDistributor(ImageTemplateDistributor): 829 """Distribute via VHD in a storage account. 830 831 All required parameters must be populated in order to send to Azure. 832 833 :param run_output_name: Required. The name to be used for the associated 834 RunOutput. 835 :type run_output_name: str 836 :param artifact_tags: Tags that will be applied to the artifact once it 837 has been created/updated by the distributor. 838 :type artifact_tags: dict[str, str] 839 :param type: Required. Constant filled by server. 840 :type type: str 841 """ 842 843 _validation = { 844 'run_output_name': {'required': True, 'pattern': r'^[A-Za-z0-9-_.]{1,64}$'}, 845 'type': {'required': True}, 846 } 847 848 _attribute_map = { 849 'run_output_name': {'key': 'runOutputName', 'type': 'str'}, 850 'artifact_tags': {'key': 'artifactTags', 'type': '{str}'}, 851 'type': {'key': 'type', 'type': 'str'}, 852 } 853 854 def __init__(self, *, run_output_name: str, artifact_tags=None, **kwargs) -> None: 855 super(ImageTemplateVhdDistributor, self).__init__(run_output_name=run_output_name, artifact_tags=artifact_tags, **kwargs) 856 self.type = 'VHD' 857 858 859class ImageTemplateVmProfile(Model): 860 """Describes the virtual machine used to build, customize and capture images. 861 862 :param vm_size: Size of the virtual machine used to build, customize and 863 capture images. Omit or specify empty string to use the default 864 (Standard_D1_v2). 865 :type vm_size: str 866 :param os_disk_size_gb: Size of the OS disk in GB. Omit or specify 0 to 867 use Azure's default OS disk size. 868 :type os_disk_size_gb: int 869 :param vnet_config: Optional configuration of the virtual network to use 870 to deploy the build virtual machine in. Omit if no specific virtual 871 network needs to be used. 872 :type vnet_config: ~azure.mgmt.imagebuilder.models.VirtualNetworkConfig 873 """ 874 875 _validation = { 876 'os_disk_size_gb': {'minimum': 0}, 877 } 878 879 _attribute_map = { 880 'vm_size': {'key': 'vmSize', 'type': 'str'}, 881 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, 882 'vnet_config': {'key': 'vnetConfig', 'type': 'VirtualNetworkConfig'}, 883 } 884 885 def __init__(self, *, vm_size: str=None, os_disk_size_gb: int=None, vnet_config=None, **kwargs) -> None: 886 super(ImageTemplateVmProfile, self).__init__(**kwargs) 887 self.vm_size = vm_size 888 self.os_disk_size_gb = os_disk_size_gb 889 self.vnet_config = vnet_config 890 891 892class ImageTemplateWindowsUpdateCustomizer(ImageTemplateCustomizer): 893 """Installs Windows Updates. Corresponds to Packer Windows Update Provisioner 894 (https://github.com/rgl/packer-provisioner-windows-update). 895 896 All required parameters must be populated in order to send to Azure. 897 898 :param name: Friendly Name to provide context on what this customization 899 step does 900 :type name: str 901 :param type: Required. Constant filled by server. 902 :type type: str 903 :param search_criteria: Criteria to search updates. Omit or specify empty 904 string to use the default (search all). Refer to above link for examples 905 and detailed description of this field. 906 :type search_criteria: str 907 :param filters: Array of filters to select updates to apply. Omit or 908 specify empty array to use the default (no filter). Refer to above link 909 for examples and detailed description of this field. 910 :type filters: list[str] 911 :param update_limit: Maximum number of updates to apply at a time. Omit or 912 specify 0 to use the default (1000) 913 :type update_limit: int 914 """ 915 916 _validation = { 917 'type': {'required': True}, 918 'update_limit': {'minimum': 0}, 919 } 920 921 _attribute_map = { 922 'name': {'key': 'name', 'type': 'str'}, 923 'type': {'key': 'type', 'type': 'str'}, 924 'search_criteria': {'key': 'searchCriteria', 'type': 'str'}, 925 'filters': {'key': 'filters', 'type': '[str]'}, 926 'update_limit': {'key': 'updateLimit', 'type': 'int'}, 927 } 928 929 def __init__(self, *, name: str=None, search_criteria: str=None, filters=None, update_limit: int=None, **kwargs) -> None: 930 super(ImageTemplateWindowsUpdateCustomizer, self).__init__(name=name, **kwargs) 931 self.search_criteria = search_criteria 932 self.filters = filters 933 self.update_limit = update_limit 934 self.type = 'WindowsUpdate' 935 936 937class InnerError(Model): 938 """Inner error details. 939 940 :param exception_type: The exception type. 941 :type exception_type: str 942 :param error_detail: The internal error message or exception dump. 943 :type error_detail: str 944 """ 945 946 _attribute_map = { 947 'exception_type': {'key': 'exceptionType', 'type': 'str'}, 948 'error_detail': {'key': 'errorDetail', 'type': 'str'}, 949 } 950 951 def __init__(self, *, exception_type: str=None, error_detail: str=None, **kwargs) -> None: 952 super(InnerError, self).__init__(**kwargs) 953 self.exception_type = exception_type 954 self.error_detail = error_detail 955 956 957class Operation(Model): 958 """A REST API operation. 959 960 :param name: The operation name. This is of the format 961 {provider}/{resource}/{operation} 962 :type name: str 963 :param display: The object that describes the operation. 964 :type display: ~azure.mgmt.imagebuilder.models.OperationDisplay 965 :param origin: The intended executor of the operation. 966 :type origin: str 967 :param properties: Properties of the operation. 968 :type properties: object 969 :param is_data_action: The flag that indicates whether the operation 970 applies to data plane. 971 :type is_data_action: bool 972 """ 973 974 _attribute_map = { 975 'name': {'key': 'name', 'type': 'str'}, 976 'display': {'key': 'display', 'type': 'OperationDisplay'}, 977 'origin': {'key': 'origin', 'type': 'str'}, 978 'properties': {'key': 'properties', 'type': 'object'}, 979 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 980 } 981 982 def __init__(self, *, name: str=None, display=None, origin: str=None, properties=None, is_data_action: bool=None, **kwargs) -> None: 983 super(Operation, self).__init__(**kwargs) 984 self.name = name 985 self.display = display 986 self.origin = origin 987 self.properties = properties 988 self.is_data_action = is_data_action 989 990 991class OperationDisplay(Model): 992 """The object that describes the operation. 993 994 :param provider: Friendly name of the resource provider. 995 :type provider: str 996 :param operation: The operation type. For example: read, write, delete, or 997 listKeys/action 998 :type operation: str 999 :param resource: The resource type on which the operation is performed. 1000 :type resource: str 1001 :param description: The friendly name of the operation. 1002 :type description: str 1003 """ 1004 1005 _attribute_map = { 1006 'provider': {'key': 'provider', 'type': 'str'}, 1007 'operation': {'key': 'operation', 'type': 'str'}, 1008 'resource': {'key': 'resource', 'type': 'str'}, 1009 'description': {'key': 'description', 'type': 'str'}, 1010 } 1011 1012 def __init__(self, *, provider: str=None, operation: str=None, resource: str=None, description: str=None, **kwargs) -> None: 1013 super(OperationDisplay, self).__init__(**kwargs) 1014 self.provider = provider 1015 self.operation = operation 1016 self.resource = resource 1017 self.description = description 1018 1019 1020class PlatformImagePurchasePlan(Model): 1021 """Purchase plan configuration for platform image. 1022 1023 All required parameters must be populated in order to send to Azure. 1024 1025 :param plan_name: Required. Name of the purchase plan. 1026 :type plan_name: str 1027 :param plan_product: Required. Product of the purchase plan. 1028 :type plan_product: str 1029 :param plan_publisher: Required. Publisher of the purchase plan. 1030 :type plan_publisher: str 1031 """ 1032 1033 _validation = { 1034 'plan_name': {'required': True}, 1035 'plan_product': {'required': True}, 1036 'plan_publisher': {'required': True}, 1037 } 1038 1039 _attribute_map = { 1040 'plan_name': {'key': 'planName', 'type': 'str'}, 1041 'plan_product': {'key': 'planProduct', 'type': 'str'}, 1042 'plan_publisher': {'key': 'planPublisher', 'type': 'str'}, 1043 } 1044 1045 def __init__(self, *, plan_name: str, plan_product: str, plan_publisher: str, **kwargs) -> None: 1046 super(PlatformImagePurchasePlan, self).__init__(**kwargs) 1047 self.plan_name = plan_name 1048 self.plan_product = plan_product 1049 self.plan_publisher = plan_publisher 1050 1051 1052class ProvisioningError(Model): 1053 """Describes the error happened when create or update an image template. 1054 1055 :param provisioning_error_code: Error code of the provisioning failure. 1056 Possible values include: 'BadSourceType', 'BadPIRSource', 1057 'BadManagedImageSource', 'BadSharedImageVersionSource', 1058 'BadCustomizerType', 'UnsupportedCustomizerType', 'NoCustomizerScript', 1059 'BadDistributeType', 'BadSharedImageDistribute', 'ServerError', 'Other' 1060 :type provisioning_error_code: str or 1061 ~azure.mgmt.imagebuilder.models.ProvisioningErrorCode 1062 :param message: Verbose error message about the provisioning failure 1063 :type message: str 1064 """ 1065 1066 _attribute_map = { 1067 'provisioning_error_code': {'key': 'provisioningErrorCode', 'type': 'str'}, 1068 'message': {'key': 'message', 'type': 'str'}, 1069 } 1070 1071 def __init__(self, *, provisioning_error_code=None, message: str=None, **kwargs) -> None: 1072 super(ProvisioningError, self).__init__(**kwargs) 1073 self.provisioning_error_code = provisioning_error_code 1074 self.message = message 1075 1076 1077class SubResource(Model): 1078 """The Sub Resource model definition. 1079 1080 Variables are only populated by the server, and will be ignored when 1081 sending a request. 1082 1083 All required parameters must be populated in order to send to Azure. 1084 1085 :ivar id: Resource Id 1086 :vartype id: str 1087 :param name: Required. Resource name 1088 :type name: str 1089 :ivar type: Resource type 1090 :vartype type: str 1091 """ 1092 1093 _validation = { 1094 'id': {'readonly': True}, 1095 'name': {'required': True}, 1096 'type': {'readonly': True}, 1097 } 1098 1099 _attribute_map = { 1100 'id': {'key': 'id', 'type': 'str'}, 1101 'name': {'key': 'name', 'type': 'str'}, 1102 'type': {'key': 'type', 'type': 'str'}, 1103 } 1104 1105 def __init__(self, *, name: str, **kwargs) -> None: 1106 super(SubResource, self).__init__(**kwargs) 1107 self.id = None 1108 self.name = name 1109 self.type = None 1110 1111 1112class RunOutput(SubResource): 1113 """Represents an output that was created by running an image template. 1114 1115 Variables are only populated by the server, and will be ignored when 1116 sending a request. 1117 1118 All required parameters must be populated in order to send to Azure. 1119 1120 :ivar id: Resource Id 1121 :vartype id: str 1122 :param name: Required. Resource name 1123 :type name: str 1124 :ivar type: Resource type 1125 :vartype type: str 1126 :param artifact_id: The resource id of the artifact. 1127 :type artifact_id: str 1128 :param artifact_uri: The location URI of the artifact. 1129 :type artifact_uri: str 1130 :ivar provisioning_state: Provisioning state of the resource. Possible 1131 values include: 'Creating', 'Updating', 'Succeeded', 'Failed', 'Deleting' 1132 :vartype provisioning_state: str or 1133 ~azure.mgmt.imagebuilder.models.ProvisioningState 1134 """ 1135 1136 _validation = { 1137 'id': {'readonly': True}, 1138 'name': {'required': True}, 1139 'type': {'readonly': True}, 1140 'provisioning_state': {'readonly': True}, 1141 } 1142 1143 _attribute_map = { 1144 'id': {'key': 'id', 'type': 'str'}, 1145 'name': {'key': 'name', 'type': 'str'}, 1146 'type': {'key': 'type', 'type': 'str'}, 1147 'artifact_id': {'key': 'properties.artifactId', 'type': 'str'}, 1148 'artifact_uri': {'key': 'properties.artifactUri', 'type': 'str'}, 1149 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'}, 1150 } 1151 1152 def __init__(self, *, name: str, artifact_id: str=None, artifact_uri: str=None, **kwargs) -> None: 1153 super(RunOutput, self).__init__(name=name, **kwargs) 1154 self.artifact_id = artifact_id 1155 self.artifact_uri = artifact_uri 1156 self.provisioning_state = None 1157 1158 1159class VirtualNetworkConfig(Model): 1160 """Virtual Network configuration. 1161 1162 :param subnet_id: Resource id of a pre-existing subnet. 1163 :type subnet_id: str 1164 """ 1165 1166 _attribute_map = { 1167 'subnet_id': {'key': 'subnetId', 'type': 'str'}, 1168 } 1169 1170 def __init__(self, *, subnet_id: str=None, **kwargs) -> None: 1171 super(VirtualNetworkConfig, self).__init__(**kwargs) 1172 self.subnet_id = subnet_id 1173