# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from msrest.serialization import Model
from msrest.exceptions import HttpOperationError
[docs]class ApiError(Model):
"""Api error.
:param details: The Api error details
:type details: list[~azure.mgmt.imagebuilder.models.ApiErrorBase]
:param inner_error: The Api inner error
:type inner_error: ~azure.mgmt.imagebuilder.models.InnerError
:param code: The error code.
:type code: str
:param target: The target of the particular error.
:type target: str
:param message: The error message.
:type message: str
"""
_attribute_map = {
'details': {'key': 'details', 'type': '[ApiErrorBase]'},
'inner_error': {'key': 'innerError', 'type': 'InnerError'},
'code': {'key': 'code', 'type': 'str'},
'target': {'key': 'target', 'type': 'str'},
'message': {'key': 'message', 'type': 'str'},
}
def __init__(self, *, details=None, inner_error=None, code: str=None, target: str=None, message: str=None, **kwargs) -> None:
super(ApiError, self).__init__(**kwargs)
self.details = details
self.inner_error = inner_error
self.code = code
self.target = target
self.message = message
[docs]class ApiErrorException(HttpOperationError):
"""Server responsed with exception of type: 'ApiError'.
:param deserialize: A deserializer
:param response: Server response to be deserialized.
"""
def __init__(self, deserialize, response, *args):
super(ApiErrorException, self).__init__(deserialize, response, 'ApiError', *args)
[docs]class ApiErrorBase(Model):
"""Api error base.
:param code: The error code.
:type code: str
:param target: The target of the particular error.
:type target: str
:param message: The error message.
:type message: str
"""
_attribute_map = {
'code': {'key': 'code', 'type': 'str'},
'target': {'key': 'target', 'type': 'str'},
'message': {'key': 'message', 'type': 'str'},
}
def __init__(self, *, code: str=None, target: str=None, message: str=None, **kwargs) -> None:
super(ApiErrorBase, self).__init__(**kwargs)
self.code = code
self.target = target
self.message = message
class CloudError(Model):
"""CloudError.
"""
_attribute_map = {
}
[docs]class Resource(Model):
"""The Resource model definition.
Variables are only populated by the server, and will be ignored when
sending a request.
All required parameters must be populated in order to send to Azure.
:ivar id: Resource Id
:vartype id: str
:ivar name: Resource name
:vartype name: str
:ivar type: Resource type
:vartype type: str
:param location: Required. Resource location
:type location: str
:param tags: Resource tags
:type tags: dict[str, str]
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'location': {'required': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'location': {'key': 'location', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
}
def __init__(self, *, location: str, tags=None, **kwargs) -> None:
super(Resource, self).__init__(**kwargs)
self.id = None
self.name = None
self.type = None
self.location = location
self.tags = tags
[docs]class ImageTemplate(Resource):
"""Image template is an ARM resource managed by Microsoft.VirtualMachineImages
provider.
Variables are only populated by the server, and will be ignored when
sending a request.
All required parameters must be populated in order to send to Azure.
:ivar id: Resource Id
:vartype id: str
:ivar name: Resource name
:vartype name: str
:ivar type: Resource type
:vartype type: str
:param location: Required. Resource location
:type location: str
:param tags: Resource tags
:type tags: dict[str, str]
:param source: Required. Specifies the properties used to describe the
source image.
:type source: ~azure.mgmt.imagebuilder.models.ImageTemplateSource
:param customize: Specifies the properties used to describe the
customization steps of the image, like Image source etc
:type customize:
list[~azure.mgmt.imagebuilder.models.ImageTemplateCustomizer]
:param distribute: Required. The distribution targets where the image
output needs to go to.
:type distribute:
list[~azure.mgmt.imagebuilder.models.ImageTemplateDistributor]
:ivar provisioning_state: Provisioning state of the resource. Possible
values include: 'Creating', 'Updating', 'Succeeded', 'Failed', 'Deleting'
:vartype provisioning_state: str or
~azure.mgmt.imagebuilder.models.ProvisioningState
:ivar provisioning_error: Provisioning error, if any
:vartype provisioning_error:
~azure.mgmt.imagebuilder.models.ProvisioningError
:ivar last_run_status: State of 'run' that is currently executing or was
last executed.
:vartype last_run_status:
~azure.mgmt.imagebuilder.models.ImageTemplateLastRunStatus
:param build_timeout_in_minutes: Maximum duration to wait while building
the image template. Omit or specify 0 to use the default (4 hours).
:type build_timeout_in_minutes: int
:param vm_profile: Describes how virtual machine is set up to build images
:type vm_profile: ~azure.mgmt.imagebuilder.models.ImageTemplateVmProfile
:param identity: Required. The identity of the image template, if
configured.
:type identity: ~azure.mgmt.imagebuilder.models.ImageTemplateIdentity
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'location': {'required': True},
'source': {'required': True},
'distribute': {'required': True},
'provisioning_state': {'readonly': True},
'provisioning_error': {'readonly': True},
'last_run_status': {'readonly': True},
'build_timeout_in_minutes': {'maximum': 960, 'minimum': 0},
'identity': {'required': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'location': {'key': 'location', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'source': {'key': 'properties.source', 'type': 'ImageTemplateSource'},
'customize': {'key': 'properties.customize', 'type': '[ImageTemplateCustomizer]'},
'distribute': {'key': 'properties.distribute', 'type': '[ImageTemplateDistributor]'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'},
'provisioning_error': {'key': 'properties.provisioningError', 'type': 'ProvisioningError'},
'last_run_status': {'key': 'properties.lastRunStatus', 'type': 'ImageTemplateLastRunStatus'},
'build_timeout_in_minutes': {'key': 'properties.buildTimeoutInMinutes', 'type': 'int'},
'vm_profile': {'key': 'properties.vmProfile', 'type': 'ImageTemplateVmProfile'},
'identity': {'key': 'identity', 'type': 'ImageTemplateIdentity'},
}
def __init__(self, *, location: str, source, distribute, identity, tags=None, customize=None, build_timeout_in_minutes: int=None, vm_profile=None, **kwargs) -> None:
super(ImageTemplate, self).__init__(location=location, tags=tags, **kwargs)
self.source = source
self.customize = customize
self.distribute = distribute
self.provisioning_state = None
self.provisioning_error = None
self.last_run_status = None
self.build_timeout_in_minutes = build_timeout_in_minutes
self.vm_profile = vm_profile
self.identity = identity
[docs]class ImageTemplateCustomizer(Model):
"""Describes a unit of image customization.
You probably want to use the sub-classes and not this class directly. Known
sub-classes are: ImageTemplateShellCustomizer,
ImageTemplateRestartCustomizer, ImageTemplateWindowsUpdateCustomizer,
ImageTemplatePowerShellCustomizer, ImageTemplateFileCustomizer
All required parameters must be populated in order to send to Azure.
:param name: Friendly Name to provide context on what this customization
step does
:type name: str
:param type: Required. Constant filled by server.
:type type: str
"""
_validation = {
'type': {'required': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
}
_subtype_map = {
'type': {'Shell': 'ImageTemplateShellCustomizer', 'WindowsRestart': 'ImageTemplateRestartCustomizer', 'WindowsUpdate': 'ImageTemplateWindowsUpdateCustomizer', 'PowerShell': 'ImageTemplatePowerShellCustomizer', 'File': 'ImageTemplateFileCustomizer'}
}
def __init__(self, *, name: str=None, **kwargs) -> None:
super(ImageTemplateCustomizer, self).__init__(**kwargs)
self.name = name
self.type = None
[docs]class ImageTemplateDistributor(Model):
"""Generic distribution object.
You probably want to use the sub-classes and not this class directly. Known
sub-classes are: ImageTemplateManagedImageDistributor,
ImageTemplateSharedImageDistributor, ImageTemplateVhdDistributor
All required parameters must be populated in order to send to Azure.
:param run_output_name: Required. The name to be used for the associated
RunOutput.
:type run_output_name: str
:param artifact_tags: Tags that will be applied to the artifact once it
has been created/updated by the distributor.
:type artifact_tags: dict[str, str]
:param type: Required. Constant filled by server.
:type type: str
"""
_validation = {
'run_output_name': {'required': True, 'pattern': r'^[A-Za-z0-9-_.]{1,64}$'},
'type': {'required': True},
}
_attribute_map = {
'run_output_name': {'key': 'runOutputName', 'type': 'str'},
'artifact_tags': {'key': 'artifactTags', 'type': '{str}'},
'type': {'key': 'type', 'type': 'str'},
}
_subtype_map = {
'type': {'ManagedImage': 'ImageTemplateManagedImageDistributor', 'SharedImage': 'ImageTemplateSharedImageDistributor', 'VHD': 'ImageTemplateVhdDistributor'}
}
def __init__(self, *, run_output_name: str, artifact_tags=None, **kwargs) -> None:
super(ImageTemplateDistributor, self).__init__(**kwargs)
self.run_output_name = run_output_name
self.artifact_tags = artifact_tags
self.type = None
[docs]class ImageTemplateFileCustomizer(ImageTemplateCustomizer):
"""Uploads files to VMs (Linux, Windows). Corresponds to Packer file
provisioner.
All required parameters must be populated in order to send to Azure.
:param name: Friendly Name to provide context on what this customization
step does
:type name: str
:param type: Required. Constant filled by server.
:type type: str
:param source_uri: The URI of the file to be uploaded for customizing the
VM. It can be a github link, SAS URI for Azure Storage, etc
:type source_uri: str
:param sha256_checksum: SHA256 checksum of the file provided in the
sourceUri field above
:type sha256_checksum: str
:param destination: The absolute path to a file (with nested directory
structures already created) where the file (from sourceUri) will be
uploaded to in the VM
:type destination: str
"""
_validation = {
'type': {'required': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'source_uri': {'key': 'sourceUri', 'type': 'str'},
'sha256_checksum': {'key': 'sha256Checksum', 'type': 'str'},
'destination': {'key': 'destination', 'type': 'str'},
}
def __init__(self, *, name: str=None, source_uri: str=None, sha256_checksum: str=None, destination: str=None, **kwargs) -> None:
super(ImageTemplateFileCustomizer, self).__init__(name=name, **kwargs)
self.source_uri = source_uri
self.sha256_checksum = sha256_checksum
self.destination = destination
self.type = 'File'
[docs]class ImageTemplateIdentity(Model):
"""Identity for the image template.
:param type: The type of identity used for the image template. Possible
values include: 'UserAssigned'
:type type: str or ~azure.mgmt.imagebuilder.models.ResourceIdentityType
:param user_assigned_identities: The list of user identities associated
with the image template. The user identity dictionary key references will
be ARM resource ids in the form:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
:type user_assigned_identities: dict[str,
~azure.mgmt.imagebuilder.models.ImageTemplateIdentityUserAssignedIdentitiesValue]
"""
_attribute_map = {
'type': {'key': 'type', 'type': 'ResourceIdentityType'},
'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ImageTemplateIdentityUserAssignedIdentitiesValue}'},
}
def __init__(self, *, type=None, user_assigned_identities=None, **kwargs) -> None:
super(ImageTemplateIdentity, self).__init__(**kwargs)
self.type = type
self.user_assigned_identities = user_assigned_identities
[docs]class ImageTemplateIdentityUserAssignedIdentitiesValue(Model):
"""ImageTemplateIdentityUserAssignedIdentitiesValue.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar principal_id: The principal id of user assigned identity.
:vartype principal_id: str
:ivar client_id: The client id of user assigned identity.
:vartype client_id: str
"""
_validation = {
'principal_id': {'readonly': True},
'client_id': {'readonly': True},
}
_attribute_map = {
'principal_id': {'key': 'principalId', 'type': 'str'},
'client_id': {'key': 'clientId', 'type': 'str'},
}
def __init__(self, **kwargs) -> None:
super(ImageTemplateIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs)
self.principal_id = None
self.client_id = None
[docs]class ImageTemplateLastRunStatus(Model):
"""Describes the latest status of running an image template.
:param start_time: Start time of the last run (UTC)
:type start_time: datetime
:param end_time: End time of the last run (UTC)
:type end_time: datetime
:param run_state: State of the last run. Possible values include:
'Running', 'Canceling', 'Succeeded', 'PartiallySucceeded', 'Failed',
'Canceled'
:type run_state: str or ~azure.mgmt.imagebuilder.models.RunState
:param run_sub_state: Sub-state of the last run. Possible values include:
'Queued', 'Building', 'Customizing', 'Distributing'
:type run_sub_state: str or ~azure.mgmt.imagebuilder.models.RunSubState
:param message: Verbose information about the last run state
:type message: str
"""
_attribute_map = {
'start_time': {'key': 'startTime', 'type': 'iso-8601'},
'end_time': {'key': 'endTime', 'type': 'iso-8601'},
'run_state': {'key': 'runState', 'type': 'RunState'},
'run_sub_state': {'key': 'runSubState', 'type': 'RunSubState'},
'message': {'key': 'message', 'type': 'str'},
}
def __init__(self, *, start_time=None, end_time=None, run_state=None, run_sub_state=None, message: str=None, **kwargs) -> None:
super(ImageTemplateLastRunStatus, self).__init__(**kwargs)
self.start_time = start_time
self.end_time = end_time
self.run_state = run_state
self.run_sub_state = run_sub_state
self.message = message
[docs]class ImageTemplateManagedImageDistributor(ImageTemplateDistributor):
"""Distribute as a Managed Disk Image.
All required parameters must be populated in order to send to Azure.
:param run_output_name: Required. The name to be used for the associated
RunOutput.
:type run_output_name: str
:param artifact_tags: Tags that will be applied to the artifact once it
has been created/updated by the distributor.
:type artifact_tags: dict[str, str]
:param type: Required. Constant filled by server.
:type type: str
:param image_id: Required. Resource Id of the Managed Disk Image
:type image_id: str
:param location: Required. Azure location for the image, should match if
image already exists
:type location: str
"""
_validation = {
'run_output_name': {'required': True, 'pattern': r'^[A-Za-z0-9-_.]{1,64}$'},
'type': {'required': True},
'image_id': {'required': True},
'location': {'required': True},
}
_attribute_map = {
'run_output_name': {'key': 'runOutputName', 'type': 'str'},
'artifact_tags': {'key': 'artifactTags', 'type': '{str}'},
'type': {'key': 'type', 'type': 'str'},
'image_id': {'key': 'imageId', 'type': 'str'},
'location': {'key': 'location', 'type': 'str'},
}
def __init__(self, *, run_output_name: str, image_id: str, location: str, artifact_tags=None, **kwargs) -> None:
super(ImageTemplateManagedImageDistributor, self).__init__(run_output_name=run_output_name, artifact_tags=artifact_tags, **kwargs)
self.image_id = image_id
self.location = location
self.type = 'ManagedImage'
[docs]class ImageTemplateSource(Model):
"""Describes a virtual machine image source for building, customizing and
distributing.
You probably want to use the sub-classes and not this class directly. Known
sub-classes are: ImageTemplatePlatformImageSource,
ImageTemplateManagedImageSource, ImageTemplateSharedImageVersionSource
All required parameters must be populated in order to send to Azure.
:param type: Required. Constant filled by server.
:type type: str
"""
_validation = {
'type': {'required': True},
}
_attribute_map = {
'type': {'key': 'type', 'type': 'str'},
}
_subtype_map = {
'type': {'PlatformImage': 'ImageTemplatePlatformImageSource', 'ManagedImage': 'ImageTemplateManagedImageSource', 'SharedImageVersion': 'ImageTemplateSharedImageVersionSource'}
}
def __init__(self, **kwargs) -> None:
super(ImageTemplateSource, self).__init__(**kwargs)
self.type = None
[docs]class ImageTemplateManagedImageSource(ImageTemplateSource):
"""Describes an image source that is a managed image in customer subscription.
All required parameters must be populated in order to send to Azure.
:param type: Required. Constant filled by server.
:type type: str
:param image_id: Required. ARM resource id of the managed image in
customer subscription
:type image_id: str
"""
_validation = {
'type': {'required': True},
'image_id': {'required': True},
}
_attribute_map = {
'type': {'key': 'type', 'type': 'str'},
'image_id': {'key': 'imageId', 'type': 'str'},
}
def __init__(self, *, image_id: str, **kwargs) -> None:
super(ImageTemplateManagedImageSource, self).__init__(**kwargs)
self.image_id = image_id
self.type = 'ManagedImage'
[docs]class ImageTemplatePowerShellCustomizer(ImageTemplateCustomizer):
"""Runs the specified PowerShell on the VM (Windows). Corresponds to Packer
powershell provisioner. Exactly one of 'scriptUri' or 'inline' can be
specified.
All required parameters must be populated in order to send to Azure.
:param name: Friendly Name to provide context on what this customization
step does
:type name: str
:param type: Required. Constant filled by server.
:type type: str
:param script_uri: URI of the PowerShell script to be run for customizing.
It can be a github link, SAS URI for Azure Storage, etc
:type script_uri: str
:param sha256_checksum: SHA256 checksum of the power shell script provided
in the scriptUri field above
:type sha256_checksum: str
:param inline: Array of PowerShell commands to execute
:type inline: list[str]
:param run_elevated: If specified, the PowerShell script will be run with
elevated privileges
:type run_elevated: bool
:param valid_exit_codes: Valid exit codes for the PowerShell script.
[Default: 0]
:type valid_exit_codes: list[int]
"""
_validation = {
'type': {'required': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'script_uri': {'key': 'scriptUri', 'type': 'str'},
'sha256_checksum': {'key': 'sha256Checksum', 'type': 'str'},
'inline': {'key': 'inline', 'type': '[str]'},
'run_elevated': {'key': 'runElevated', 'type': 'bool'},
'valid_exit_codes': {'key': 'validExitCodes', 'type': '[int]'},
}
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:
super(ImageTemplatePowerShellCustomizer, self).__init__(name=name, **kwargs)
self.script_uri = script_uri
self.sha256_checksum = sha256_checksum
self.inline = inline
self.run_elevated = run_elevated
self.valid_exit_codes = valid_exit_codes
self.type = 'PowerShell'
[docs]class ImageTemplateRestartCustomizer(ImageTemplateCustomizer):
"""Reboots a VM and waits for it to come back online (Windows). Corresponds to
Packer windows-restart provisioner.
All required parameters must be populated in order to send to Azure.
:param name: Friendly Name to provide context on what this customization
step does
:type name: str
:param type: Required. Constant filled by server.
:type type: str
:param restart_command: Command to execute the restart [Default: 'shutdown
/r /f /t 0 /c "packer restart"']
:type restart_command: str
:param restart_check_command: Command to check if restart succeeded
[Default: '']
:type restart_check_command: str
:param restart_timeout: Restart timeout specified as a string of magnitude
and unit, e.g. '5m' (5 minutes) or '2h' (2 hours) [Default: '5m']
:type restart_timeout: str
"""
_validation = {
'type': {'required': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'restart_command': {'key': 'restartCommand', 'type': 'str'},
'restart_check_command': {'key': 'restartCheckCommand', 'type': 'str'},
'restart_timeout': {'key': 'restartTimeout', 'type': 'str'},
}
def __init__(self, *, name: str=None, restart_command: str=None, restart_check_command: str=None, restart_timeout: str=None, **kwargs) -> None:
super(ImageTemplateRestartCustomizer, self).__init__(name=name, **kwargs)
self.restart_command = restart_command
self.restart_check_command = restart_check_command
self.restart_timeout = restart_timeout
self.type = 'WindowsRestart'
[docs]class ImageTemplateSharedImageDistributor(ImageTemplateDistributor):
"""Distribute via Shared Image Gallery.
All required parameters must be populated in order to send to Azure.
:param run_output_name: Required. The name to be used for the associated
RunOutput.
:type run_output_name: str
:param artifact_tags: Tags that will be applied to the artifact once it
has been created/updated by the distributor.
:type artifact_tags: dict[str, str]
:param type: Required. Constant filled by server.
:type type: str
:param gallery_image_id: Required. Resource Id of the Shared Image Gallery
image
:type gallery_image_id: str
:param replication_regions: Required. A list of regions that the image
will be replicated to
:type replication_regions: list[str]
:param exclude_from_latest: Flag that indicates whether created image
version should be excluded from latest. Omit to use the default (false).
:type exclude_from_latest: bool
:param storage_account_type: Storage account type to be used to store the
shared image. Omit to use the default (Standard_LRS). Possible values
include: 'Standard_LRS', 'Standard_ZRS'
:type storage_account_type: str or
~azure.mgmt.imagebuilder.models.SharedImageStorageAccountType
"""
_validation = {
'run_output_name': {'required': True, 'pattern': r'^[A-Za-z0-9-_.]{1,64}$'},
'type': {'required': True},
'gallery_image_id': {'required': True},
'replication_regions': {'required': True},
}
_attribute_map = {
'run_output_name': {'key': 'runOutputName', 'type': 'str'},
'artifact_tags': {'key': 'artifactTags', 'type': '{str}'},
'type': {'key': 'type', 'type': 'str'},
'gallery_image_id': {'key': 'galleryImageId', 'type': 'str'},
'replication_regions': {'key': 'replicationRegions', 'type': '[str]'},
'exclude_from_latest': {'key': 'excludeFromLatest', 'type': 'bool'},
'storage_account_type': {'key': 'storageAccountType', 'type': 'str'},
}
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:
super(ImageTemplateSharedImageDistributor, self).__init__(run_output_name=run_output_name, artifact_tags=artifact_tags, **kwargs)
self.gallery_image_id = gallery_image_id
self.replication_regions = replication_regions
self.exclude_from_latest = exclude_from_latest
self.storage_account_type = storage_account_type
self.type = 'SharedImage'
[docs]class ImageTemplateSharedImageVersionSource(ImageTemplateSource):
"""Describes an image source that is an image version in a shared image
gallery.
All required parameters must be populated in order to send to Azure.
:param type: Required. Constant filled by server.
:type type: str
:param image_version_id: Required. ARM resource id of the image version in
the shared image gallery
:type image_version_id: str
"""
_validation = {
'type': {'required': True},
'image_version_id': {'required': True},
}
_attribute_map = {
'type': {'key': 'type', 'type': 'str'},
'image_version_id': {'key': 'imageVersionId', 'type': 'str'},
}
def __init__(self, *, image_version_id: str, **kwargs) -> None:
super(ImageTemplateSharedImageVersionSource, self).__init__(**kwargs)
self.image_version_id = image_version_id
self.type = 'SharedImageVersion'
[docs]class ImageTemplateShellCustomizer(ImageTemplateCustomizer):
"""Runs a shell script during the customization phase (Linux). Corresponds to
Packer shell provisioner. Exactly one of 'scriptUri' or 'inline' can be
specified.
All required parameters must be populated in order to send to Azure.
:param name: Friendly Name to provide context on what this customization
step does
:type name: str
:param type: Required. Constant filled by server.
:type type: str
:param script_uri: URI of the shell script to be run for customizing. It
can be a github link, SAS URI for Azure Storage, etc
:type script_uri: str
:param sha256_checksum: SHA256 checksum of the shell script provided in
the scriptUri field
:type sha256_checksum: str
:param inline: Array of shell commands to execute
:type inline: list[str]
"""
_validation = {
'type': {'required': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'script_uri': {'key': 'scriptUri', 'type': 'str'},
'sha256_checksum': {'key': 'sha256Checksum', 'type': 'str'},
'inline': {'key': 'inline', 'type': '[str]'},
}
def __init__(self, *, name: str=None, script_uri: str=None, sha256_checksum: str=None, inline=None, **kwargs) -> None:
super(ImageTemplateShellCustomizer, self).__init__(name=name, **kwargs)
self.script_uri = script_uri
self.sha256_checksum = sha256_checksum
self.inline = inline
self.type = 'Shell'
[docs]class ImageTemplateUpdateParameters(Model):
"""Parameters for updating an image template.
:param identity: The identity of the image template, if configured.
:type identity: ~azure.mgmt.imagebuilder.models.ImageTemplateIdentity
:param tags: The user-specified tags associated with the image template.
:type tags: dict[str, str]
"""
_attribute_map = {
'identity': {'key': 'identity', 'type': 'ImageTemplateIdentity'},
'tags': {'key': 'tags', 'type': '{str}'},
}
def __init__(self, *, identity=None, tags=None, **kwargs) -> None:
super(ImageTemplateUpdateParameters, self).__init__(**kwargs)
self.identity = identity
self.tags = tags
[docs]class ImageTemplateVhdDistributor(ImageTemplateDistributor):
"""Distribute via VHD in a storage account.
All required parameters must be populated in order to send to Azure.
:param run_output_name: Required. The name to be used for the associated
RunOutput.
:type run_output_name: str
:param artifact_tags: Tags that will be applied to the artifact once it
has been created/updated by the distributor.
:type artifact_tags: dict[str, str]
:param type: Required. Constant filled by server.
:type type: str
"""
_validation = {
'run_output_name': {'required': True, 'pattern': r'^[A-Za-z0-9-_.]{1,64}$'},
'type': {'required': True},
}
_attribute_map = {
'run_output_name': {'key': 'runOutputName', 'type': 'str'},
'artifact_tags': {'key': 'artifactTags', 'type': '{str}'},
'type': {'key': 'type', 'type': 'str'},
}
def __init__(self, *, run_output_name: str, artifact_tags=None, **kwargs) -> None:
super(ImageTemplateVhdDistributor, self).__init__(run_output_name=run_output_name, artifact_tags=artifact_tags, **kwargs)
self.type = 'VHD'
[docs]class ImageTemplateVmProfile(Model):
"""Describes the virtual machine used to build, customize and capture images.
:param vm_size: Size of the virtual machine used to build, customize and
capture images. Omit or specify empty string to use the default
(Standard_D1_v2).
:type vm_size: str
:param os_disk_size_gb: Size of the OS disk in GB. Omit or specify 0 to
use Azure's default OS disk size.
:type os_disk_size_gb: int
:param vnet_config: Optional configuration of the virtual network to use
to deploy the build virtual machine in. Omit if no specific virtual
network needs to be used.
:type vnet_config: ~azure.mgmt.imagebuilder.models.VirtualNetworkConfig
"""
_validation = {
'os_disk_size_gb': {'minimum': 0},
}
_attribute_map = {
'vm_size': {'key': 'vmSize', 'type': 'str'},
'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'},
'vnet_config': {'key': 'vnetConfig', 'type': 'VirtualNetworkConfig'},
}
def __init__(self, *, vm_size: str=None, os_disk_size_gb: int=None, vnet_config=None, **kwargs) -> None:
super(ImageTemplateVmProfile, self).__init__(**kwargs)
self.vm_size = vm_size
self.os_disk_size_gb = os_disk_size_gb
self.vnet_config = vnet_config
[docs]class ImageTemplateWindowsUpdateCustomizer(ImageTemplateCustomizer):
"""Installs Windows Updates. Corresponds to Packer Windows Update Provisioner
(https://github.com/rgl/packer-provisioner-windows-update).
All required parameters must be populated in order to send to Azure.
:param name: Friendly Name to provide context on what this customization
step does
:type name: str
:param type: Required. Constant filled by server.
:type type: str
:param search_criteria: Criteria to search updates. Omit or specify empty
string to use the default (search all). Refer to above link for examples
and detailed description of this field.
:type search_criteria: str
:param filters: Array of filters to select updates to apply. Omit or
specify empty array to use the default (no filter). Refer to above link
for examples and detailed description of this field.
:type filters: list[str]
:param update_limit: Maximum number of updates to apply at a time. Omit or
specify 0 to use the default (1000)
:type update_limit: int
"""
_validation = {
'type': {'required': True},
'update_limit': {'minimum': 0},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'search_criteria': {'key': 'searchCriteria', 'type': 'str'},
'filters': {'key': 'filters', 'type': '[str]'},
'update_limit': {'key': 'updateLimit', 'type': 'int'},
}
def __init__(self, *, name: str=None, search_criteria: str=None, filters=None, update_limit: int=None, **kwargs) -> None:
super(ImageTemplateWindowsUpdateCustomizer, self).__init__(name=name, **kwargs)
self.search_criteria = search_criteria
self.filters = filters
self.update_limit = update_limit
self.type = 'WindowsUpdate'
[docs]class InnerError(Model):
"""Inner error details.
:param exception_type: The exception type.
:type exception_type: str
:param error_detail: The internal error message or exception dump.
:type error_detail: str
"""
_attribute_map = {
'exception_type': {'key': 'exceptionType', 'type': 'str'},
'error_detail': {'key': 'errorDetail', 'type': 'str'},
}
def __init__(self, *, exception_type: str=None, error_detail: str=None, **kwargs) -> None:
super(InnerError, self).__init__(**kwargs)
self.exception_type = exception_type
self.error_detail = error_detail
[docs]class Operation(Model):
"""A REST API operation.
:param name: The operation name. This is of the format
{provider}/{resource}/{operation}
:type name: str
:param display: The object that describes the operation.
:type display: ~azure.mgmt.imagebuilder.models.OperationDisplay
:param origin: The intended executor of the operation.
:type origin: str
:param properties: Properties of the operation.
:type properties: object
:param is_data_action: The flag that indicates whether the operation
applies to data plane.
:type is_data_action: bool
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'display': {'key': 'display', 'type': 'OperationDisplay'},
'origin': {'key': 'origin', 'type': 'str'},
'properties': {'key': 'properties', 'type': 'object'},
'is_data_action': {'key': 'isDataAction', 'type': 'bool'},
}
def __init__(self, *, name: str=None, display=None, origin: str=None, properties=None, is_data_action: bool=None, **kwargs) -> None:
super(Operation, self).__init__(**kwargs)
self.name = name
self.display = display
self.origin = origin
self.properties = properties
self.is_data_action = is_data_action
[docs]class OperationDisplay(Model):
"""The object that describes the operation.
:param provider: Friendly name of the resource provider.
:type provider: str
:param operation: The operation type. For example: read, write, delete, or
listKeys/action
:type operation: str
:param resource: The resource type on which the operation is performed.
:type resource: str
:param description: The friendly name of the operation.
:type description: str
"""
_attribute_map = {
'provider': {'key': 'provider', 'type': 'str'},
'operation': {'key': 'operation', 'type': 'str'},
'resource': {'key': 'resource', 'type': 'str'},
'description': {'key': 'description', 'type': 'str'},
}
def __init__(self, *, provider: str=None, operation: str=None, resource: str=None, description: str=None, **kwargs) -> None:
super(OperationDisplay, self).__init__(**kwargs)
self.provider = provider
self.operation = operation
self.resource = resource
self.description = description
[docs]class ProvisioningError(Model):
"""Describes the error happened when create or update an image template.
:param provisioning_error_code: Error code of the provisioning failure.
Possible values include: 'BadSourceType', 'BadPIRSource',
'BadManagedImageSource', 'BadSharedImageVersionSource',
'BadCustomizerType', 'UnsupportedCustomizerType', 'NoCustomizerScript',
'BadDistributeType', 'BadSharedImageDistribute', 'ServerError', 'Other'
:type provisioning_error_code: str or
~azure.mgmt.imagebuilder.models.ProvisioningErrorCode
:param message: Verbose error message about the provisioning failure
:type message: str
"""
_attribute_map = {
'provisioning_error_code': {'key': 'provisioningErrorCode', 'type': 'str'},
'message': {'key': 'message', 'type': 'str'},
}
def __init__(self, *, provisioning_error_code=None, message: str=None, **kwargs) -> None:
super(ProvisioningError, self).__init__(**kwargs)
self.provisioning_error_code = provisioning_error_code
self.message = message
[docs]class SubResource(Model):
"""The Sub Resource model definition.
Variables are only populated by the server, and will be ignored when
sending a request.
All required parameters must be populated in order to send to Azure.
:ivar id: Resource Id
:vartype id: str
:param name: Required. Resource name
:type name: str
:ivar type: Resource type
:vartype type: str
"""
_validation = {
'id': {'readonly': True},
'name': {'required': True},
'type': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
}
def __init__(self, *, name: str, **kwargs) -> None:
super(SubResource, self).__init__(**kwargs)
self.id = None
self.name = name
self.type = None
[docs]class RunOutput(SubResource):
"""Represents an output that was created by running an image template.
Variables are only populated by the server, and will be ignored when
sending a request.
All required parameters must be populated in order to send to Azure.
:ivar id: Resource Id
:vartype id: str
:param name: Required. Resource name
:type name: str
:ivar type: Resource type
:vartype type: str
:param artifact_id: The resource id of the artifact.
:type artifact_id: str
:param artifact_uri: The location URI of the artifact.
:type artifact_uri: str
:ivar provisioning_state: Provisioning state of the resource. Possible
values include: 'Creating', 'Updating', 'Succeeded', 'Failed', 'Deleting'
:vartype provisioning_state: str or
~azure.mgmt.imagebuilder.models.ProvisioningState
"""
_validation = {
'id': {'readonly': True},
'name': {'required': True},
'type': {'readonly': True},
'provisioning_state': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'artifact_id': {'key': 'properties.artifactId', 'type': 'str'},
'artifact_uri': {'key': 'properties.artifactUri', 'type': 'str'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'ProvisioningState'},
}
def __init__(self, *, name: str, artifact_id: str=None, artifact_uri: str=None, **kwargs) -> None:
super(RunOutput, self).__init__(name=name, **kwargs)
self.artifact_id = artifact_id
self.artifact_uri = artifact_uri
self.provisioning_state = None
[docs]class VirtualNetworkConfig(Model):
"""Virtual Network configuration.
:param subnet_id: Resource id of a pre-existing subnet.
:type subnet_id: str
"""
_attribute_map = {
'subnet_id': {'key': 'subnetId', 'type': 'str'},
}
def __init__(self, *, subnet_id: str=None, **kwargs) -> None:
super(VirtualNetworkConfig, self).__init__(**kwargs)
self.subnet_id = subnet_id