# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import Dict, List, Optional

import msrest.serialization


class ErrorAdditionalInfo(msrest.serialization.Model):
    """The resource management error additional info.

    Variables are only populated by the server, and will be ignored when sending a request.

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

    _validation = {
        'type': {'readonly': True},
        'info': {'readonly': True},
    }

    _attribute_map = {
        'type': {'key': 'type', 'type': 'str'},
        'info': {'key': 'info', 'type': 'object'},
    }

    def __init__(
        self,
        **kwargs
    ):
        super(ErrorAdditionalInfo, self).__init__(**kwargs)
        self.type = None
        self.info = None


class ErrorResponse(msrest.serialization.Model):
    """The resource management error response.

    Variables are only populated by the server, and will be ignored when sending a request.

    :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[~swiftlet_management_client.models.ErrorResponse]
    :ivar additional_info: The error additional info.
    :vartype additional_info: list[~swiftlet_management_client.models.ErrorAdditionalInfo]
    """

    _validation = {
        'code': {'readonly': True},
        'message': {'readonly': True},
        'target': {'readonly': True},
        'details': {'readonly': True},
        'additional_info': {'readonly': True},
    }

    _attribute_map = {
        'code': {'key': 'code', 'type': 'str'},
        'message': {'key': 'message', 'type': 'str'},
        'target': {'key': 'target', 'type': 'str'},
        'details': {'key': 'details', 'type': '[ErrorResponse]'},
        'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'},
    }

    def __init__(
        self,
        **kwargs
    ):
        super(ErrorResponse, self).__init__(**kwargs)
        self.code = None
        self.message = None
        self.target = None
        self.details = None
        self.additional_info = None


class Port(msrest.serialization.Model):
    """The port(s) to open.

    :param port_range: The port(s) that will be open to traffic. This will be a string that can
     indicate a single port, a range (i.e. 50-60), or "*" to indicate all ports.
    :type port_range: str
    :param protocol: The type of traffic to allow on this port. Allowed values are "TCP", "UDP",
     "ICMP", and "\ *" (indicates all supported protocol types allowed). If not specified, it will
     be default to "*\ ".
    :type protocol: str
    """

    _attribute_map = {
        'port_range': {'key': 'portRange', 'type': 'str'},
        'protocol': {'key': 'protocol', 'type': 'str'},
    }

    def __init__(
        self,
        *,
        port_range: Optional[str] = None,
        protocol: Optional[str] = None,
        **kwargs
    ):
        super(Port, self).__init__(**kwargs)
        self.port_range = port_range
        self.protocol = protocol


class Resource(msrest.serialization.Model):
    """Resource.

    Variables are only populated by the server, and will be ignored when sending a request.

    :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. Ex- Microsoft.Compute/virtualMachines or
     Microsoft.Storage/storageAccounts.
    :vartype type: str
    """

    _validation = {
        'id': {'readonly': True},
        'name': {'readonly': True},
        'type': {'readonly': True},
    }

    _attribute_map = {
        'id': {'key': 'id', 'type': 'str'},
        'name': {'key': 'name', 'type': 'str'},
        'type': {'key': 'type', 'type': 'str'},
    }

    def __init__(
        self,
        **kwargs
    ):
        super(Resource, self).__init__(**kwargs)
        self.id = None
        self.name = None
        self.type = None


class SwiftletBundle(msrest.serialization.Model):
    """Specifies information about the Swiftlet bundle to use.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar swiftlet_bundle_sku: The ARM SKU name of the bundle.
    :vartype swiftlet_bundle_sku: str
    :ivar supported_image_platform: The OS image platforms that can be selected with this bundle.
     Allowed values will be "windows" or "linux".
    :vartype supported_image_platform: str
    :ivar memory_size_gb: The amount of RAM in gigabytes (GB).
    :vartype memory_size_gb: float
    :ivar vcpus: The number of CPUs.
    :vartype vcpus: int
    :ivar os_disk_size_gb: The size of the OS disk in gigabytes (GB).
    :vartype os_disk_size_gb: int
    :ivar os_disk_storage_account_type: The storage account type for the OS disk.
    :vartype os_disk_storage_account_type: str
    :ivar transfer_tb: The amount of transfer bandwidth in terabytes (TB).
    :vartype transfer_tb: int
    """

    _validation = {
        'swiftlet_bundle_sku': {'readonly': True},
        'supported_image_platform': {'readonly': True},
        'memory_size_gb': {'readonly': True},
        'vcpus': {'readonly': True},
        'os_disk_size_gb': {'readonly': True},
        'os_disk_storage_account_type': {'readonly': True},
        'transfer_tb': {'readonly': True},
    }

    _attribute_map = {
        'swiftlet_bundle_sku': {'key': 'swiftletBundleSku', 'type': 'str'},
        'supported_image_platform': {'key': 'supportedImagePlatform', 'type': 'str'},
        'memory_size_gb': {'key': 'memorySizeGB', 'type': 'float'},
        'vcpus': {'key': 'vcpus', 'type': 'int'},
        'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'},
        'os_disk_storage_account_type': {'key': 'osDiskStorageAccountType', 'type': 'str'},
        'transfer_tb': {'key': 'transferTB', 'type': 'int'},
    }

    def __init__(
        self,
        **kwargs
    ):
        super(SwiftletBundle, self).__init__(**kwargs)
        self.swiftlet_bundle_sku = None
        self.supported_image_platform = None
        self.memory_size_gb = None
        self.vcpus = None
        self.os_disk_size_gb = None
        self.os_disk_storage_account_type = None
        self.transfer_tb = None


class SwiftletBundleListResult(msrest.serialization.Model):
    """The list Swiftlet bundles response.

    :param value: The list of Swiftlet bundles.
    :type value: list[~swiftlet_management_client.models.SwiftletBundle]
    :param next_link: The URI to fetch the next page of resources. Call ListNext() with this URI to
     fetch the next page of resources.
    :type next_link: str
    """

    _attribute_map = {
        'value': {'key': 'value', 'type': '[SwiftletBundle]'},
        'next_link': {'key': 'nextLink', 'type': 'str'},
    }

    def __init__(
        self,
        *,
        value: Optional[List["SwiftletBundle"]] = None,
        next_link: Optional[str] = None,
        **kwargs
    ):
        super(SwiftletBundleListResult, self).__init__(**kwargs)
        self.value = value
        self.next_link = next_link


class SwiftletImage(msrest.serialization.Model):
    """Specifies information about the Swiftlet image to use.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar swiftlet_image_id: The image ID.
    :vartype swiftlet_image_id: str
    :ivar app_name: The app name if this is an "OS + Apps" image. Otherwise this will not be set.
    :vartype app_name: str
    :ivar app_version: The app version if this is an "OS + Apps" image. Otherwise this will not be
     set.
    :vartype app_version: str
    :ivar platform: The OS platform. Allowed values will be "windows" or "linux".
    :vartype platform: str
    :ivar os_name: The OS name.
    :vartype os_name: str
    :ivar os_version: The OS version.
    :vartype os_version: str
    :ivar display_publisher: The publisher name.
    :vartype display_publisher: str
    :ivar summary: The image summary.
    :vartype summary: str
    :ivar legal_terms_uri: The legal terms URI.
    :vartype legal_terms_uri: str
    """

    _validation = {
        'swiftlet_image_id': {'readonly': True},
        'app_name': {'readonly': True},
        'app_version': {'readonly': True},
        'platform': {'readonly': True},
        'os_name': {'readonly': True},
        'os_version': {'readonly': True},
        'display_publisher': {'readonly': True},
        'summary': {'readonly': True},
        'legal_terms_uri': {'readonly': True},
    }

    _attribute_map = {
        'swiftlet_image_id': {'key': 'swiftletImageId', 'type': 'str'},
        'app_name': {'key': 'appName', 'type': 'str'},
        'app_version': {'key': 'appVersion', 'type': 'str'},
        'platform': {'key': 'platform', 'type': 'str'},
        'os_name': {'key': 'osName', 'type': 'str'},
        'os_version': {'key': 'osVersion', 'type': 'str'},
        'display_publisher': {'key': 'displayPublisher', 'type': 'str'},
        'summary': {'key': 'summary', 'type': 'str'},
        'legal_terms_uri': {'key': 'legalTermsUri', 'type': 'str'},
    }

    def __init__(
        self,
        **kwargs
    ):
        super(SwiftletImage, self).__init__(**kwargs)
        self.swiftlet_image_id = None
        self.app_name = None
        self.app_version = None
        self.platform = None
        self.os_name = None
        self.os_version = None
        self.display_publisher = None
        self.summary = None
        self.legal_terms_uri = None


class SwiftletImageListResult(msrest.serialization.Model):
    """The list Swiftlet images response.

    :param value: The list of Swiftlet images.
    :type value: list[~swiftlet_management_client.models.SwiftletImage]
    :param next_link: The URI to fetch the next page of resources. Call ListNext() with this URI to
     fetch the next page of resources.
    :type next_link: str
    """

    _attribute_map = {
        'value': {'key': 'value', 'type': '[SwiftletImage]'},
        'next_link': {'key': 'nextLink', 'type': 'str'},
    }

    def __init__(
        self,
        *,
        value: Optional[List["SwiftletImage"]] = None,
        next_link: Optional[str] = None,
        **kwargs
    ):
        super(SwiftletImageListResult, self).__init__(**kwargs)
        self.value = value
        self.next_link = next_link


class SwiftletOperationListResult(msrest.serialization.Model):
    """The List Swiftlet Operation operation response.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar value: The list of Swiftlet operations.
    :vartype value: list[~swiftlet_management_client.models.SwiftletOperationValue]
    """

    _validation = {
        'value': {'readonly': True},
    }

    _attribute_map = {
        'value': {'key': 'value', 'type': '[SwiftletOperationValue]'},
    }

    def __init__(
        self,
        **kwargs
    ):
        super(SwiftletOperationListResult, self).__init__(**kwargs)
        self.value = None


class SwiftletOperationValue(msrest.serialization.Model):
    """Describes the properties of a Swiftlet Operation value.

    Variables are only populated by the server, and will be ignored when sending a request.

    :ivar origin: The origin of the Swiftlet operation.
    :vartype origin: str
    :ivar name: The name of the Swiftlet operation.
    :vartype name: str
    :ivar operation: The display name of the Swiftlet operation.
    :vartype operation: str
    :ivar resource: The display name of the resource the operation applies to.
    :vartype resource: str
    :ivar description: The description of the operation.
    :vartype description: str
    :ivar provider: The resource provider for the operation.
    :vartype provider: str
    """

    _validation = {
        'origin': {'readonly': True},
        'name': {'readonly': True},
        'operation': {'readonly': True},
        'resource': {'readonly': True},
        'description': {'readonly': True},
        'provider': {'readonly': True},
    }

    _attribute_map = {
        'origin': {'key': 'origin', 'type': 'str'},
        'name': {'key': 'name', 'type': 'str'},
        'operation': {'key': 'display.operation', 'type': 'str'},
        'resource': {'key': 'display.resource', 'type': 'str'},
        'description': {'key': 'display.description', 'type': 'str'},
        'provider': {'key': 'display.provider', 'type': 'str'},
    }

    def __init__(
        self,
        **kwargs
    ):
        super(SwiftletOperationValue, self).__init__(**kwargs)
        self.origin = None
        self.name = None
        self.operation = None
        self.resource = None
        self.description = None
        self.provider = None


class TrackedResource(Resource):
    """The resource model definition for a ARM tracked top level resource.

    Variables are only populated by the server, and will be ignored when sending a request.

    All required parameters must be populated in order to send to Azure.

    :ivar id: 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. Ex- Microsoft.Compute/virtualMachines or
     Microsoft.Storage/storageAccounts.
    :vartype type: str
    :param tags: A set of tags. Resource tags.
    :type tags: dict[str, str]
    :param location: Required. The geo-location where the resource lives.
    :type location: str
    """

    _validation = {
        'id': {'readonly': True},
        'name': {'readonly': True},
        'type': {'readonly': True},
        'location': {'required': True},
    }

    _attribute_map = {
        'id': {'key': 'id', 'type': 'str'},
        'name': {'key': 'name', 'type': 'str'},
        'type': {'key': 'type', 'type': 'str'},
        'tags': {'key': 'tags', 'type': '{str}'},
        'location': {'key': 'location', 'type': 'str'},
    }

    def __init__(
        self,
        *,
        location: str,
        tags: Optional[Dict[str, str]] = None,
        **kwargs
    ):
        super(TrackedResource, self).__init__(**kwargs)
        self.tags = tags
        self.location = location


class UpdateResource(msrest.serialization.Model):
    """The Update Resource model definition.

    :param tags: A set of tags. Resource tags.
    :type tags: dict[str, str]
    """

    _attribute_map = {
        'tags': {'key': 'tags', 'type': '{str}'},
    }

    def __init__(
        self,
        *,
        tags: Optional[Dict[str, str]] = None,
        **kwargs
    ):
        super(UpdateResource, self).__init__(**kwargs)
        self.tags = tags


class VirtualMachine(TrackedResource):
    """Describes a virtual machine.

    Variables are only populated by the server, and will be ignored when sending a request.

    All required parameters must be populated in order to send to Azure.

    :ivar id: 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. Ex- Microsoft.Compute/virtualMachines or
     Microsoft.Storage/storageAccounts.
    :vartype type: str
    :param tags: A set of tags. Resource tags.
    :type tags: dict[str, str]
    :param location: Required. The geo-location where the resource lives.
    :type location: str
    :param swiftlet_bundle_sku: Required. Specifies the Swiftlet bundle of this virtual machine
     (which specifies the selected tier of memory, processing, and storage).
    :type swiftlet_bundle_sku: str
    :ivar swiftlet_bundle: The Swiftlet bundle.
    :vartype swiftlet_bundle: ~swiftlet_management_client.models.SwiftletBundle
    :param swiftlet_image_id: Required. The image ID to use. The image "platform" must match the
     "supportedImagePlatform" of the specified swiftletBundleSku.
    :type swiftlet_image_id: str
    :ivar swiftlet_image: The Swiftlet image.
    :vartype swiftlet_image: ~swiftlet_management_client.models.SwiftletImage
    :param username: The username for connecting the the virtual machine.
    :type username: str
    :param ssh_public_key: The SSH public key used to connect to this virtual machine. Only
     supported on Linux images. If specified on a Windows image, an error will be returned.
    :type ssh_public_key: str
    :param password: The password for connecting to this Swiftlet. If the image platform type is
     "linux", this is optional if sshPublicKey is set. If the image platform type is "windows", this
     is required.
    :type password: str
    :param ports: The ports on which inbound traffic will be allowed.
    :type ports: list[~swiftlet_management_client.models.Port]
    :param startup_script: An inline script that will run upon startup of the virtual machine.
    :type startup_script: str
    :ivar public_ip_address: The public IP address of the virtual machine.
    :vartype public_ip_address: str
    :ivar public_i_pv6_address: The public IPv6 address of the virtual machine.
    :vartype public_i_pv6_address: str
    :ivar private_ip_address: The private IP address of the virtual machine.
    :vartype private_ip_address: str
    :ivar provisioning_state: The status of a user-initiated, control-plane operation on the
     virtual machine.
    :vartype provisioning_state: str
    :ivar power_state: The last known state of the virtual machine.
    :vartype power_state: str
    """

    _validation = {
        'id': {'readonly': True},
        'name': {'readonly': True},
        'type': {'readonly': True},
        'location': {'required': True},
        'swiftlet_bundle_sku': {'required': True},
        'swiftlet_bundle': {'readonly': True},
        'swiftlet_image_id': {'required': True},
        'swiftlet_image': {'readonly': True},
        'public_ip_address': {'readonly': True},
        'public_i_pv6_address': {'readonly': True},
        'private_ip_address': {'readonly': True},
        'provisioning_state': {'readonly': True},
        'power_state': {'readonly': True},
    }

    _attribute_map = {
        'id': {'key': 'id', 'type': 'str'},
        'name': {'key': 'name', 'type': 'str'},
        'type': {'key': 'type', 'type': 'str'},
        'tags': {'key': 'tags', 'type': '{str}'},
        'location': {'key': 'location', 'type': 'str'},
        'swiftlet_bundle_sku': {'key': 'properties.swiftletBundleSku', 'type': 'str'},
        'swiftlet_bundle': {'key': 'properties.swiftletBundle', 'type': 'SwiftletBundle'},
        'swiftlet_image_id': {'key': 'properties.swiftletImageId', 'type': 'str'},
        'swiftlet_image': {'key': 'properties.swiftletImage', 'type': 'SwiftletImage'},
        'username': {'key': 'properties.username', 'type': 'str'},
        'ssh_public_key': {'key': 'properties.sshPublicKey', 'type': 'str'},
        'password': {'key': 'properties.password', 'type': 'str'},
        'ports': {'key': 'properties.ports', 'type': '[Port]'},
        'startup_script': {'key': 'properties.startupScript', 'type': 'str'},
        'public_ip_address': {'key': 'properties.publicIPAddress', 'type': 'str'},
        'public_i_pv6_address': {'key': 'properties.publicIPv6Address', 'type': 'str'},
        'private_ip_address': {'key': 'properties.privateIPAddress', 'type': 'str'},
        'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
        'power_state': {'key': 'properties.powerState', 'type': 'str'},
    }

    def __init__(
        self,
        *,
        location: str,
        swiftlet_bundle_sku: str,
        swiftlet_image_id: str,
        tags: Optional[Dict[str, str]] = None,
        username: Optional[str] = None,
        ssh_public_key: Optional[str] = None,
        password: Optional[str] = None,
        ports: Optional[List["Port"]] = None,
        startup_script: Optional[str] = None,
        **kwargs
    ):
        super(VirtualMachine, self).__init__(tags=tags, location=location, **kwargs)
        self.swiftlet_bundle_sku = swiftlet_bundle_sku
        self.swiftlet_bundle = None
        self.swiftlet_image_id = swiftlet_image_id
        self.swiftlet_image = None
        self.username = username
        self.ssh_public_key = ssh_public_key
        self.password = password
        self.ports = ports
        self.startup_script = startup_script
        self.public_ip_address = None
        self.public_i_pv6_address = None
        self.private_ip_address = None
        self.provisioning_state = None
        self.power_state = None


class VirtualMachineListResult(msrest.serialization.Model):
    """The list virtual machine response.

    :param value: The list of virtual machines.
    :type value: list[~swiftlet_management_client.models.VirtualMachine]
    :param next_link: The URI to fetch the next page of resources. Call ListNext() with this URI to
     fetch the next page of resources.
    :type next_link: str
    """

    _attribute_map = {
        'value': {'key': 'value', 'type': '[VirtualMachine]'},
        'next_link': {'key': 'nextLink', 'type': 'str'},
    }

    def __init__(
        self,
        *,
        value: Optional[List["VirtualMachine"]] = None,
        next_link: Optional[str] = None,
        **kwargs
    ):
        super(VirtualMachineListResult, self).__init__(**kwargs)
        self.value = value
        self.next_link = next_link


class VirtualMachineUpdate(UpdateResource):
    """The request body for the Update Virtual Machine operation.

    :param tags: A set of tags. Resource tags.
    :type tags: dict[str, str]
    :param ports: Specifies the list of ports to be opened.
    :type ports: list[~swiftlet_management_client.models.Port]
    """

    _attribute_map = {
        'tags': {'key': 'tags', 'type': '{str}'},
        'ports': {'key': 'properties.ports', 'type': '[Port]'},
    }

    def __init__(
        self,
        *,
        tags: Optional[Dict[str, str]] = None,
        ports: Optional[List["Port"]] = None,
        **kwargs
    ):
        super(VirtualMachineUpdate, self).__init__(tags=tags, **kwargs)
        self.ports = ports
