# pylint: disable=line-too-long,useless-suppression,too-many-lines
# 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) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
# pylint: disable=useless-super-delegation

import datetime
from typing import Any, Literal, Mapping, Optional, TYPE_CHECKING, Union, overload

from .._utils.model_base import Model as _Model, rest_discriminator, rest_field

if TYPE_CHECKING:
    from .. import models as _models


class DataDisk(_Model):
    """Data disk properties.

    :ivar size_gb: Size of the data disk in GB.
    :vartype size_gb: int
    """

    size_gb: Optional[int] = rest_field(name="sizeGB", visibility=["read", "create", "update", "delete", "query"])
    """Size of the data disk in GB."""

    @overload
    def __init__(
        self,
        *,
        size_gb: Optional[int] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class DistributeVersioner(_Model):
    """Describes how to generate new x.y.z version number for distribution.

    You probably want to use the sub-classes and not this class directly. Known sub-classes are:
    DistributeVersionerLatest, DistributeVersionerSource

    :ivar scheme: Version numbering scheme to be used. Required. Default value is None.
    :vartype scheme: str
    """

    __mapping__: dict[str, _Model] = {}
    scheme: str = rest_discriminator(name="scheme", visibility=["read", "create", "update", "delete", "query"])
    """Version numbering scheme to be used. Required. Default value is None."""

    @overload
    def __init__(
        self,
        *,
        scheme: str,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class DistributeVersionerLatest(DistributeVersioner, discriminator="Latest"):
    """Generates version number that will be latest based on existing version numbers.

    :ivar major: Major version for the generated version number. Determine what is "latest" based
     on versions with this value as the major version. -1 is equivalent to leaving it unset.
    :vartype major: int
    :ivar scheme: Version numbering scheme to be used. Required. Default value is "Latest".
    :vartype scheme: str
    """

    major: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Major version for the generated version number. Determine what is \"latest\" based on versions
     with this value as the major version. -1 is equivalent to leaving it unset."""
    scheme: Literal["Latest"] = rest_discriminator(name="scheme", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """Version numbering scheme to be used. Required. Default value is \"Latest\"."""

    @overload
    def __init__(
        self,
        *,
        major: Optional[int] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
        self.scheme = "Latest"  # type: ignore


class DistributeVersionerSource(DistributeVersioner, discriminator="Source"):
    """Generates version number based on version number of source image.

    :ivar scheme: Version numbering scheme to be used. Required. Default value is "Source".
    :vartype scheme: str
    """

    scheme: Literal["Source"] = rest_discriminator(name="scheme", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """Version numbering scheme to be used. Required. Default value is \"Source\"."""

    @overload
    def __init__(
        self,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
        self.scheme = "Source"  # type: ignore


class ErrorAdditionalInfo(_Model):
    """The resource management error additional info.

    :ivar type: The additional info type.
    :vartype type: str
    :ivar info: The additional info.
    :vartype info: any
    """

    type: Optional[str] = rest_field(visibility=["read"])
    """The additional info type."""
    info: Optional[Any] = rest_field(visibility=["read"])
    """The additional info."""


class ErrorDetail(_Model):
    """The error detail.

    :ivar code: The error code.
    :vartype code: str
    :ivar message: The error message.
    :vartype message: str
    :ivar target: The error target.
    :vartype target: str
    :ivar details: The error details.
    :vartype details: list[~azure.mgmt.imagebuilder.models.ErrorDetail]
    :ivar additional_info: The error additional info.
    :vartype additional_info: list[~azure.mgmt.imagebuilder.models.ErrorAdditionalInfo]
    """

    code: Optional[str] = rest_field(visibility=["read"])
    """The error code."""
    message: Optional[str] = rest_field(visibility=["read"])
    """The error message."""
    target: Optional[str] = rest_field(visibility=["read"])
    """The error target."""
    details: Optional[list["_models.ErrorDetail"]] = rest_field(visibility=["read"])
    """The error details."""
    additional_info: Optional[list["_models.ErrorAdditionalInfo"]] = rest_field(
        name="additionalInfo", visibility=["read"]
    )
    """The error additional info."""


class ErrorResponse(_Model):
    """Error response.

    :ivar error: The error object.
    :vartype error: ~azure.mgmt.imagebuilder.models.ErrorDetail
    """

    error: Optional["_models.ErrorDetail"] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The error object."""

    @overload
    def __init__(
        self,
        *,
        error: Optional["_models.ErrorDetail"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class Resource(_Model):
    """Resource.

    :ivar id: Fully qualified resource ID for the resource. Ex -
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
    :vartype id: str
    :ivar name: The name of the resource.
    :vartype name: str
    :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
     "Microsoft.Storage/storageAccounts".
    :vartype type: str
    :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
     information.
    :vartype system_data: ~azure.mgmt.imagebuilder.models.SystemData
    """

    id: Optional[str] = rest_field(visibility=["read"])
    """Fully qualified resource ID for the resource. Ex -
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}."""
    name: Optional[str] = rest_field(visibility=["read"])
    """The name of the resource."""
    type: Optional[str] = rest_field(visibility=["read"])
    """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or
     \"Microsoft.Storage/storageAccounts\"."""
    system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"])
    """Azure Resource Manager metadata containing createdBy and modifiedBy information."""


class TrackedResource(Resource):
    """Tracked Resource.

    :ivar id: Fully qualified resource ID for the resource. Ex -
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
    :vartype id: str
    :ivar name: The name of the resource.
    :vartype name: str
    :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
     "Microsoft.Storage/storageAccounts".
    :vartype type: str
    :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
     information.
    :vartype system_data: ~azure.mgmt.imagebuilder.models.SystemData
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar location: The geo-location where the resource lives. Required.
    :vartype location: str
    """

    tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Resource tags."""
    location: str = rest_field(visibility=["read", "create"])
    """The geo-location where the resource lives. Required."""

    @overload
    def __init__(
        self,
        *,
        location: str,
        tags: Optional[dict[str, str]] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class ImageTemplate(TrackedResource):
    """Image template is an ARM resource managed by Microsoft.VirtualMachineImages provider.

    :ivar id: Fully qualified resource ID for the resource. Ex -
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
    :vartype id: str
    :ivar name: The name of the resource.
    :vartype name: str
    :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
     "Microsoft.Storage/storageAccounts".
    :vartype type: str
    :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
     information.
    :vartype system_data: ~azure.mgmt.imagebuilder.models.SystemData
    :ivar tags: Resource tags.
    :vartype tags: dict[str, str]
    :ivar location: The geo-location where the resource lives. Required.
    :vartype location: str
    :ivar properties: The properties of the image template.
    :vartype properties: ~azure.mgmt.imagebuilder.models.ImageTemplateProperties
    :ivar identity: The identity of the image template, if configured. Required.
    :vartype identity: ~azure.mgmt.imagebuilder.models.ImageTemplateIdentity
    """

    properties: Optional["_models.ImageTemplateProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The properties of the image template."""
    identity: "_models.ImageTemplateIdentity" = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The identity of the image template, if configured. Required."""

    __flattened_items = [
        "source",
        "customize",
        "optimize",
        "validate",
        "distribute",
        "error_handling",
        "provisioning_state",
        "provisioning_error",
        "last_run_status",
        "build_timeout_in_minutes",
        "vm_profile",
        "additional_data_disks",
        "staging_resource_group",
        "exact_staging_resource_group",
        "auto_run",
        "managed_resource_tags",
    ]

    @overload
    def __init__(
        self,
        *,
        location: str,
        identity: "_models.ImageTemplateIdentity",
        tags: Optional[dict[str, str]] = None,
        properties: Optional["_models.ImageTemplateProperties"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items}
        super().__init__(*args, **kwargs)
        for k, v in _flattened_input.items():
            setattr(self, k, v)

    def __getattr__(self, name: str) -> Any:
        if name in self.__flattened_items:
            if self.properties is None:
                return None
            return getattr(self.properties, name)
        raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'")

    def __setattr__(self, key: str, value: Any) -> None:
        if key in self.__flattened_items:
            if self.properties is None:
                self.properties = self._attr_to_rest_field["properties"]._class_type()
            setattr(self.properties, key, value)
        else:
            super().__setattr__(key, value)


class ImageTemplateAutoRun(_Model):
    """Indicates if the image template needs to be built on create/update.

    :ivar state: Enabling this field will trigger an automatic build on image template creation or
     update. Known values are: "Enabled" and "Disabled".
    :vartype state: str or ~azure.mgmt.imagebuilder.models.AutoRunState
    """

    state: Optional[Union[str, "_models.AutoRunState"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Enabling this field will trigger an automatic build on image template creation or update. Known
     values are: \"Enabled\" and \"Disabled\"."""

    @overload
    def __init__(
        self,
        *,
        state: Optional[Union[str, "_models.AutoRunState"]] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


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:
    ImageTemplateFileCustomizer, ImageTemplatePowerShellCustomizer, ImageTemplateShellCustomizer,
    ImageTemplateRestartCustomizer, ImageTemplateWindowsUpdateCustomizer

    :ivar type: The type of customization tool you want to use on the Image. For example, "Shell"
     can be shell customizer. Required. Default value is None.
    :vartype type: str
    :ivar name: Friendly Name to provide context on what this customization step does.
    :vartype name: str
    """

    __mapping__: dict[str, _Model] = {}
    type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"])
    """The type of customization tool you want to use on the Image. For example, \"Shell\" can be
     shell customizer. Required. Default value is None."""
    name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Friendly Name to provide context on what this customization step does."""

    @overload
    def __init__(
        self,
        *,
        type: str,
        name: Optional[str] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


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

    :ivar type: Type of distribution. Required. Default value is None.
    :vartype type: str
    :ivar run_output_name: The name to be used for the associated RunOutput. Required.
    :vartype run_output_name: str
    :ivar artifact_tags: Tags that will be applied to the artifact once it has been created/updated
     by the distributor.
    :vartype artifact_tags: dict[str, str]
    """

    __mapping__: dict[str, _Model] = {}
    type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"])
    """Type of distribution. Required. Default value is None."""
    run_output_name: str = rest_field(name="runOutputName", visibility=["read", "create", "update", "delete", "query"])
    """The name to be used for the associated RunOutput. Required."""
    artifact_tags: Optional[dict[str, str]] = rest_field(
        name="artifactTags", visibility=["read", "create", "update", "delete", "query"]
    )
    """Tags that will be applied to the artifact once it has been created/updated by the distributor."""

    @overload
    def __init__(
        self,
        *,
        type: str,
        run_output_name: str,
        artifact_tags: Optional[dict[str, str]] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class ImageTemplateFileCustomizer(ImageTemplateCustomizer, discriminator="File"):
    """Uploads files to VMs (Linux, Windows). Corresponds to Packer file provisioner.

    :ivar name: Friendly Name to provide context on what this customization step does.
    :vartype name: str
    :ivar 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.
    :vartype source_uri: str
    :ivar sha256_checksum: SHA256 checksum of the file provided in the sourceUri field above.
    :vartype sha256_checksum: str
    :ivar 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.
    :vartype destination: str
    :ivar type: The type of customization tool you want to use on the Image. For example, "Shell"
     can be shell customizer. Required. Default value is "File".
    :vartype type: str
    """

    source_uri: Optional[str] = rest_field(name="sourceUri", visibility=["read", "create", "update", "delete", "query"])
    """The URI of the file to be uploaded for customizing the VM. It can be a github link, SAS URI for
     Azure Storage, etc."""
    sha256_checksum: Optional[str] = rest_field(
        name="sha256Checksum", visibility=["read", "create", "update", "delete", "query"]
    )
    """SHA256 checksum of the file provided in the sourceUri field above."""
    destination: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """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: Literal["File"] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """The type of customization tool you want to use on the Image. For example, \"Shell\" can be
     shell customizer. Required. Default value is \"File\"."""

    @overload
    def __init__(
        self,
        *,
        name: Optional[str] = None,
        source_uri: Optional[str] = None,
        sha256_checksum: Optional[str] = None,
        destination: Optional[str] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
        self.type = "File"  # type: ignore


class ImageTemplateInVMValidator(_Model):
    """Describes a unit of in-VM validation of image.

    You probably want to use the sub-classes and not this class directly. Known sub-classes are:
    ImageTemplateFileValidator, ImageTemplatePowerShellValidator, ImageTemplateShellValidator

    :ivar type: The type of validation you want to use on the Image. For example, "Shell" can be
     shell validation. Required. Default value is None.
    :vartype type: str
    :ivar name: Friendly Name to provide context on what this validation step does.
    :vartype name: str
    """

    __mapping__: dict[str, _Model] = {}
    type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"])
    """The type of validation you want to use on the Image. For example, \"Shell\" can be shell
     validation. Required. Default value is None."""
    name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Friendly Name to provide context on what this validation step does."""

    @overload
    def __init__(
        self,
        *,
        type: str,
        name: Optional[str] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class ImageTemplateFileValidator(ImageTemplateInVMValidator, discriminator="File"):
    """Uploads files required for validation to VMs (Linux, Windows). Corresponds to Packer file
    provisioner.

    :ivar name: Friendly Name to provide context on what this validation step does.
    :vartype name: str
    :ivar source_uri: The URI of the file to be uploaded to the VM for validation. It can be a
     github link, Azure Storage URI (authorized or SAS), etc.
    :vartype source_uri: str
    :ivar sha256_checksum: SHA256 checksum of the file provided in the sourceUri field above.
    :vartype sha256_checksum: str
    :ivar 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.
    :vartype destination: str
    :ivar type: The type of validation you want to use on the Image. For example, "Shell" can be
     shell validation. Required. Default value is "File".
    :vartype type: str
    """

    source_uri: Optional[str] = rest_field(name="sourceUri", visibility=["read", "create", "update", "delete", "query"])
    """The URI of the file to be uploaded to the VM for validation. It can be a github link, Azure
     Storage URI (authorized or SAS), etc."""
    sha256_checksum: Optional[str] = rest_field(
        name="sha256Checksum", visibility=["read", "create", "update", "delete", "query"]
    )
    """SHA256 checksum of the file provided in the sourceUri field above."""
    destination: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """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: Literal["File"] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """The type of validation you want to use on the Image. For example, \"Shell\" can be shell
     validation. Required. Default value is \"File\"."""

    @overload
    def __init__(
        self,
        *,
        name: Optional[str] = None,
        source_uri: Optional[str] = None,
        sha256_checksum: Optional[str] = None,
        destination: Optional[str] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
        self.type = "File"  # type: ignore


class ImageTemplateIdentity(_Model):
    """Identity for the image template.

    :ivar type: The type of identity used for the image template. The type 'None' will remove any
     identities from the image template. Known values are: "UserAssigned" and "None".
    :vartype type: str or ~azure.mgmt.imagebuilder.models.ResourceIdentityType
    :ivar user_assigned_identities: The set of user assigned identities associated with the
     resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form:
     '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}.
     The dictionary values can be empty objects ({}) in requests.
    :vartype user_assigned_identities: dict[str,
     ~azure.mgmt.imagebuilder.models.UserAssignedIdentity]
    """

    type: Optional[Union[str, "_models.ResourceIdentityType"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The type of identity used for the image template. The type 'None' will remove any identities
     from the image template. Known values are: \"UserAssigned\" and \"None\"."""
    user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentity"]] = rest_field(
        name="userAssignedIdentities", visibility=["read", "create", "update", "delete", "query"]
    )
    """The set of user assigned identities associated with the resource. The userAssignedIdentities
     dictionary keys will be ARM resource ids in the form:
     '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}.
     The dictionary values can be empty objects ({}) in requests."""

    @overload
    def __init__(
        self,
        *,
        type: Optional[Union[str, "_models.ResourceIdentityType"]] = None,
        user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentity"]] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class ImageTemplateLastRunStatus(_Model):
    """Describes the latest status of running an image template.

    :ivar start_time: Start time of the last run (UTC).
    :vartype start_time: ~datetime.datetime
    :ivar end_time: End time of the last run (UTC).
    :vartype end_time: ~datetime.datetime
    :ivar run_state: State of the last run. Known values are: "Running", "Canceling", "Succeeded",
     "PartiallySucceeded", "Failed", and "Canceled".
    :vartype run_state: str or ~azure.mgmt.imagebuilder.models.RunState
    :ivar run_sub_state: Sub-state of the last run. Known values are: "Queued", "Building",
     "Customizing", "Optimizing", "Validating", and "Distributing".
    :vartype run_sub_state: str or ~azure.mgmt.imagebuilder.models.RunSubState
    :ivar message: Verbose information about the last run state.
    :vartype message: str
    """

    start_time: Optional[datetime.datetime] = rest_field(
        name="startTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """Start time of the last run (UTC)."""
    end_time: Optional[datetime.datetime] = rest_field(
        name="endTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """End time of the last run (UTC)."""
    run_state: Optional[Union[str, "_models.RunState"]] = rest_field(
        name="runState", visibility=["read", "create", "update", "delete", "query"]
    )
    """State of the last run. Known values are: \"Running\", \"Canceling\", \"Succeeded\",
     \"PartiallySucceeded\", \"Failed\", and \"Canceled\"."""
    run_sub_state: Optional[Union[str, "_models.RunSubState"]] = rest_field(
        name="runSubState", visibility=["read", "create", "update", "delete", "query"]
    )
    """Sub-state of the last run. Known values are: \"Queued\", \"Building\", \"Customizing\",
     \"Optimizing\", \"Validating\", and \"Distributing\"."""
    message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Verbose information about the last run state."""

    @overload
    def __init__(
        self,
        *,
        start_time: Optional[datetime.datetime] = None,
        end_time: Optional[datetime.datetime] = None,
        run_state: Optional[Union[str, "_models.RunState"]] = None,
        run_sub_state: Optional[Union[str, "_models.RunSubState"]] = None,
        message: Optional[str] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class ImageTemplateManagedImageDistributor(ImageTemplateDistributor, discriminator="ManagedImage"):
    """Distribute as a Managed Disk Image.

    :ivar run_output_name: The name to be used for the associated RunOutput. Required.
    :vartype run_output_name: str
    :ivar artifact_tags: Tags that will be applied to the artifact once it has been created/updated
     by the distributor.
    :vartype artifact_tags: dict[str, str]
    :ivar image_id: Resource Id of the Managed Disk Image. Required.
    :vartype image_id: str
    :ivar location: Azure location for the image, should match if image already exists. Required.
    :vartype location: str
    :ivar type: Type of distribution. Required. Default value is "ManagedImage".
    :vartype type: str
    """

    image_id: str = rest_field(name="imageId", visibility=["read", "create", "update", "delete", "query"])
    """Resource Id of the Managed Disk Image. Required."""
    location: str = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Azure location for the image, should match if image already exists. Required."""
    type: Literal["ManagedImage"] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """Type of distribution. Required. Default value is \"ManagedImage\"."""

    @overload
    def __init__(
        self,
        *,
        run_output_name: str,
        image_id: str,
        location: str,
        artifact_tags: Optional[dict[str, str]] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
        self.type = "ManagedImage"  # type: ignore


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:
    ImageTemplateManagedImageSource, ImageTemplatePlatformImageSource,
    ImageTemplateSharedImageVersionSource

    :ivar type: Specifies the type of source image you want to start with. Required. Default value
     is None.
    :vartype type: str
    """

    __mapping__: dict[str, _Model] = {}
    type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"])
    """Specifies the type of source image you want to start with. Required. Default value is None."""

    @overload
    def __init__(
        self,
        *,
        type: str,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class ImageTemplateManagedImageSource(ImageTemplateSource, discriminator="ManagedImage"):
    """Describes an image source that is a managed image in customer subscription. This image must
    reside in the same subscription and region as the Image Builder template.

    :ivar image_id: ARM resource id of the managed image in customer subscription. Required.
    :vartype image_id: str
    :ivar type: Specifies the type of source image you want to start with. Required. Default value
     is "ManagedImage".
    :vartype type: str
    """

    image_id: str = rest_field(name="imageId", visibility=["read", "create", "update", "delete", "query"])
    """ARM resource id of the managed image in customer subscription. Required."""
    type: Literal["ManagedImage"] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """Specifies the type of source image you want to start with. Required. Default value is
     \"ManagedImage\"."""

    @overload
    def __init__(
        self,
        *,
        image_id: str,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
        self.type = "ManagedImage"  # type: ignore


class ImageTemplatePlatformImageSource(ImageTemplateSource, discriminator="PlatformImage"):
    """Describes an image source from `Azure Gallery Images
    <https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages>`_.

    :ivar publisher: Image Publisher in `Azure Gallery Images
     <https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages>`_.
    :vartype publisher: str
    :ivar offer: Image offer from the `Azure Gallery Images
     <https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages>`_.
    :vartype offer: str
    :ivar sku: Image sku from the `Azure Gallery Images
     <https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages>`_.
    :vartype sku: str
    :ivar version: Image version from the `Azure Gallery Images
     <https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages>`_. If 'latest' is
     specified here, the version is evaluated when the image build takes place, not when the
     template is submitted.
    :vartype version: str
    :ivar exact_version: Image version from the `Azure Gallery Images
     <https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages>`_. This readonly field
     differs from 'version', only if the value specified in 'version' field is 'latest'.
    :vartype exact_version: str
    :ivar plan_info: Optional configuration of purchase plan for platform image.
    :vartype plan_info: ~azure.mgmt.imagebuilder.models.PlatformImagePurchasePlan
    :ivar type: Specifies the type of source image you want to start with. Required. Default value
     is "PlatformImage".
    :vartype type: str
    """

    publisher: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Image Publisher in `Azure Gallery Images
     <https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages>`_."""
    offer: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Image offer from the `Azure Gallery Images
     <https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages>`_."""
    sku: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Image sku from the `Azure Gallery Images
     <https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages>`_."""
    version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Image version from the `Azure Gallery Images
     <https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages>`_. If 'latest' is
     specified here, the version is evaluated when the image build takes place, not when the
     template is submitted."""
    exact_version: Optional[str] = rest_field(name="exactVersion", visibility=["read"])
    """Image version from the `Azure Gallery Images
     <https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages>`_. This readonly field
     differs from 'version', only if the value specified in 'version' field is 'latest'."""
    plan_info: Optional["_models.PlatformImagePurchasePlan"] = rest_field(
        name="planInfo", visibility=["read", "create", "update", "delete", "query"]
    )
    """Optional configuration of purchase plan for platform image."""
    type: Literal["PlatformImage"] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """Specifies the type of source image you want to start with. Required. Default value is
     \"PlatformImage\"."""

    @overload
    def __init__(
        self,
        *,
        publisher: Optional[str] = None,
        offer: Optional[str] = None,
        sku: Optional[str] = None,
        version: Optional[str] = None,
        plan_info: Optional["_models.PlatformImagePurchasePlan"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
        self.type = "PlatformImage"  # type: ignore


class ImageTemplatePowerShellCustomizer(ImageTemplateCustomizer, discriminator="PowerShell"):
    """Runs the specified PowerShell on the VM (Windows). Corresponds to Packer powershell
    provisioner. Exactly one of 'scriptUri' or 'inline' can be specified.

    :ivar name: Friendly Name to provide context on what this customization step does.
    :vartype name: str
    :ivar script_uri: URI of the PowerShell script to be run for customizing. It can be a github
     link, SAS URI for Azure Storage, etc.
    :vartype script_uri: str
    :ivar sha256_checksum: SHA256 checksum of the power shell script provided in the scriptUri
     field above.
    :vartype sha256_checksum: str
    :ivar inline: Array of PowerShell commands to execute.
    :vartype inline: list[str]
    :ivar run_elevated: If specified, the PowerShell script will be run with elevated privileges.
    :vartype run_elevated: bool
    :ivar run_as_system: If specified, the PowerShell script will be run with elevated privileges
     using the Local System user. Can only be true when the runElevated field above is set to true.
    :vartype run_as_system: bool
    :ivar valid_exit_codes: Valid exit codes for the PowerShell script. [Default: 0].
    :vartype valid_exit_codes: list[int]
    :ivar type: The type of customization tool you want to use on the Image. For example, "Shell"
     can be shell customizer. Required. Default value is "PowerShell".
    :vartype type: str
    """

    script_uri: Optional[str] = rest_field(name="scriptUri", visibility=["read", "create", "update", "delete", "query"])
    """URI of the PowerShell script to be run for customizing. It can be a github link, SAS URI for
     Azure Storage, etc."""
    sha256_checksum: Optional[str] = rest_field(
        name="sha256Checksum", visibility=["read", "create", "update", "delete", "query"]
    )
    """SHA256 checksum of the power shell script provided in the scriptUri field above."""
    inline: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Array of PowerShell commands to execute."""
    run_elevated: Optional[bool] = rest_field(
        name="runElevated", visibility=["read", "create", "update", "delete", "query"]
    )
    """If specified, the PowerShell script will be run with elevated privileges."""
    run_as_system: Optional[bool] = rest_field(
        name="runAsSystem", visibility=["read", "create", "update", "delete", "query"]
    )
    """If specified, the PowerShell script will be run with elevated privileges using the Local System
     user. Can only be true when the runElevated field above is set to true."""
    valid_exit_codes: Optional[list[int]] = rest_field(
        name="validExitCodes", visibility=["read", "create", "update", "delete", "query"]
    )
    """Valid exit codes for the PowerShell script. [Default: 0]."""
    type: Literal["PowerShell"] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """The type of customization tool you want to use on the Image. For example, \"Shell\" can be
     shell customizer. Required. Default value is \"PowerShell\"."""

    @overload
    def __init__(
        self,
        *,
        name: Optional[str] = None,
        script_uri: Optional[str] = None,
        sha256_checksum: Optional[str] = None,
        inline: Optional[list[str]] = None,
        run_elevated: Optional[bool] = None,
        run_as_system: Optional[bool] = None,
        valid_exit_codes: Optional[list[int]] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
        self.type = "PowerShell"  # type: ignore


class ImageTemplatePowerShellValidator(ImageTemplateInVMValidator, discriminator="PowerShell"):
    """Runs the specified PowerShell script during the validation phase (Windows). Corresponds to
    Packer powershell provisioner. Exactly one of 'scriptUri' or 'inline' can be specified.

    :ivar name: Friendly Name to provide context on what this validation step does.
    :vartype name: str
    :ivar script_uri: URI of the PowerShell script to be run for validation. It can be a github
     link, Azure Storage URI, etc.
    :vartype script_uri: str
    :ivar sha256_checksum: SHA256 checksum of the power shell script provided in the scriptUri
     field above.
    :vartype sha256_checksum: str
    :ivar inline: Array of PowerShell commands to execute.
    :vartype inline: list[str]
    :ivar run_elevated: If specified, the PowerShell script will be run with elevated privileges.
    :vartype run_elevated: bool
    :ivar run_as_system: If specified, the PowerShell script will be run with elevated privileges
     using the Local System user. Can only be true when the runElevated field above is set to true.
    :vartype run_as_system: bool
    :ivar valid_exit_codes: Valid exit codes for the PowerShell script. [Default: 0].
    :vartype valid_exit_codes: list[int]
    :ivar type: The type of validation you want to use on the Image. For example, "Shell" can be
     shell validation. Required. Default value is "PowerShell".
    :vartype type: str
    """

    script_uri: Optional[str] = rest_field(name="scriptUri", visibility=["read", "create", "update", "delete", "query"])
    """URI of the PowerShell script to be run for validation. It can be a github link, Azure Storage
     URI, etc."""
    sha256_checksum: Optional[str] = rest_field(
        name="sha256Checksum", visibility=["read", "create", "update", "delete", "query"]
    )
    """SHA256 checksum of the power shell script provided in the scriptUri field above."""
    inline: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Array of PowerShell commands to execute."""
    run_elevated: Optional[bool] = rest_field(
        name="runElevated", visibility=["read", "create", "update", "delete", "query"]
    )
    """If specified, the PowerShell script will be run with elevated privileges."""
    run_as_system: Optional[bool] = rest_field(
        name="runAsSystem", visibility=["read", "create", "update", "delete", "query"]
    )
    """If specified, the PowerShell script will be run with elevated privileges using the Local System
     user. Can only be true when the runElevated field above is set to true."""
    valid_exit_codes: Optional[list[int]] = rest_field(
        name="validExitCodes", visibility=["read", "create", "update", "delete", "query"]
    )
    """Valid exit codes for the PowerShell script. [Default: 0]."""
    type: Literal["PowerShell"] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """The type of validation you want to use on the Image. For example, \"Shell\" can be shell
     validation. Required. Default value is \"PowerShell\"."""

    @overload
    def __init__(
        self,
        *,
        name: Optional[str] = None,
        script_uri: Optional[str] = None,
        sha256_checksum: Optional[str] = None,
        inline: Optional[list[str]] = None,
        run_elevated: Optional[bool] = None,
        run_as_system: Optional[bool] = None,
        valid_exit_codes: Optional[list[int]] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
        self.type = "PowerShell"  # type: ignore


class ImageTemplateProperties(_Model):
    """Describes the properties of an image template.

    :ivar source: Specifies the properties used to describe the source image. Required.
    :vartype source: ~azure.mgmt.imagebuilder.models.ImageTemplateSource
    :ivar customize: Specifies the properties used to describe the customization steps of the
     image, like Image source etc.
    :vartype customize: list[~azure.mgmt.imagebuilder.models.ImageTemplateCustomizer]
    :ivar optimize: Specifies optimization to be performed on image.
    :vartype optimize: ~azure.mgmt.imagebuilder.models.ImageTemplatePropertiesOptimize
    :ivar validate: Configuration options and list of validations to be performed on the resulting
     image.
    :vartype validate: ~azure.mgmt.imagebuilder.models.ImageTemplatePropertiesValidate
    :ivar distribute: The distribution targets where the image output needs to go to. Required.
    :vartype distribute: list[~azure.mgmt.imagebuilder.models.ImageTemplateDistributor]
    :ivar error_handling: Error handling options upon a build failure.
    :vartype error_handling: ~azure.mgmt.imagebuilder.models.ImageTemplatePropertiesErrorHandling
    :ivar provisioning_state: Provisioning state of the resource. Known values are: "Creating",
     "Updating", "Succeeded", "Failed", "Deleting", and "Canceled".
    :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
    :ivar build_timeout_in_minutes: Maximum duration to wait while building the image template
     (includes all customizations, optimization, validations, and distributions). Omit or specify 0
     to use the default (4 hours).
    :vartype build_timeout_in_minutes: int
    :ivar vm_profile: Describes how virtual machine is set up to build images.
    :vartype vm_profile: ~azure.mgmt.imagebuilder.models.ImageTemplateVmProfile
    :ivar additional_data_disks: Optional array of additional data disks to be added to the image.
    :vartype additional_data_disks: list[~azure.mgmt.imagebuilder.models.DataDisk]
    :ivar staging_resource_group: The staging resource group id in the same subscription as the
     image template that will be used to build the image. If this field is empty, a resource group
     with a random name will be created. If the resource group specified in this field doesn't
     exist, it will be created with the same name. If the resource group specified exists, it must
     be empty and in the same region as the image template. The resource group created will be
     deleted during template deletion if this field is empty or the resource group specified doesn't
     exist, but if the resource group specified exists the resources created in the resource group
     will be deleted during template deletion and the resource group itself will remain.
    :vartype staging_resource_group: str
    :ivar exact_staging_resource_group: The staging resource group id in the same subscription as
     the image template that will be used to build the image. This read-only field differs from
     'stagingResourceGroup' only if the value specified in the 'stagingResourceGroup' field is
     empty.
    :vartype exact_staging_resource_group: str
    :ivar auto_run: Indicates whether or not to automatically run the image template build on
     template creation or update.
    :vartype auto_run: ~azure.mgmt.imagebuilder.models.ImageTemplateAutoRun
    :ivar managed_resource_tags: Tags that will be applied to the resource group and/or resources
     created by the service.
    :vartype managed_resource_tags: dict[str, str]
    """

    source: "_models.ImageTemplateSource" = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Specifies the properties used to describe the source image. Required."""
    customize: Optional[list["_models.ImageTemplateCustomizer"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the properties used to describe the customization steps of the image, like Image
     source etc."""
    optimize: Optional["_models.ImageTemplatePropertiesOptimize"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies optimization to be performed on image."""
    validate: Optional["_models.ImageTemplatePropertiesValidate"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Configuration options and list of validations to be performed on the resulting image."""
    distribute: list["_models.ImageTemplateDistributor"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The distribution targets where the image output needs to go to. Required."""
    error_handling: Optional["_models.ImageTemplatePropertiesErrorHandling"] = rest_field(
        name="errorHandling", visibility=["read", "create", "update", "delete", "query"]
    )
    """Error handling options upon a build failure."""
    provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field(
        name="provisioningState", visibility=["read"]
    )
    """Provisioning state of the resource. Known values are: \"Creating\", \"Updating\",
     \"Succeeded\", \"Failed\", \"Deleting\", and \"Canceled\"."""
    provisioning_error: Optional["_models.ProvisioningError"] = rest_field(
        name="provisioningError", visibility=["read"]
    )
    """Provisioning error, if any."""
    last_run_status: Optional["_models.ImageTemplateLastRunStatus"] = rest_field(
        name="lastRunStatus", visibility=["read"]
    )
    """State of 'run' that is currently executing or was last executed."""
    build_timeout_in_minutes: Optional[int] = rest_field(
        name="buildTimeoutInMinutes", visibility=["read", "create", "update", "delete", "query"]
    )
    """Maximum duration to wait while building the image template (includes all customizations,
     optimization, validations, and distributions). Omit or specify 0 to use the default (4 hours)."""
    vm_profile: Optional["_models.ImageTemplateVmProfile"] = rest_field(
        name="vmProfile", visibility=["read", "create", "update", "delete", "query"]
    )
    """Describes how virtual machine is set up to build images."""
    additional_data_disks: Optional[list["_models.DataDisk"]] = rest_field(
        name="additionalDataDisks", visibility=["read", "create", "update", "delete", "query"]
    )
    """Optional array of additional data disks to be added to the image."""
    staging_resource_group: Optional[str] = rest_field(
        name="stagingResourceGroup", visibility=["read", "create", "update", "delete", "query"]
    )
    """The staging resource group id in the same subscription as the image template that will be used
     to build the image. If this field is empty, a resource group with a random name will be
     created. If the resource group specified in this field doesn't exist, it will be created with
     the same name. If the resource group specified exists, it must be empty and in the same region
     as the image template. The resource group created will be deleted during template deletion if
     this field is empty or the resource group specified doesn't exist, but if the resource group
     specified exists the resources created in the resource group will be deleted during template
     deletion and the resource group itself will remain."""
    exact_staging_resource_group: Optional[str] = rest_field(name="exactStagingResourceGroup", visibility=["read"])
    """The staging resource group id in the same subscription as the image template that will be used
     to build the image. This read-only field differs from 'stagingResourceGroup' only if the value
     specified in the 'stagingResourceGroup' field is empty."""
    auto_run: Optional["_models.ImageTemplateAutoRun"] = rest_field(
        name="autoRun", visibility=["read", "create", "update", "delete", "query"]
    )
    """Indicates whether or not to automatically run the image template build on template creation or
     update."""
    managed_resource_tags: Optional[dict[str, str]] = rest_field(
        name="managedResourceTags", visibility=["read", "create", "update"]
    )
    """Tags that will be applied to the resource group and/or resources created by the service."""

    @overload
    def __init__(
        self,
        *,
        source: "_models.ImageTemplateSource",
        distribute: list["_models.ImageTemplateDistributor"],
        customize: Optional[list["_models.ImageTemplateCustomizer"]] = None,
        optimize: Optional["_models.ImageTemplatePropertiesOptimize"] = None,
        validate: Optional["_models.ImageTemplatePropertiesValidate"] = None,
        error_handling: Optional["_models.ImageTemplatePropertiesErrorHandling"] = None,
        build_timeout_in_minutes: Optional[int] = None,
        vm_profile: Optional["_models.ImageTemplateVmProfile"] = None,
        additional_data_disks: Optional[list["_models.DataDisk"]] = None,
        staging_resource_group: Optional[str] = None,
        auto_run: Optional["_models.ImageTemplateAutoRun"] = None,
        managed_resource_tags: Optional[dict[str, str]] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class ImageTemplatePropertiesErrorHandling(_Model):
    """Error handling options upon a build failure.

    :ivar on_customizer_error: If there is a customizer error and this field is set to 'cleanup',
     the build VM and associated network resources will be cleaned up. This is the default behavior.
     If there is a customizer error and this field is set to 'abort', the build VM will be
     preserved. Known values are: "cleanup" and "abort".
    :vartype on_customizer_error: str or ~azure.mgmt.imagebuilder.models.OnBuildError
    :ivar on_validation_error: If there is a validation error and this field is set to 'cleanup',
     the build VM and associated network resources will be cleaned up. This is the default behavior.
     If there is a validation error and this field is set to 'abort', the build VM will be
     preserved. Known values are: "cleanup" and "abort".
    :vartype on_validation_error: str or ~azure.mgmt.imagebuilder.models.OnBuildError
    """

    on_customizer_error: Optional[Union[str, "_models.OnBuildError"]] = rest_field(
        name="onCustomizerError", visibility=["read", "create", "update", "delete", "query"]
    )
    """If there is a customizer error and this field is set to 'cleanup', the build VM and associated
     network resources will be cleaned up. This is the default behavior. If there is a customizer
     error and this field is set to 'abort', the build VM will be preserved. Known values are:
     \"cleanup\" and \"abort\"."""
    on_validation_error: Optional[Union[str, "_models.OnBuildError"]] = rest_field(
        name="onValidationError", visibility=["read", "create", "update", "delete", "query"]
    )
    """If there is a validation error and this field is set to 'cleanup', the build VM and associated
     network resources will be cleaned up. This is the default behavior. If there is a validation
     error and this field is set to 'abort', the build VM will be preserved. Known values are:
     \"cleanup\" and \"abort\"."""

    @overload
    def __init__(
        self,
        *,
        on_customizer_error: Optional[Union[str, "_models.OnBuildError"]] = None,
        on_validation_error: Optional[Union[str, "_models.OnBuildError"]] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class ImageTemplatePropertiesOptimize(_Model):
    """Specifies optimization to be performed on image.

    :ivar vm_boot: Optimization is applied on the image for a faster VM boot.
    :vartype vm_boot: ~azure.mgmt.imagebuilder.models.ImageTemplatePropertiesOptimizeVmBoot
    :ivar workload: Optimization is applied on the image for specific workloads.
    :vartype workload: ~azure.mgmt.imagebuilder.models.ImageTemplatePropertiesOptimizeWorkload
    """

    vm_boot: Optional["_models.ImageTemplatePropertiesOptimizeVmBoot"] = rest_field(
        name="vmBoot", visibility=["read", "create", "update", "delete", "query"]
    )
    """Optimization is applied on the image for a faster VM boot."""
    workload: Optional["_models.ImageTemplatePropertiesOptimizeWorkload"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Optimization is applied on the image for specific workloads."""

    @overload
    def __init__(
        self,
        *,
        vm_boot: Optional["_models.ImageTemplatePropertiesOptimizeVmBoot"] = None,
        workload: Optional["_models.ImageTemplatePropertiesOptimizeWorkload"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class ImageTemplatePropertiesOptimizeVmBoot(_Model):
    """Optimization is applied on the image for a faster VM boot.

    :ivar state: Enabling this field will improve VM boot time by optimizing the final customized
     image output. Known values are: "Enabled" and "Disabled".
    :vartype state: str or ~azure.mgmt.imagebuilder.models.VMBootOptimizationState
    """

    state: Optional[Union[str, "_models.VMBootOptimizationState"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Enabling this field will improve VM boot time by optimizing the final customized image output.
     Known values are: \"Enabled\" and \"Disabled\"."""

    @overload
    def __init__(
        self,
        *,
        state: Optional[Union[str, "_models.VMBootOptimizationState"]] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class ImageTemplatePropertiesOptimizeWorkload(_Model):
    """Optimization is applied on the image for specific workloads.

    :ivar state: Enabling this field will optimize vm images for specific workloads. Known values
     are: "Enabled" and "Disabled".
    :vartype state: str or ~azure.mgmt.imagebuilder.models.WorkloadOptimizationState
    :ivar script_uri: URI of the script to be run for workload optimization. It can be a github
     link, SAS URI for Azure Storage, etc.
    :vartype script_uri: str
    :ivar sha256_checksum: SHA256 checksum of the script provided in the scriptUri field.
    :vartype sha256_checksum: str
    """

    state: Optional[Union[str, "_models.WorkloadOptimizationState"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Enabling this field will optimize vm images for specific workloads. Known values are:
     \"Enabled\" and \"Disabled\"."""
    script_uri: Optional[str] = rest_field(name="scriptUri", visibility=["read", "create", "update", "delete", "query"])
    """URI of the script to be run for workload optimization. It can be a github link, SAS URI for
     Azure Storage, etc."""
    sha256_checksum: Optional[str] = rest_field(
        name="sha256Checksum", visibility=["read", "create", "update", "delete", "query"]
    )
    """SHA256 checksum of the script provided in the scriptUri field."""

    @overload
    def __init__(
        self,
        *,
        state: Optional[Union[str, "_models.WorkloadOptimizationState"]] = None,
        script_uri: Optional[str] = None,
        sha256_checksum: Optional[str] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class ImageTemplatePropertiesValidate(_Model):
    """Configuration options and list of validations to be performed on the resulting image.

    :ivar continue_distribute_on_failure: If validation fails and this field is set to false,
     output image(s) will not be distributed. This is the default behavior. If validation fails and
     this field is set to true, output image(s) will still be distributed. Please use this option
     with caution as it may result in bad images being distributed for use. In either case (true or
     false), the end to end image run will be reported as having failed in case of a validation
     failure. [Note: This field has no effect if validation succeeds.].
    :vartype continue_distribute_on_failure: bool
    :ivar source_validation_only: If this field is set to true, the image specified in the 'source'
     section will directly be validated. No separate build will be run to generate and then validate
     a customized image.
    :vartype source_validation_only: bool
    :ivar in_vm_validations: List of validations to be performed.
    :vartype in_vm_validations: list[~azure.mgmt.imagebuilder.models.ImageTemplateInVMValidator]
    """

    continue_distribute_on_failure: Optional[bool] = rest_field(
        name="continueDistributeOnFailure", visibility=["read", "create", "update", "delete", "query"]
    )
    """If validation fails and this field is set to false, output image(s) will not be distributed.
     This is the default behavior. If validation fails and this field is set to true, output
     image(s) will still be distributed. Please use this option with caution as it may result in bad
     images being distributed for use. In either case (true or false), the end to end image run will
     be reported as having failed in case of a validation failure. [Note: This field has no effect
     if validation succeeds.]."""
    source_validation_only: Optional[bool] = rest_field(
        name="sourceValidationOnly", visibility=["read", "create", "update", "delete", "query"]
    )
    """If this field is set to true, the image specified in the 'source' section will directly be
     validated. No separate build will be run to generate and then validate a customized image."""
    in_vm_validations: Optional[list["_models.ImageTemplateInVMValidator"]] = rest_field(
        name="inVMValidations", visibility=["read", "create", "update", "delete", "query"]
    )
    """List of validations to be performed."""

    @overload
    def __init__(
        self,
        *,
        continue_distribute_on_failure: Optional[bool] = None,
        source_validation_only: Optional[bool] = None,
        in_vm_validations: Optional[list["_models.ImageTemplateInVMValidator"]] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class ImageTemplateRestartCustomizer(ImageTemplateCustomizer, discriminator="WindowsRestart"):
    """Reboots a VM and waits for it to come back online (Windows). Corresponds to Packer
    windows-restart provisioner.

    :ivar name: Friendly Name to provide context on what this customization step does.
    :vartype name: str
    :ivar restart_command: Command to execute the restart [Default: 'shutdown /r /f /t 0 /c "packer
     restart"'].
    :vartype restart_command: str
    :ivar restart_check_command: Command to check if restart succeeded [Default: ''].
    :vartype restart_check_command: str
    :ivar restart_timeout: Restart timeout specified as a string of magnitude and unit, e.g. '5m'
     (5 minutes) or '2h' (2 hours) [Default: '5m'].
    :vartype restart_timeout: str
    :ivar type: The type of customization tool you want to use on the Image. For example, "Shell"
     can be shell customizer. Required. Default value is "WindowsRestart".
    :vartype type: str
    """

    restart_command: Optional[str] = rest_field(
        name="restartCommand", visibility=["read", "create", "update", "delete", "query"]
    )
    """Command to execute the restart [Default: 'shutdown /r /f /t 0 /c \"packer restart\"']."""
    restart_check_command: Optional[str] = rest_field(
        name="restartCheckCommand", visibility=["read", "create", "update", "delete", "query"]
    )
    """Command to check if restart succeeded [Default: '']."""
    restart_timeout: Optional[str] = rest_field(
        name="restartTimeout", visibility=["read", "create", "update", "delete", "query"]
    )
    """Restart timeout specified as a string of magnitude and unit, e.g. '5m' (5 minutes) or '2h' (2
     hours) [Default: '5m']."""
    type: Literal["WindowsRestart"] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """The type of customization tool you want to use on the Image. For example, \"Shell\" can be
     shell customizer. Required. Default value is \"WindowsRestart\"."""

    @overload
    def __init__(
        self,
        *,
        name: Optional[str] = None,
        restart_command: Optional[str] = None,
        restart_check_command: Optional[str] = None,
        restart_timeout: Optional[str] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
        self.type = "WindowsRestart"  # type: ignore


class ImageTemplateSharedImageDistributor(ImageTemplateDistributor, discriminator="SharedImage"):
    """Distribute via Azure Compute Gallery.

    :ivar run_output_name: The name to be used for the associated RunOutput. Required.
    :vartype run_output_name: str
    :ivar artifact_tags: Tags that will be applied to the artifact once it has been created/updated
     by the distributor.
    :vartype artifact_tags: dict[str, str]
    :ivar gallery_image_id: Resource Id of the Azure Compute Gallery image. Required.
    :vartype gallery_image_id: str
    :ivar replication_regions: [Deprecated] A list of regions that the image will be replicated to.
     This list can be specified only if targetRegions is not specified. This field is deprecated -
     use targetRegions instead.
    :vartype replication_regions: list[str]
    :ivar exclude_from_latest: Flag that indicates whether created image version should be excluded
     from latest. Omit to use the default (false).
    :vartype exclude_from_latest: bool
    :ivar storage_account_type: [Deprecated] Storage account type to be used to store the shared
     image. Omit to use the default (Standard_LRS). This field can be specified only if
     replicationRegions is specified. This field is deprecated - use targetRegions instead. Known
     values are: "Standard_LRS", "Standard_ZRS", and "Premium_LRS".
    :vartype storage_account_type: str or
     ~azure.mgmt.imagebuilder.models.SharedImageStorageAccountType
    :ivar target_regions: The target regions where the distributed Image Version is going to be
     replicated to. This object supersedes replicationRegions and can be specified only if
     replicationRegions is not specified.
    :vartype target_regions: list[~azure.mgmt.imagebuilder.models.TargetRegion]
    :ivar versioning: Describes how to generate new x.y.z version number for distribution.
    :vartype versioning: ~azure.mgmt.imagebuilder.models.DistributeVersioner
    :ivar replication_mode: Describes replication mode for distribution in Azure Compute Gallery.
     Omit to use the default (Full). Known values are: "Full" and "Shallow".
    :vartype replication_mode: str or ~azure.mgmt.imagebuilder.models.ReplicationMode
    :ivar type: Type of distribution. Required. Default value is "SharedImage".
    :vartype type: str
    """

    gallery_image_id: str = rest_field(
        name="galleryImageId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource Id of the Azure Compute Gallery image. Required."""
    replication_regions: Optional[list[str]] = rest_field(
        name="replicationRegions", visibility=["read", "create", "update", "delete", "query"]
    )
    """[Deprecated] A list of regions that the image will be replicated to. This list can be specified
     only if targetRegions is not specified. This field is deprecated - use targetRegions instead."""
    exclude_from_latest: Optional[bool] = rest_field(
        name="excludeFromLatest", visibility=["read", "create", "update", "delete", "query"]
    )
    """Flag that indicates whether created image version should be excluded from latest. Omit to use
     the default (false)."""
    storage_account_type: Optional[Union[str, "_models.SharedImageStorageAccountType"]] = rest_field(
        name="storageAccountType", visibility=["read", "create", "update", "delete", "query"]
    )
    """[Deprecated] Storage account type to be used to store the shared image. Omit to use the default
     (Standard_LRS). This field can be specified only if replicationRegions is specified. This field
     is deprecated - use targetRegions instead. Known values are: \"Standard_LRS\",
     \"Standard_ZRS\", and \"Premium_LRS\"."""
    target_regions: Optional[list["_models.TargetRegion"]] = rest_field(
        name="targetRegions", visibility=["read", "create", "update", "delete", "query"]
    )
    """The target regions where the distributed Image Version is going to be replicated to. This
     object supersedes replicationRegions and can be specified only if replicationRegions is not
     specified."""
    versioning: Optional["_models.DistributeVersioner"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Describes how to generate new x.y.z version number for distribution."""
    replication_mode: Optional[Union[str, "_models.ReplicationMode"]] = rest_field(
        name="replicationMode", visibility=["read", "create", "update", "delete", "query"]
    )
    """Describes replication mode for distribution in Azure Compute Gallery. Omit to use the default
     (Full). Known values are: \"Full\" and \"Shallow\"."""
    type: Literal["SharedImage"] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """Type of distribution. Required. Default value is \"SharedImage\"."""

    @overload
    def __init__(
        self,
        *,
        run_output_name: str,
        gallery_image_id: str,
        artifact_tags: Optional[dict[str, str]] = None,
        replication_regions: Optional[list[str]] = None,
        exclude_from_latest: Optional[bool] = None,
        storage_account_type: Optional[Union[str, "_models.SharedImageStorageAccountType"]] = None,
        target_regions: Optional[list["_models.TargetRegion"]] = None,
        versioning: Optional["_models.DistributeVersioner"] = None,
        replication_mode: Optional[Union[str, "_models.ReplicationMode"]] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
        self.type = "SharedImage"  # type: ignore


class ImageTemplateSharedImageVersionSource(ImageTemplateSource, discriminator="SharedImageVersion"):
    """Describes an image source that is an image version in an Azure Compute Gallery or a Direct
    Shared Gallery.

    :ivar image_version_id: ARM resource id of the image version. When image version name is
     'latest', the version is evaluated when the image build takes place. Required.
    :vartype image_version_id: str
    :ivar exact_version: Exact ARM resource id of the image version. This readonly field differs
     from the image version Id in 'imageVersionId' only if the version name specified in
     'imageVersionId' field is 'latest'.
    :vartype exact_version: str
    :ivar type: Specifies the type of source image you want to start with. Required. Default value
     is "SharedImageVersion".
    :vartype type: str
    """

    image_version_id: str = rest_field(
        name="imageVersionId", visibility=["read", "create", "update", "delete", "query"]
    )
    """ARM resource id of the image version. When image version name is 'latest', the version is
     evaluated when the image build takes place. Required."""
    exact_version: Optional[str] = rest_field(name="exactVersion", visibility=["read"])
    """Exact ARM resource id of the image version. This readonly field differs from the image version
     Id in 'imageVersionId' only if the version name specified in 'imageVersionId' field is
     'latest'."""
    type: Literal["SharedImageVersion"] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """Specifies the type of source image you want to start with. Required. Default value is
     \"SharedImageVersion\"."""

    @overload
    def __init__(
        self,
        *,
        image_version_id: str,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
        self.type = "SharedImageVersion"  # type: ignore


class ImageTemplateShellCustomizer(ImageTemplateCustomizer, discriminator="Shell"):
    """Runs a shell script during the customization phase (Linux). Corresponds to Packer shell
    provisioner. Exactly one of 'scriptUri' or 'inline' can be specified.

    :ivar name: Friendly Name to provide context on what this customization step does.
    :vartype name: str
    :ivar script_uri: URI of the shell script to be run for customizing. It can be a github link,
     SAS URI for Azure Storage, etc.
    :vartype script_uri: str
    :ivar sha256_checksum: SHA256 checksum of the shell script provided in the scriptUri field.
    :vartype sha256_checksum: str
    :ivar inline: Array of shell commands to execute.
    :vartype inline: list[str]
    :ivar type: The type of customization tool you want to use on the Image. For example, "Shell"
     can be shell customizer. Required. Default value is "Shell".
    :vartype type: str
    """

    script_uri: Optional[str] = rest_field(name="scriptUri", visibility=["read", "create", "update", "delete", "query"])
    """URI of the shell script to be run for customizing. It can be a github link, SAS URI for Azure
     Storage, etc."""
    sha256_checksum: Optional[str] = rest_field(
        name="sha256Checksum", visibility=["read", "create", "update", "delete", "query"]
    )
    """SHA256 checksum of the shell script provided in the scriptUri field."""
    inline: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Array of shell commands to execute."""
    type: Literal["Shell"] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """The type of customization tool you want to use on the Image. For example, \"Shell\" can be
     shell customizer. Required. Default value is \"Shell\"."""

    @overload
    def __init__(
        self,
        *,
        name: Optional[str] = None,
        script_uri: Optional[str] = None,
        sha256_checksum: Optional[str] = None,
        inline: Optional[list[str]] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
        self.type = "Shell"  # type: ignore


class ImageTemplateShellValidator(ImageTemplateInVMValidator, discriminator="Shell"):
    """Runs the specified shell script during the validation phase (Linux). Corresponds to Packer
    shell provisioner. Exactly one of 'scriptUri' or 'inline' can be specified.

    :ivar name: Friendly Name to provide context on what this validation step does.
    :vartype name: str
    :ivar script_uri: URI of the shell script to be run for validation. It can be a github link,
     Azure Storage URI, etc.
    :vartype script_uri: str
    :ivar sha256_checksum: SHA256 checksum of the shell script provided in the scriptUri field.
    :vartype sha256_checksum: str
    :ivar inline: Array of shell commands to execute.
    :vartype inline: list[str]
    :ivar type: The type of validation you want to use on the Image. For example, "Shell" can be
     shell validation. Required. Default value is "Shell".
    :vartype type: str
    """

    script_uri: Optional[str] = rest_field(name="scriptUri", visibility=["read", "create", "update", "delete", "query"])
    """URI of the shell script to be run for validation. It can be a github link, Azure Storage URI,
     etc."""
    sha256_checksum: Optional[str] = rest_field(
        name="sha256Checksum", visibility=["read", "create", "update", "delete", "query"]
    )
    """SHA256 checksum of the shell script provided in the scriptUri field."""
    inline: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Array of shell commands to execute."""
    type: Literal["Shell"] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """The type of validation you want to use on the Image. For example, \"Shell\" can be shell
     validation. Required. Default value is \"Shell\"."""

    @overload
    def __init__(
        self,
        *,
        name: Optional[str] = None,
        script_uri: Optional[str] = None,
        sha256_checksum: Optional[str] = None,
        inline: Optional[list[str]] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
        self.type = "Shell"  # type: ignore


class ImageTemplateUpdateParameters(_Model):
    """Parameters for updating an image template.

    :ivar identity: The identity of the image template, if configured.
    :vartype identity: ~azure.mgmt.imagebuilder.models.ImageTemplateIdentity
    :ivar tags: The user-specified tags associated with the image template.
    :vartype tags: dict[str, str]
    :ivar properties: Parameters for updating an image template.
    :vartype properties: ~azure.mgmt.imagebuilder.models.ImageTemplateUpdateParametersProperties
    """

    identity: Optional["_models.ImageTemplateIdentity"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The identity of the image template, if configured."""
    tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The user-specified tags associated with the image template."""
    properties: Optional["_models.ImageTemplateUpdateParametersProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """Parameters for updating an image template."""

    @overload
    def __init__(
        self,
        *,
        identity: Optional["_models.ImageTemplateIdentity"] = None,
        tags: Optional[dict[str, str]] = None,
        properties: Optional["_models.ImageTemplateUpdateParametersProperties"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class ImageTemplateUpdateParametersProperties(_Model):
    """Parameters for updating an image template.

    :ivar distribute: The distribution targets where the image output needs to go to.
    :vartype distribute: list[~azure.mgmt.imagebuilder.models.ImageTemplateDistributor]
    :ivar vm_profile: Describes how virtual machine is set up to build images.
    :vartype vm_profile: ~azure.mgmt.imagebuilder.models.ImageTemplateVmProfile
    """

    distribute: Optional[list["_models.ImageTemplateDistributor"]] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The distribution targets where the image output needs to go to."""
    vm_profile: Optional["_models.ImageTemplateVmProfile"] = rest_field(
        name="vmProfile", visibility=["read", "create", "update", "delete", "query"]
    )
    """Describes how virtual machine is set up to build images."""

    @overload
    def __init__(
        self,
        *,
        distribute: Optional[list["_models.ImageTemplateDistributor"]] = None,
        vm_profile: Optional["_models.ImageTemplateVmProfile"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class ImageTemplateVhdDistributor(ImageTemplateDistributor, discriminator="VHD"):
    """Distribute via VHD in a storage account.

    :ivar run_output_name: The name to be used for the associated RunOutput. Required.
    :vartype run_output_name: str
    :ivar artifact_tags: Tags that will be applied to the artifact once it has been created/updated
     by the distributor.
    :vartype artifact_tags: dict[str, str]
    :ivar uri: Optional Azure Storage URI for the distributed VHD blob. Omit to use the default
     (empty string) in which case VHD would be published to the storage account in the staging
     resource group.
    :vartype uri: str
    :ivar type: Type of distribution. Required. Default value is "VHD".
    :vartype type: str
    """

    uri: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Optional Azure Storage URI for the distributed VHD blob. Omit to use the default (empty string)
     in which case VHD would be published to the storage account in the staging resource group."""
    type: Literal["VHD"] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """Type of distribution. Required. Default value is \"VHD\"."""

    @overload
    def __init__(
        self,
        *,
        run_output_name: str,
        artifact_tags: Optional[dict[str, str]] = None,
        uri: Optional[str] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
        self.type = "VHD"  # type: ignore


class ImageTemplateVmProfile(_Model):
    """Describes the virtual machines used to build and validate images.

    :ivar 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 for Gen1 images and Standard_D2ds_v4
     for Gen2 images).
    :vartype vm_size: str
    :ivar os_disk_size_gb: Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS
     disk size.
    :vartype os_disk_size_gb: int
    :ivar user_assigned_identities: Optional array of resource IDs of user assigned managed
     identities to be configured on the build VM and validation VM. This may include the identity of
     the image template.
    :vartype user_assigned_identities: list[str]
    :ivar vnet_config: Optional configuration of the virtual network to use to deploy the build VM
     and validation VM in. Omit if no specific virtual network needs to be used.
    :vartype vnet_config: ~azure.mgmt.imagebuilder.models.VirtualNetworkConfig
    """

    vm_size: Optional[str] = rest_field(name="vmSize", visibility=["read", "create", "update", "delete", "query"])
    """Size of the virtual machine used to build, customize and capture images. Omit or specify empty
     string to use the default (Standard_D1_v2 for Gen1 images and Standard_D2ds_v4 for Gen2
     images)."""
    os_disk_size_gb: Optional[int] = rest_field(
        name="osDiskSizeGB", visibility=["read", "create", "update", "delete", "query"]
    )
    """Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS disk size."""
    user_assigned_identities: Optional[list[str]] = rest_field(
        name="userAssignedIdentities", visibility=["read", "create", "update", "delete", "query"]
    )
    """Optional array of resource IDs of user assigned managed identities to be configured on the
     build VM and validation VM. This may include the identity of the image template."""
    vnet_config: Optional["_models.VirtualNetworkConfig"] = rest_field(
        name="vnetConfig", visibility=["read", "create", "update", "delete", "query"]
    )
    """Optional configuration of the virtual network to use to deploy the build VM and validation VM
     in. Omit if no specific virtual network needs to be used."""

    @overload
    def __init__(
        self,
        *,
        vm_size: Optional[str] = None,
        os_disk_size_gb: Optional[int] = None,
        user_assigned_identities: Optional[list[str]] = None,
        vnet_config: Optional["_models.VirtualNetworkConfig"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class ImageTemplateWindowsUpdateCustomizer(ImageTemplateCustomizer, discriminator="WindowsUpdate"):
    """Installs Windows Updates. Corresponds to Packer Windows Update Provisioner
    (`https://github.com/rgl/packer-provisioner-windows-update
    <https://github.com/rgl/packer-provisioner-windows-update>`_).

    :ivar name: Friendly Name to provide context on what this customization step does.
    :vartype name: str
    :ivar 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.
    :vartype search_criteria: str
    :ivar 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.
    :vartype filters: list[str]
    :ivar update_limit: Maximum number of updates to apply at a time. Omit or specify 0 to use the
     default (1000).
    :vartype update_limit: int
    :ivar type: The type of customization tool you want to use on the Image. For example, "Shell"
     can be shell customizer. Required. Default value is "WindowsUpdate".
    :vartype type: str
    """

    search_criteria: Optional[str] = rest_field(
        name="searchCriteria", visibility=["read", "create", "update", "delete", "query"]
    )
    """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."""
    filters: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """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."""
    update_limit: Optional[int] = rest_field(
        name="updateLimit", visibility=["read", "create", "update", "delete", "query"]
    )
    """Maximum number of updates to apply at a time. Omit or specify 0 to use the default (1000)."""
    type: Literal["WindowsUpdate"] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """The type of customization tool you want to use on the Image. For example, \"Shell\" can be
     shell customizer. Required. Default value is \"WindowsUpdate\"."""

    @overload
    def __init__(
        self,
        *,
        name: Optional[str] = None,
        search_criteria: Optional[str] = None,
        filters: Optional[list[str]] = None,
        update_limit: Optional[int] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
        self.type = "WindowsUpdate"  # type: ignore


class Operation(_Model):
    """A REST API operation.

    :ivar name: This is of the format {provider}/{resource}/{operation}.
    :vartype name: str
    :ivar display: The object that describes the operation.
    :vartype display: ~azure.mgmt.imagebuilder.models.OperationDisplay
    :ivar origin: The intended executor of the operation.
    :vartype origin: str
    :ivar properties: Properties of the operation.
    :vartype properties: any
    :ivar is_data_action: The flag that indicates whether the operation applies to data plane.
    :vartype is_data_action: bool
    """

    name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """This is of the format {provider}/{resource}/{operation}."""
    display: Optional["_models.OperationDisplay"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The object that describes the operation."""
    origin: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The intended executor of the operation."""
    properties: Optional[Any] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Properties of the operation."""
    is_data_action: Optional[bool] = rest_field(
        name="isDataAction", visibility=["read", "create", "update", "delete", "query"]
    )
    """The flag that indicates whether the operation applies to data plane."""

    @overload
    def __init__(
        self,
        *,
        name: Optional[str] = None,
        display: Optional["_models.OperationDisplay"] = None,
        origin: Optional[str] = None,
        properties: Optional[Any] = None,
        is_data_action: Optional[bool] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class OperationDisplay(_Model):
    """The object that describes the operation.

    :ivar provider: Friendly name of the resource provider.
    :vartype provider: str
    :ivar operation: For example: read, write, delete, or listKeys/action.
    :vartype operation: str
    :ivar resource: The resource type on which the operation is performed.
    :vartype resource: str
    :ivar description: The friendly name of the operation.
    :vartype description: str
    """

    provider: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Friendly name of the resource provider."""
    operation: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """For example: read, write, delete, or listKeys/action."""
    resource: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The resource type on which the operation is performed."""
    description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The friendly name of the operation."""

    @overload
    def __init__(
        self,
        *,
        provider: Optional[str] = None,
        operation: Optional[str] = None,
        resource: Optional[str] = None,
        description: Optional[str] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class PlatformImagePurchasePlan(_Model):
    """Purchase plan configuration for platform image.

    :ivar plan_name: Name of the purchase plan. Required.
    :vartype plan_name: str
    :ivar plan_product: Product of the purchase plan. Required.
    :vartype plan_product: str
    :ivar plan_publisher: Publisher of the purchase plan. Required.
    :vartype plan_publisher: str
    """

    plan_name: str = rest_field(name="planName", visibility=["read", "create", "update", "delete", "query"])
    """Name of the purchase plan. Required."""
    plan_product: str = rest_field(name="planProduct", visibility=["read", "create", "update", "delete", "query"])
    """Product of the purchase plan. Required."""
    plan_publisher: str = rest_field(name="planPublisher", visibility=["read", "create", "update", "delete", "query"])
    """Publisher of the purchase plan. Required."""

    @overload
    def __init__(
        self,
        *,
        plan_name: str,
        plan_product: str,
        plan_publisher: str,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class ProvisioningError(_Model):
    """Describes the error happened when create or update an image template.

    :ivar provisioning_error_code: Error code of the provisioning failure. Known values are:
     "BadSourceType", "BadPIRSource", "BadManagedImageSource", "BadSharedImageVersionSource",
     "BadCustomizerType", "UnsupportedCustomizerType", "NoCustomizerScript", "BadValidatorType",
     "UnsupportedValidatorType", "NoValidatorScript", "BadDistributeType",
     "BadSharedImageDistribute", "BadStagingResourceGroup", "ServerError", and "Other".
    :vartype provisioning_error_code: str or ~azure.mgmt.imagebuilder.models.ProvisioningErrorCode
    :ivar message: Verbose error message about the provisioning failure.
    :vartype message: str
    """

    provisioning_error_code: Optional[Union[str, "_models.ProvisioningErrorCode"]] = rest_field(
        name="provisioningErrorCode", visibility=["read", "create", "update", "delete", "query"]
    )
    """Error code of the provisioning failure. Known values are: \"BadSourceType\", \"BadPIRSource\",
     \"BadManagedImageSource\", \"BadSharedImageVersionSource\", \"BadCustomizerType\",
     \"UnsupportedCustomizerType\", \"NoCustomizerScript\", \"BadValidatorType\",
     \"UnsupportedValidatorType\", \"NoValidatorScript\", \"BadDistributeType\",
     \"BadSharedImageDistribute\", \"BadStagingResourceGroup\", \"ServerError\", and \"Other\"."""
    message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """Verbose error message about the provisioning failure."""

    @overload
    def __init__(
        self,
        *,
        provisioning_error_code: Optional[Union[str, "_models.ProvisioningErrorCode"]] = None,
        message: Optional[str] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class ProxyResource(Resource):
    """Proxy Resource.

    :ivar id: Fully qualified resource ID for the resource. Ex -
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
    :vartype id: str
    :ivar name: The name of the resource.
    :vartype name: str
    :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
     "Microsoft.Storage/storageAccounts".
    :vartype type: str
    :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
     information.
    :vartype system_data: ~azure.mgmt.imagebuilder.models.SystemData
    """


class RunOutput(ProxyResource):
    """Represents an output that was created by running an image template.

    :ivar id: Fully qualified resource ID for the resource. Ex -
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
    :vartype id: str
    :ivar name: The name of the resource.
    :vartype name: str
    :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
     "Microsoft.Storage/storageAccounts".
    :vartype type: str
    :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
     information.
    :vartype system_data: ~azure.mgmt.imagebuilder.models.SystemData
    :ivar properties: The properties of the run output.
    :vartype properties: ~azure.mgmt.imagebuilder.models.RunOutputProperties
    """

    properties: Optional["_models.RunOutputProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The properties of the run output."""

    __flattened_items = ["artifact_id", "artifact_uri", "provisioning_state"]

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.RunOutputProperties"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items}
        super().__init__(*args, **kwargs)
        for k, v in _flattened_input.items():
            setattr(self, k, v)

    def __getattr__(self, name: str) -> Any:
        if name in self.__flattened_items:
            if self.properties is None:
                return None
            return getattr(self.properties, name)
        raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'")

    def __setattr__(self, key: str, value: Any) -> None:
        if key in self.__flattened_items:
            if self.properties is None:
                self.properties = self._attr_to_rest_field["properties"]._class_type()
            setattr(self.properties, key, value)
        else:
            super().__setattr__(key, value)


class RunOutputProperties(_Model):
    """Describes the properties of a run output.

    :ivar artifact_id: The resource id of the artifact.
    :vartype artifact_id: str
    :ivar artifact_uri: The location URI of the artifact.
    :vartype artifact_uri: str
    :ivar provisioning_state: Provisioning state of the resource. Known values are: "Creating",
     "Updating", "Succeeded", "Failed", "Deleting", and "Canceled".
    :vartype provisioning_state: str or ~azure.mgmt.imagebuilder.models.ProvisioningState
    """

    artifact_id: Optional[str] = rest_field(
        name="artifactId", visibility=["read", "create", "update", "delete", "query"]
    )
    """The resource id of the artifact."""
    artifact_uri: Optional[str] = rest_field(
        name="artifactUri", visibility=["read", "create", "update", "delete", "query"]
    )
    """The location URI of the artifact."""
    provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field(
        name="provisioningState", visibility=["read"]
    )
    """Provisioning state of the resource. Known values are: \"Creating\", \"Updating\",
     \"Succeeded\", \"Failed\", \"Deleting\", and \"Canceled\"."""

    @overload
    def __init__(
        self,
        *,
        artifact_id: Optional[str] = None,
        artifact_uri: Optional[str] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class TriggerProperties(_Model):
    """Describes the properties of a trigger.

    You probably want to use the sub-classes and not this class directly. Known sub-classes are:
    SourceImageTriggerProperties

    :ivar kind: The kind of trigger. Required. Default value is None.
    :vartype kind: str
    :ivar status: Trigger status.
    :vartype status: ~azure.mgmt.imagebuilder.models.TriggerStatus
    :ivar provisioning_state: Provisioning state of the resource. Known values are: "Creating",
     "Updating", "Succeeded", "Failed", "Deleting", and "Canceled".
    :vartype provisioning_state: str or ~azure.mgmt.imagebuilder.models.ProvisioningState
    """

    __mapping__: dict[str, _Model] = {}
    kind: str = rest_discriminator(name="kind", visibility=["read", "create"])
    """The kind of trigger. Required. Default value is None."""
    status: Optional["_models.TriggerStatus"] = rest_field(visibility=["read"])
    """Trigger status."""
    provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field(
        name="provisioningState", visibility=["read"]
    )
    """Provisioning state of the resource. Known values are: \"Creating\", \"Updating\",
     \"Succeeded\", \"Failed\", \"Deleting\", and \"Canceled\"."""

    @overload
    def __init__(
        self,
        *,
        kind: str,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class SourceImageTriggerProperties(TriggerProperties, discriminator="SourceImage"):
    """Properties of SourceImage kind of trigger.

    :ivar status: Trigger status.
    :vartype status: ~azure.mgmt.imagebuilder.models.TriggerStatus
    :ivar provisioning_state: Provisioning state of the resource. Known values are: "Creating",
     "Updating", "Succeeded", "Failed", "Deleting", and "Canceled".
    :vartype provisioning_state: str or ~azure.mgmt.imagebuilder.models.ProvisioningState
    :ivar kind: The kind of trigger. Required. Default value is "SourceImage".
    :vartype kind: str
    """

    kind: Literal["SourceImage"] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"])  # type: ignore
    """The kind of trigger. Required. Default value is \"SourceImage\"."""

    @overload
    def __init__(
        self,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
        self.kind = "SourceImage"  # type: ignore


class SystemData(_Model):
    """Metadata pertaining to creation and last modification of the resource.

    :ivar created_by: The identity that created the resource.
    :vartype created_by: str
    :ivar created_by_type: The type of identity that created the resource. Known values are:
     "User", "Application", "ManagedIdentity", and "Key".
    :vartype created_by_type: str or ~azure.mgmt.imagebuilder.models.CreatedByType
    :ivar created_at: The timestamp of resource creation (UTC).
    :vartype created_at: ~datetime.datetime
    :ivar last_modified_by: The identity that last modified the resource.
    :vartype last_modified_by: str
    :ivar last_modified_by_type: The type of identity that last modified the resource. Known values
     are: "User", "Application", "ManagedIdentity", and "Key".
    :vartype last_modified_by_type: str or ~azure.mgmt.imagebuilder.models.CreatedByType
    :ivar last_modified_at: The timestamp of resource last modification (UTC).
    :vartype last_modified_at: ~datetime.datetime
    """

    created_by: Optional[str] = rest_field(name="createdBy", visibility=["read", "create", "update", "delete", "query"])
    """The identity that created the resource."""
    created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field(
        name="createdByType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The type of identity that created the resource. Known values are: \"User\", \"Application\",
     \"ManagedIdentity\", and \"Key\"."""
    created_at: Optional[datetime.datetime] = rest_field(
        name="createdAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """The timestamp of resource creation (UTC)."""
    last_modified_by: Optional[str] = rest_field(
        name="lastModifiedBy", visibility=["read", "create", "update", "delete", "query"]
    )
    """The identity that last modified the resource."""
    last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field(
        name="lastModifiedByType", visibility=["read", "create", "update", "delete", "query"]
    )
    """The type of identity that last modified the resource. Known values are: \"User\",
     \"Application\", \"ManagedIdentity\", and \"Key\"."""
    last_modified_at: Optional[datetime.datetime] = rest_field(
        name="lastModifiedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339"
    )
    """The timestamp of resource last modification (UTC)."""

    @overload
    def __init__(
        self,
        *,
        created_by: Optional[str] = None,
        created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None,
        created_at: Optional[datetime.datetime] = None,
        last_modified_by: Optional[str] = None,
        last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None,
        last_modified_at: Optional[datetime.datetime] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class TargetRegion(_Model):
    """Describes the target region information.

    :ivar name: The name of the region. Required.
    :vartype name: str
    :ivar replica_count: The number of replicas of the Image Version to be created in this region.
     Omit to use the default (1).
    :vartype replica_count: int
    :ivar storage_account_type: Specifies the storage account type to be used to store the image in
     this region. Omit to use the default (Standard_LRS). Known values are: "Standard_LRS",
     "Standard_ZRS", and "Premium_LRS".
    :vartype storage_account_type: str or
     ~azure.mgmt.imagebuilder.models.SharedImageStorageAccountType
    """

    name: str = rest_field(visibility=["read", "create", "update", "delete", "query"])
    """The name of the region. Required."""
    replica_count: Optional[int] = rest_field(
        name="replicaCount", visibility=["read", "create", "update", "delete", "query"]
    )
    """The number of replicas of the Image Version to be created in this region. Omit to use the
     default (1)."""
    storage_account_type: Optional[Union[str, "_models.SharedImageStorageAccountType"]] = rest_field(
        name="storageAccountType", visibility=["read", "create", "update", "delete", "query"]
    )
    """Specifies the storage account type to be used to store the image in this region. Omit to use
     the default (Standard_LRS). Known values are: \"Standard_LRS\", \"Standard_ZRS\", and
     \"Premium_LRS\"."""

    @overload
    def __init__(
        self,
        *,
        name: str,
        replica_count: Optional[int] = None,
        storage_account_type: Optional[Union[str, "_models.SharedImageStorageAccountType"]] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class Trigger(ProxyResource):
    """Represents a trigger that can invoke an image template build.

    :ivar id: Fully qualified resource ID for the resource. Ex -
     /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
    :vartype id: str
    :ivar name: The name of the resource.
    :vartype name: str
    :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
     "Microsoft.Storage/storageAccounts".
    :vartype type: str
    :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy
     information.
    :vartype system_data: ~azure.mgmt.imagebuilder.models.SystemData
    :ivar properties: The properties of a trigger.
    :vartype properties: ~azure.mgmt.imagebuilder.models.TriggerProperties
    """

    properties: Optional["_models.TriggerProperties"] = rest_field(
        visibility=["read", "create", "update", "delete", "query"]
    )
    """The properties of a trigger."""

    @overload
    def __init__(
        self,
        *,
        properties: Optional["_models.TriggerProperties"] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)


class TriggerStatus(_Model):
    """Describes the status of a trigger.

    :ivar code: The status code.
    :vartype code: str
    :ivar message: The detailed status message, including for alerts and error messages.
    :vartype message: str
    :ivar time: The time of the status.
    :vartype time: ~datetime.datetime
    """

    code: Optional[str] = rest_field(visibility=["read"])
    """The status code."""
    message: Optional[str] = rest_field(visibility=["read"])
    """The detailed status message, including for alerts and error messages."""
    time: Optional[datetime.datetime] = rest_field(visibility=["read"], format="rfc3339")
    """The time of the status."""


class UserAssignedIdentity(_Model):
    """User assigned identity properties.

    :ivar principal_id: The principal ID of the assigned identity.
    :vartype principal_id: str
    :ivar client_id: The client ID of the assigned identity.
    :vartype client_id: str
    """

    principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"])
    """The principal ID of the assigned identity."""
    client_id: Optional[str] = rest_field(name="clientId", visibility=["read"])
    """The client ID of the assigned identity."""


class VirtualNetworkConfig(_Model):
    """Virtual Network configuration.

    :ivar subnet_id: Resource id of a pre-existing subnet on which the build VM and validation VM
     will be deployed.
    :vartype subnet_id: str
    :ivar container_instance_subnet_id: Resource id of a pre-existing subnet on which Azure
     Container Instance will be deployed for Isolated Builds. This field may be specified only if
     ``subnetId`` is also specified and must be on the same Virtual Network as the subnet specified
     in ``subnetId``.
    :vartype container_instance_subnet_id: str
    :ivar proxy_vm_size: Size of the proxy virtual machine used to pass traffic to the build VM and
     validation VM. This must not be specified if ``containerInstanceSubnetId`` is specified because
     no proxy virtual machine is deployed in that case. Omit or specify empty string to use the
     default (Standard_A1_v2).
    :vartype proxy_vm_size: str
    """

    subnet_id: Optional[str] = rest_field(name="subnetId", visibility=["read", "create", "update", "delete", "query"])
    """Resource id of a pre-existing subnet on which the build VM and validation VM will be deployed."""
    container_instance_subnet_id: Optional[str] = rest_field(
        name="containerInstanceSubnetId", visibility=["read", "create", "update", "delete", "query"]
    )
    """Resource id of a pre-existing subnet on which Azure Container Instance will be deployed for
     Isolated Builds. This field may be specified only if ``subnetId`` is also specified and must be
     on the same Virtual Network as the subnet specified in ``subnetId``."""
    proxy_vm_size: Optional[str] = rest_field(
        name="proxyVmSize", visibility=["read", "create", "update", "delete", "query"]
    )
    """Size of the proxy virtual machine used to pass traffic to the build VM and validation VM. This
     must not be specified if ``containerInstanceSubnetId`` is specified because no proxy virtual
     machine is deployed in that case. Omit or specify empty string to use the default
     (Standard_A1_v2)."""

    @overload
    def __init__(
        self,
        *,
        subnet_id: Optional[str] = None,
        container_instance_subnet_id: Optional[str] = None,
        proxy_vm_size: Optional[str] = None,
    ) -> None: ...

    @overload
    def __init__(self, mapping: Mapping[str, Any]) -> None:
        """
        :param mapping: raw JSON to initialize the model.
        :type mapping: Mapping[str, Any]
        """

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        super().__init__(*args, **kwargs)
