diff --git a/sdk/azure-imds/azure/imds/__init__.py b/sdk/azure-imds/azure/imds/__init__.py new file mode 100644 index 0000000000000..7c028b6800c83 --- /dev/null +++ b/sdk/azure-imds/azure/imds/__init__.py @@ -0,0 +1,19 @@ +# 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 ._configuration import InstanceMetadataClientConfiguration +from ._instance_metadata_client import InstanceMetadataClient +__all__ = ['InstanceMetadataClient', 'InstanceMetadataClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/azure-imds/azure/imds/_configuration.py b/sdk/azure-imds/azure/imds/_configuration.py new file mode 100644 index 0000000000000..f62da4f2b0e5b --- /dev/null +++ b/sdk/azure-imds/azure/imds/_configuration.py @@ -0,0 +1,43 @@ +# 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 msrestazure import AzureConfiguration + +from .version import VERSION + + +class InstanceMetadataClientConfiguration(AzureConfiguration): + """Configuration for InstanceMetadataClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param str base_url: Service URL + """ + + def __init__( + self, credentials, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if not base_url: + base_url = 'http://169.254.169.254/metadata' + + super(InstanceMetadataClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-imds/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials diff --git a/sdk/azure-imds/azure/imds/_instance_metadata_client.py b/sdk/azure-imds/azure/imds/_instance_metadata_client.py new file mode 100644 index 0000000000000..d0d0a910d8151 --- /dev/null +++ b/sdk/azure-imds/azure/imds/_instance_metadata_client.py @@ -0,0 +1,57 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import InstanceMetadataClientConfiguration +from .operations import InstancesOperations +from .operations import AttestedOperations +from .operations import IdentityOperations +from . import models + + +class InstanceMetadataClient(SDKClient): + """The Azure Instance Metadata Client + + :ivar config: Configuration for client. + :vartype config: InstanceMetadataClientConfiguration + + :ivar instances: Instances operations + :vartype instances: azure.imds.operations.InstancesOperations + :ivar attested: Attested operations + :vartype attested: azure.imds.operations.AttestedOperations + :ivar identity: Identity operations + :vartype identity: azure.imds.operations.IdentityOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param str base_url: Service URL + """ + + def __init__( + self, credentials, base_url=None): + + self.config = InstanceMetadataClientConfiguration(credentials, base_url) + super(InstanceMetadataClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2021-02-01' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.instances = InstancesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.attested = AttestedOperations( + self._client, self.config, self._serialize, self._deserialize) + self.identity = IdentityOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/azure-imds/azure/imds/models/__init__.py b/sdk/azure-imds/azure/imds/models/__init__.py new file mode 100644 index 0000000000000..e8a0f594fbd50 --- /dev/null +++ b/sdk/azure-imds/azure/imds/models/__init__.py @@ -0,0 +1,109 @@ +# 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. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import AttestedData + from ._models_py3 import Compute + from ._models_py3 import DataDisk + from ._models_py3 import DiffDiskSettings + from ._models_py3 import DiskImage + from ._models_py3 import EncryptionSettings + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import IdentityErrorResponse, IdentityErrorResponseException + from ._models_py3 import IdentityInfoResponse + from ._models_py3 import IdentityTokenResponse + from ._models_py3 import ImageReference + from ._models_py3 import Instance + from ._models_py3 import Ipv4Properties + from ._models_py3 import Ipv6Properties + from ._models_py3 import ManagedDisk + from ._models_py3 import Network + from ._models_py3 import NetworkInterface + from ._models_py3 import NetworkInterfaceIpv4 + from ._models_py3 import NetworkInterfaceIpv6 + from ._models_py3 import OsDisk + from ._models_py3 import OsProfile + from ._models_py3 import PlanProperties + from ._models_py3 import PublicKeysProperties + from ._models_py3 import SecurityProfile + from ._models_py3 import StorageProfile + from ._models_py3 import StorageProfileResourceDisk + from ._models_py3 import SubnetProperties + from ._models_py3 import TagsProperties + from ._models_py3 import VirtualHardDisk +except (SyntaxError, ImportError): + from ._models import AttestedData + from ._models import Compute + from ._models import DataDisk + from ._models import DiffDiskSettings + from ._models import DiskImage + from ._models import EncryptionSettings + from ._models import ErrorResponse, ErrorResponseException + from ._models import IdentityErrorResponse, IdentityErrorResponseException + from ._models import IdentityInfoResponse + from ._models import IdentityTokenResponse + from ._models import ImageReference + from ._models import Instance + from ._models import Ipv4Properties + from ._models import Ipv6Properties + from ._models import ManagedDisk + from ._models import Network + from ._models import NetworkInterface + from ._models import NetworkInterfaceIpv4 + from ._models import NetworkInterfaceIpv6 + from ._models import OsDisk + from ._models import OsProfile + from ._models import PlanProperties + from ._models import PublicKeysProperties + from ._models import SecurityProfile + from ._models import StorageProfile + from ._models import StorageProfileResourceDisk + from ._models import SubnetProperties + from ._models import TagsProperties + from ._models import VirtualHardDisk +from ._instance_metadata_client_enums import ( + Error, + BypassCache, +) + +__all__ = [ + 'AttestedData', + 'Compute', + 'DataDisk', + 'DiffDiskSettings', + 'DiskImage', + 'EncryptionSettings', + 'ErrorResponse', 'ErrorResponseException', + 'IdentityErrorResponse', 'IdentityErrorResponseException', + 'IdentityInfoResponse', + 'IdentityTokenResponse', + 'ImageReference', + 'Instance', + 'Ipv4Properties', + 'Ipv6Properties', + 'ManagedDisk', + 'Network', + 'NetworkInterface', + 'NetworkInterfaceIpv4', + 'NetworkInterfaceIpv6', + 'OsDisk', + 'OsProfile', + 'PlanProperties', + 'PublicKeysProperties', + 'SecurityProfile', + 'StorageProfile', + 'StorageProfileResourceDisk', + 'SubnetProperties', + 'TagsProperties', + 'VirtualHardDisk', + 'Error', + 'BypassCache', +] diff --git a/sdk/azure-imds/azure/imds/models/_instance_metadata_client_enums.py b/sdk/azure-imds/azure/imds/models/_instance_metadata_client_enums.py new file mode 100644 index 0000000000000..5d29f6f5ca7b8 --- /dev/null +++ b/sdk/azure-imds/azure/imds/models/_instance_metadata_client_enums.py @@ -0,0 +1,33 @@ +# 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 enum import Enum + + +class Error(str, Enum): + + invalid_request = "invalid_request" + unauthorized_client = "unauthorized_client" + access_denied = "access_denied" + unsupported_response_type = "unsupported_response_type" + invalid_scope = "invalid_scope" + server_error = "server_error" + service_unavailable = "service_unavailable" + bad_request = "bad_request" + forbidden = "forbidden" + not_found = "not_found" + method_not_allowed = "method_not_allowed" + too_many_requests = "too_many_requests" + + +class BypassCache(str, Enum): + + true = "true" diff --git a/sdk/azure-imds/azure/imds/models/_models.py b/sdk/azure-imds/azure/imds/models/_models.py new file mode 100644 index 0000000000000..6cc9cadb76c02 --- /dev/null +++ b/sdk/azure-imds/azure/imds/models/_models.py @@ -0,0 +1,874 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class AttestedData(Model): + """This is the response from the Attested_GetDocument operation. + + :param signature: This is the encoded string containing the VM ID, SKU, + plan information, public key, timestamp, and nonce value. + :type signature: str + :param encoding: This is the encoding scheme of the signature. + :type encoding: str + """ + + _attribute_map = { + 'signature': {'key': 'signature', 'type': 'str'}, + 'encoding': {'key': 'encoding', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AttestedData, self).__init__(**kwargs) + self.signature = kwargs.get('signature', None) + self.encoding = kwargs.get('encoding', None) + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class Compute(Model): + """Compute Metadata. + + :param az_environment: This is the name of the environment in which the VM + is running. + :type az_environment: str + :param eviction_policy: Describes how the VM will be evicted if space + needs to be freed up. Only applicable to Spot VMs. For a non-spot VM, this + will be an empty string. + :type eviction_policy: str + :param is_host_compatibility_layer_vm: Identifies if the VM runs on the + Host Compatibility Layer. + :type is_host_compatibility_layer_vm: str + :param license_type: Type of license for Azure Hybrid Benefit. Note that + this is only present for AHB-enabled VMs. + :type license_type: str + :param location: This is the Azure Region in which the VM is running. + :type location: str + :param name: This is the name of the VM. + :type name: str + :param offer: This is the offer information for the VM image. This value + is only present for images deployed from the Azure Image Gallery. + :type offer: str + :param os_profile: This contains the data about the OS. + :type os_profile: ~azure.imds.models.OsProfile + :param os_type: This value indicates the type of OS the VM is running, + either Linux or Windows. + :type os_type: str + :param placement_group_id: This is the placement group of your Virtual + Machine Scale Set. + :type placement_group_id: str + :param plan: This contains the data about the plan. + :type plan: ~azure.imds.models.PlanProperties + :param public_keys: This is information about the SSH certificate + :type public_keys: list[~azure.imds.models.PublicKeysProperties] + :param platform_fault_domain: This is the fault domain in which the VM. + :type platform_fault_domain: str + :param platform_update_domain: This is the update domain in which the VM. + :type platform_update_domain: str + :param priority: This is the priority of the VM. + :type priority: str + :param provider: This is the provider of the VM. + :type provider: str + :param publisher: This is the publisher of the VM image. + :type publisher: str + :param resource_group_name: This is the resource group for the VM. + :type resource_group_name: str + :param resource_id: This is the fully qualified ID for the VM. + :type resource_id: str + :param security_profile: This contains the data about the security profile + associated with the VM. + :type security_profile: ~azure.imds.models.SecurityProfile + :param sku: This is the specific SKU for the VM image. + :type sku: str + :param storage_profile: This contains the data about the storage disks + associated with the VM. + :type storage_profile: ~azure.imds.models.StorageProfile + :param subscription_id: This is the Azure subscription for the VM. + :type subscription_id: str + :param tags: This is the list of tags for your VM. + :type tags: str + :param tags_list: This is the list of tags for your VM formatted as a JSON + array for easier programmatic parsing. + :type tags_list: list[~azure.imds.models.TagsProperties] + :param user_data: The set of data specified when the VM was created for + use during or after provisioning (Base64 encoded) + :type user_data: str + :param version: This is the version of the VM image. + :type version: str + :param vm_id: This is the unique identifier for the VM. + :type vm_id: str + :param vm_scale_set_name: This is the resource name of the VMSS. + :type vm_scale_set_name: str + :param vm_size: This is the size of the VM. + :type vm_size: str + :param zone: This is the availability zone of the VM. + :type zone: str + """ + + _attribute_map = { + 'az_environment': {'key': 'azEnvironment', 'type': 'str'}, + 'eviction_policy': {'key': 'evictionPolicy', 'type': 'str'}, + 'is_host_compatibility_layer_vm': {'key': 'isHostCompatibilityLayerVm', 'type': 'str'}, + 'license_type': {'key': 'licenseType', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'offer': {'key': 'offer', 'type': 'str'}, + 'os_profile': {'key': 'osProfile', 'type': 'OsProfile'}, + 'os_type': {'key': 'osType', 'type': 'str'}, + 'placement_group_id': {'key': 'placementGroupId', 'type': 'str'}, + 'plan': {'key': 'plan', 'type': 'PlanProperties'}, + 'public_keys': {'key': 'publicKeys', 'type': '[PublicKeysProperties]'}, + 'platform_fault_domain': {'key': 'platformFaultDomain', 'type': 'str'}, + 'platform_update_domain': {'key': 'platformUpdateDomain', 'type': 'str'}, + 'priority': {'key': 'priority', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'resource_group_name': {'key': 'resourceGroupName', 'type': 'str'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'security_profile': {'key': 'securityProfile', 'type': 'SecurityProfile'}, + 'sku': {'key': 'sku', 'type': 'str'}, + 'storage_profile': {'key': 'storageProfile', 'type': 'StorageProfile'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': 'str'}, + 'tags_list': {'key': 'tagsList', 'type': '[TagsProperties]'}, + 'user_data': {'key': 'userData', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'vm_id': {'key': 'vmId', 'type': 'str'}, + 'vm_scale_set_name': {'key': 'vmScaleSetName', 'type': 'str'}, + 'vm_size': {'key': 'vmSize', 'type': 'str'}, + 'zone': {'key': 'zone', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Compute, self).__init__(**kwargs) + self.az_environment = kwargs.get('az_environment', None) + self.eviction_policy = kwargs.get('eviction_policy', None) + self.is_host_compatibility_layer_vm = kwargs.get('is_host_compatibility_layer_vm', None) + self.license_type = kwargs.get('license_type', None) + self.location = kwargs.get('location', None) + self.name = kwargs.get('name', None) + self.offer = kwargs.get('offer', None) + self.os_profile = kwargs.get('os_profile', None) + self.os_type = kwargs.get('os_type', None) + self.placement_group_id = kwargs.get('placement_group_id', None) + self.plan = kwargs.get('plan', None) + self.public_keys = kwargs.get('public_keys', None) + self.platform_fault_domain = kwargs.get('platform_fault_domain', None) + self.platform_update_domain = kwargs.get('platform_update_domain', None) + self.priority = kwargs.get('priority', None) + self.provider = kwargs.get('provider', None) + self.publisher = kwargs.get('publisher', None) + self.resource_group_name = kwargs.get('resource_group_name', None) + self.resource_id = kwargs.get('resource_id', None) + self.security_profile = kwargs.get('security_profile', None) + self.sku = kwargs.get('sku', None) + self.storage_profile = kwargs.get('storage_profile', None) + self.subscription_id = kwargs.get('subscription_id', None) + self.tags = kwargs.get('tags', None) + self.tags_list = kwargs.get('tags_list', None) + self.user_data = kwargs.get('user_data', None) + self.version = kwargs.get('version', None) + self.vm_id = kwargs.get('vm_id', None) + self.vm_scale_set_name = kwargs.get('vm_scale_set_name', None) + self.vm_size = kwargs.get('vm_size', None) + self.zone = kwargs.get('zone', None) + + +class DataDisk(Model): + """This contains information about the data disk. + + :param caching: This is the caching requirements. + :type caching: str + :param create_option: This is information about how the VM was created. + :type create_option: str + :param disk_size_gb: This is the size of the disk in GB. + :type disk_size_gb: str + :param image: This is the source user image virtual hard disk. + :type image: ~azure.imds.models.DiskImage + :param lun: This is the logical unit number of the disk. + :type lun: str + :param managed_disk: This is managed disk parameters. + :type managed_disk: ~azure.imds.models.ManagedDisk + :param name: This is the disk name. + :type name: str + :param vhd: This is the virtual hard disk. + :type vhd: ~azure.imds.models.VirtualHardDisk + :param write_accelerator_enabled: This specifies whether or not + writeAccelerator is enabled on the disk. + :type write_accelerator_enabled: str + """ + + _attribute_map = { + 'caching': {'key': 'caching', 'type': 'str'}, + 'create_option': {'key': 'createOption', 'type': 'str'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'str'}, + 'image': {'key': 'image', 'type': 'DiskImage'}, + 'lun': {'key': 'lun', 'type': 'str'}, + 'managed_disk': {'key': 'managedDisk', 'type': 'ManagedDisk'}, + 'name': {'key': 'name', 'type': 'str'}, + 'vhd': {'key': 'vhd', 'type': 'VirtualHardDisk'}, + 'write_accelerator_enabled': {'key': 'writeAcceleratorEnabled', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DataDisk, self).__init__(**kwargs) + self.caching = kwargs.get('caching', None) + self.create_option = kwargs.get('create_option', None) + self.disk_size_gb = kwargs.get('disk_size_gb', None) + self.image = kwargs.get('image', None) + self.lun = kwargs.get('lun', None) + self.managed_disk = kwargs.get('managed_disk', None) + self.name = kwargs.get('name', None) + self.vhd = kwargs.get('vhd', None) + self.write_accelerator_enabled = kwargs.get('write_accelerator_enabled', None) + + +class DiffDiskSettings(Model): + """This is the ephemeral disk settings. + + :param option: This specifies the ephemeral disk settings. + :type option: str + """ + + _attribute_map = { + 'option': {'key': 'option', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DiffDiskSettings, self).__init__(**kwargs) + self.option = kwargs.get('option', None) + + +class DiskImage(Model): + """This is the source user image virtual hard disk. + + :param uri: This is the uri of the virtual hard disk. + :type uri: str + """ + + _attribute_map = { + 'uri': {'key': 'uri', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DiskImage, self).__init__(**kwargs) + self.uri = kwargs.get('uri', None) + + +class EncryptionSettings(Model): + """This is the encryption settings for the disk. + + :param enabled: This specifies whether or not disk encryption is enabled + on the VM. + :type enabled: str + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(EncryptionSettings, self).__init__(**kwargs) + self.enabled = kwargs.get('enabled', None) + + +class ErrorResponse(Model): + """This is the response from an operation in the case an error occurs. + + :param error: Error message indicating why the operation failed. + :type error: str + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class IdentityErrorResponse(Model): + """This is the response from an Identity operation in the case an error + occurs. + + :param error: Error code. Possible values include: 'invalid_request', + 'unauthorized_client', 'access_denied', 'unsupported_response_type', + 'invalid_scope', 'server_error', 'service_unavailable', 'bad_request', + 'forbidden', 'not_found', 'method_not_allowed', 'too_many_requests' + :type error: str or ~azure.imds.models.Error + :param error_description: Error message indicating why the operation + failed. + :type error_description: str + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'str'}, + 'error_description': {'key': 'error_description', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(IdentityErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + self.error_description = kwargs.get('error_description', None) + + +class IdentityErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'IdentityErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(IdentityErrorResponseException, self).__init__(deserialize, response, 'IdentityErrorResponse', *args) + + +class IdentityInfoResponse(Model): + """This is the response from the Identity_GetInfo operation. + + :param tenant_id: This is the AAD tenantId of the identity of the system + assigned managed identity. + :type tenant_id: str + """ + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(IdentityInfoResponse, self).__init__(**kwargs) + self.tenant_id = kwargs.get('tenant_id', None) + + +class IdentityTokenResponse(Model): + """This is the response from the Identity_GetToken operation. + + :param access_token: This is the requested access token. The app can use + this token to authenticate to the sink resource. + :type access_token: str + :param expires_in: This is how long the access token is valid (in + seconds). + :type expires_in: str + :param expires_on: This is the time when the access token expires. The + date is represented as the number of seconds from 1970-01-01T0:0:0Z UTC + until the expiration time. This value is used to determine the lifetime of + cached tokens. + :type expires_on: str + :param ext_expires_in: This indicates the extended lifetime of the token + (in seconds). + :type ext_expires_in: str + :param not_before: This is the time when the access token becomes + effective. The date is represented as the number of seconds from + 1970-01-01T0:0:0Z UTC until the expiration time. + :type not_before: str + :param resource: This is the app ID URI of the sink resource. + :type resource: str + :param token_type: This indicates the token type value. + :type token_type: str + :param client_id: This is the client_id specified in the request, if any. + :type client_id: str + :param object_id: This is the object_id specified in the request, if any. + :type object_id: str + :param msi_res_id: This is the msi_res_id specified in the request, if + any. + :type msi_res_id: str + """ + + _attribute_map = { + 'access_token': {'key': 'access_token', 'type': 'str'}, + 'expires_in': {'key': 'expires_in', 'type': 'str'}, + 'expires_on': {'key': 'expires_on', 'type': 'str'}, + 'ext_expires_in': {'key': 'ext_expires_in', 'type': 'str'}, + 'not_before': {'key': 'not_before', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'token_type': {'key': 'token_type', 'type': 'str'}, + 'client_id': {'key': 'client_id', 'type': 'str'}, + 'object_id': {'key': 'object_id', 'type': 'str'}, + 'msi_res_id': {'key': 'msi_res_id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(IdentityTokenResponse, self).__init__(**kwargs) + self.access_token = kwargs.get('access_token', None) + self.expires_in = kwargs.get('expires_in', None) + self.expires_on = kwargs.get('expires_on', None) + self.ext_expires_in = kwargs.get('ext_expires_in', None) + self.not_before = kwargs.get('not_before', None) + self.resource = kwargs.get('resource', None) + self.token_type = kwargs.get('token_type', None) + self.client_id = kwargs.get('client_id', None) + self.object_id = kwargs.get('object_id', None) + self.msi_res_id = kwargs.get('msi_res_id', None) + + +class ImageReference(Model): + """This contains information about the OS image. + + :param id: This is the resource ID. + :type id: str + :param offer: This is the offer of the platform or marketplace image. + :type offer: str + :param publisher: This is the image publisher. + :type publisher: str + :param sku: This is the image SKU. + :type sku: str + :param version: This is the version of the platform or marketplace image. + :type version: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'offer': {'key': 'offer', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ImageReference, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.offer = kwargs.get('offer', None) + self.publisher = kwargs.get('publisher', None) + self.sku = kwargs.get('sku', None) + self.version = kwargs.get('version', None) + + +class Instance(Model): + """This is the response from the Instance_GetMetadata operation. + + :param compute: Compute Metadata + :type compute: ~azure.imds.models.Compute + :param network: Network Metadata + :type network: ~azure.imds.models.Network + """ + + _attribute_map = { + 'compute': {'key': 'compute', 'type': 'Compute'}, + 'network': {'key': 'network', 'type': 'Network'}, + } + + def __init__(self, **kwargs): + super(Instance, self).__init__(**kwargs) + self.compute = kwargs.get('compute', None) + self.network = kwargs.get('network', None) + + +class Ipv4Properties(Model): + """This contains the IPv4 properties. + + :param private_ip_address: This is the private IP address assigned to the + interface. + :type private_ip_address: str + :param public_ip_address: This is the public IP address assigned to the + interface. + :type public_ip_address: str + """ + + _attribute_map = { + 'private_ip_address': {'key': 'privateIpAddress', 'type': 'str'}, + 'public_ip_address': {'key': 'publicIpAddress', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Ipv4Properties, self).__init__(**kwargs) + self.private_ip_address = kwargs.get('private_ip_address', None) + self.public_ip_address = kwargs.get('public_ip_address', None) + + +class Ipv6Properties(Model): + """This contains the IPv6 properties. + + :param private_ip_address: This is the private IPv6 address assigned to + the interface. + :type private_ip_address: str + """ + + _attribute_map = { + 'private_ip_address': {'key': 'privateIpAddress', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Ipv6Properties, self).__init__(**kwargs) + self.private_ip_address = kwargs.get('private_ip_address', None) + + +class ManagedDisk(Model): + """This is managed disk parameters. + + :param id: This is the resource ID. + :type id: str + :param storage_account_type: This is the storage account type for the + managed disk. + :type storage_account_type: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ManagedDisk, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.storage_account_type = kwargs.get('storage_account_type', None) + + +class Network(Model): + """Network Metadata. + + :param interface: This contains data about the network interface. + :type interface: list[~azure.imds.models.NetworkInterface] + """ + + _attribute_map = { + 'interface': {'key': 'interface', 'type': '[NetworkInterface]'}, + } + + def __init__(self, **kwargs): + super(Network, self).__init__(**kwargs) + self.interface = kwargs.get('interface', None) + + +class NetworkInterface(Model): + """This contains data about the network interface. + + :param ipv4: This contains the IPv4 address. + :type ipv4: ~azure.imds.models.NetworkInterfaceIpv4 + :param ipv6: This contains the IPv6 address. + :type ipv6: ~azure.imds.models.NetworkInterfaceIpv6 + :param mac_address: This is the MAC address of the interface. + :type mac_address: str + """ + + _attribute_map = { + 'ipv4': {'key': 'ipv4', 'type': 'NetworkInterfaceIpv4'}, + 'ipv6': {'key': 'ipv6', 'type': 'NetworkInterfaceIpv6'}, + 'mac_address': {'key': 'macAddress', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(NetworkInterface, self).__init__(**kwargs) + self.ipv4 = kwargs.get('ipv4', None) + self.ipv6 = kwargs.get('ipv6', None) + self.mac_address = kwargs.get('mac_address', None) + + +class NetworkInterfaceIpv4(Model): + """This contains the IPv4 address. + + :param ip_address: This is the IP address + :type ip_address: list[~azure.imds.models.Ipv4Properties] + :param subnet: This is the subnet + :type subnet: list[~azure.imds.models.SubnetProperties] + """ + + _attribute_map = { + 'ip_address': {'key': 'ipAddress', 'type': '[Ipv4Properties]'}, + 'subnet': {'key': 'subnet', 'type': '[SubnetProperties]'}, + } + + def __init__(self, **kwargs): + super(NetworkInterfaceIpv4, self).__init__(**kwargs) + self.ip_address = kwargs.get('ip_address', None) + self.subnet = kwargs.get('subnet', None) + + +class NetworkInterfaceIpv6(Model): + """This contains the IPv6 address. + + :param ip_address: This is the IP address + :type ip_address: list[~azure.imds.models.Ipv6Properties] + """ + + _attribute_map = { + 'ip_address': {'key': 'ipAddress', 'type': '[Ipv6Properties]'}, + } + + def __init__(self, **kwargs): + super(NetworkInterfaceIpv6, self).__init__(**kwargs) + self.ip_address = kwargs.get('ip_address', None) + + +class OsDisk(Model): + """This contains information about the OS disk used by the VM. + + :param caching: This is the caching requirements. + :type caching: str + :param create_option: This is information about how the VM was created. + :type create_option: str + :param diff_disk_settings: This is the ephemeral disk settings. + :type diff_disk_settings: ~azure.imds.models.DiffDiskSettings + :param disk_size_gb: This is the size of the disk in GB. + :type disk_size_gb: str + :param encryption_settings: This is the encryption settings for the disk. + :type encryption_settings: ~azure.imds.models.EncryptionSettings + :param image: This is the source user image virtual hard disk. + :type image: ~azure.imds.models.DiskImage + :param managed_disk: This is managed disk parameters. + :type managed_disk: ~azure.imds.models.ManagedDisk + :param name: This is the disk name. + :type name: str + :param os_type: This is the type of OS included in the disk. + :type os_type: str + :param vhd: This is the virtual hard disk. + :type vhd: ~azure.imds.models.VirtualHardDisk + :param write_accelerator_enabled: This specifies whether or not + writeAccelerator is enabled on the disk. + :type write_accelerator_enabled: str + """ + + _attribute_map = { + 'caching': {'key': 'caching', 'type': 'str'}, + 'create_option': {'key': 'createOption', 'type': 'str'}, + 'diff_disk_settings': {'key': 'diffDiskSettings', 'type': 'DiffDiskSettings'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'str'}, + 'encryption_settings': {'key': 'encryptionSettings', 'type': 'EncryptionSettings'}, + 'image': {'key': 'image', 'type': 'DiskImage'}, + 'managed_disk': {'key': 'managedDisk', 'type': 'ManagedDisk'}, + 'name': {'key': 'name', 'type': 'str'}, + 'os_type': {'key': 'osType', 'type': 'str'}, + 'vhd': {'key': 'vhd', 'type': 'VirtualHardDisk'}, + 'write_accelerator_enabled': {'key': 'writeAcceleratorEnabled', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(OsDisk, self).__init__(**kwargs) + self.caching = kwargs.get('caching', None) + self.create_option = kwargs.get('create_option', None) + self.diff_disk_settings = kwargs.get('diff_disk_settings', None) + self.disk_size_gb = kwargs.get('disk_size_gb', None) + self.encryption_settings = kwargs.get('encryption_settings', None) + self.image = kwargs.get('image', None) + self.managed_disk = kwargs.get('managed_disk', None) + self.name = kwargs.get('name', None) + self.os_type = kwargs.get('os_type', None) + self.vhd = kwargs.get('vhd', None) + self.write_accelerator_enabled = kwargs.get('write_accelerator_enabled', None) + + +class OsProfile(Model): + """This contains the data about the OS. + + :param admin_username: This is admin account. + :type admin_username: str + :param computer_name: This is the name of the VM. + :type computer_name: str + :param disable_password_authentication: This specifies whether or not + password authentication is disabled. Note that this is present only for + Linux VMs. For a Windows VM, this value will be the empty string. + :type disable_password_authentication: str + """ + + _attribute_map = { + 'admin_username': {'key': 'adminUsername', 'type': 'str'}, + 'computer_name': {'key': 'computerName', 'type': 'str'}, + 'disable_password_authentication': {'key': 'disablePasswordAuthentication', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(OsProfile, self).__init__(**kwargs) + self.admin_username = kwargs.get('admin_username', None) + self.computer_name = kwargs.get('computer_name', None) + self.disable_password_authentication = kwargs.get('disable_password_authentication', None) + + +class PlanProperties(Model): + """This contains the data about the plan. + + :param name: This is the Plan ID. + :type name: str + :param publisher: This is the publisher ID. + :type publisher: str + :param product: This is the product of the image from the Marketplace. + :type product: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PlanProperties, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.publisher = kwargs.get('publisher', None) + self.product = kwargs.get('product', None) + + +class PublicKeysProperties(Model): + """This contains the data about the public key. + + :param path: This specifies the full path on the VM where the SSH public + key is stored. + :type path: str + :param key_data: This is the SSH public key certificate used to + authenticate with the VM. + :type key_data: str + """ + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'key_data': {'key': 'keyData', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PublicKeysProperties, self).__init__(**kwargs) + self.path = kwargs.get('path', None) + self.key_data = kwargs.get('key_data', None) + + +class SecurityProfile(Model): + """This contains the data about the security profile associated with the VM. + + :param secure_boot_enabled: Identifies if UEFI secure boot is enabled on + the VM + :type secure_boot_enabled: str + :param virtual_tpm_enabled: Identifies if the virtual Trusted Platform + Module (TPM) is enabled on the VM + :type virtual_tpm_enabled: str + """ + + _attribute_map = { + 'secure_boot_enabled': {'key': 'secureBootEnabled', 'type': 'str'}, + 'virtual_tpm_enabled': {'key': 'virtualTpmEnabled', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SecurityProfile, self).__init__(**kwargs) + self.secure_boot_enabled = kwargs.get('secure_boot_enabled', None) + self.virtual_tpm_enabled = kwargs.get('virtual_tpm_enabled', None) + + +class StorageProfile(Model): + """This contains the data about the storage disks associated with the VM. + + :param image_reference: Image information + :type image_reference: ~azure.imds.models.ImageReference + :param os_disk: OS disk information + :type os_disk: ~azure.imds.models.OsDisk + :param data_disks: Data disk information + :type data_disks: list[~azure.imds.models.DataDisk] + :param resource_disk: This contains data for the size of local temp disk + of the VM, if it exists. + :type resource_disk: ~azure.imds.models.StorageProfileResourceDisk + """ + + _attribute_map = { + 'image_reference': {'key': 'imageReference', 'type': 'ImageReference'}, + 'os_disk': {'key': 'osDisk', 'type': 'OsDisk'}, + 'data_disks': {'key': 'dataDisks', 'type': '[DataDisk]'}, + 'resource_disk': {'key': 'resourceDisk', 'type': 'StorageProfileResourceDisk'}, + } + + def __init__(self, **kwargs): + super(StorageProfile, self).__init__(**kwargs) + self.image_reference = kwargs.get('image_reference', None) + self.os_disk = kwargs.get('os_disk', None) + self.data_disks = kwargs.get('data_disks', None) + self.resource_disk = kwargs.get('resource_disk', None) + + +class StorageProfileResourceDisk(Model): + """This contains data for the size of local temp disk of the VM, if it exists. + + :param size: The size of the local temp disk of the VM if it exists, in + kilobytes. If the VM has no local temp disk, this value is 0. + :type size: str + """ + + _attribute_map = { + 'size': {'key': 'size', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(StorageProfileResourceDisk, self).__init__(**kwargs) + self.size = kwargs.get('size', None) + + +class SubnetProperties(Model): + """This contains the properties of the subnet. + + :param address: This is the address range of the subnet. + :type address: str + :param prefix: This is the prefix of the subnet. + :type prefix: str + """ + + _attribute_map = { + 'address': {'key': 'address', 'type': 'str'}, + 'prefix': {'key': 'prefix', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SubnetProperties, self).__init__(**kwargs) + self.address = kwargs.get('address', None) + self.prefix = kwargs.get('prefix', None) + + +class TagsProperties(Model): + """This contains the properties of the tags in a tagsList. + + :param name: This is the name of the tag. It is equivalent to the key in + the key-value pair format. + :type name: str + :param value: This is the value of the tag. It is, as expected, equivalent + to the value in the key-value pair format. + :type value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(TagsProperties, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.value = kwargs.get('value', None) + + +class VirtualHardDisk(Model): + """This is the virtual hard disk. + + :param uri: This is the uri of the virtual hard disk. + :type uri: str + """ + + _attribute_map = { + 'uri': {'key': 'uri', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(VirtualHardDisk, self).__init__(**kwargs) + self.uri = kwargs.get('uri', None) diff --git a/sdk/azure-imds/azure/imds/models/_models_py3.py b/sdk/azure-imds/azure/imds/models/_models_py3.py new file mode 100644 index 0000000000000..c934087791f54 --- /dev/null +++ b/sdk/azure-imds/azure/imds/models/_models_py3.py @@ -0,0 +1,874 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class AttestedData(Model): + """This is the response from the Attested_GetDocument operation. + + :param signature: This is the encoded string containing the VM ID, SKU, + plan information, public key, timestamp, and nonce value. + :type signature: str + :param encoding: This is the encoding scheme of the signature. + :type encoding: str + """ + + _attribute_map = { + 'signature': {'key': 'signature', 'type': 'str'}, + 'encoding': {'key': 'encoding', 'type': 'str'}, + } + + def __init__(self, *, signature: str=None, encoding: str=None, **kwargs) -> None: + super(AttestedData, self).__init__(**kwargs) + self.signature = signature + self.encoding = encoding + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +class Compute(Model): + """Compute Metadata. + + :param az_environment: This is the name of the environment in which the VM + is running. + :type az_environment: str + :param eviction_policy: Describes how the VM will be evicted if space + needs to be freed up. Only applicable to Spot VMs. For a non-spot VM, this + will be an empty string. + :type eviction_policy: str + :param is_host_compatibility_layer_vm: Identifies if the VM runs on the + Host Compatibility Layer. + :type is_host_compatibility_layer_vm: str + :param license_type: Type of license for Azure Hybrid Benefit. Note that + this is only present for AHB-enabled VMs. + :type license_type: str + :param location: This is the Azure Region in which the VM is running. + :type location: str + :param name: This is the name of the VM. + :type name: str + :param offer: This is the offer information for the VM image. This value + is only present for images deployed from the Azure Image Gallery. + :type offer: str + :param os_profile: This contains the data about the OS. + :type os_profile: ~azure.imds.models.OsProfile + :param os_type: This value indicates the type of OS the VM is running, + either Linux or Windows. + :type os_type: str + :param placement_group_id: This is the placement group of your Virtual + Machine Scale Set. + :type placement_group_id: str + :param plan: This contains the data about the plan. + :type plan: ~azure.imds.models.PlanProperties + :param public_keys: This is information about the SSH certificate + :type public_keys: list[~azure.imds.models.PublicKeysProperties] + :param platform_fault_domain: This is the fault domain in which the VM. + :type platform_fault_domain: str + :param platform_update_domain: This is the update domain in which the VM. + :type platform_update_domain: str + :param priority: This is the priority of the VM. + :type priority: str + :param provider: This is the provider of the VM. + :type provider: str + :param publisher: This is the publisher of the VM image. + :type publisher: str + :param resource_group_name: This is the resource group for the VM. + :type resource_group_name: str + :param resource_id: This is the fully qualified ID for the VM. + :type resource_id: str + :param security_profile: This contains the data about the security profile + associated with the VM. + :type security_profile: ~azure.imds.models.SecurityProfile + :param sku: This is the specific SKU for the VM image. + :type sku: str + :param storage_profile: This contains the data about the storage disks + associated with the VM. + :type storage_profile: ~azure.imds.models.StorageProfile + :param subscription_id: This is the Azure subscription for the VM. + :type subscription_id: str + :param tags: This is the list of tags for your VM. + :type tags: str + :param tags_list: This is the list of tags for your VM formatted as a JSON + array for easier programmatic parsing. + :type tags_list: list[~azure.imds.models.TagsProperties] + :param user_data: The set of data specified when the VM was created for + use during or after provisioning (Base64 encoded) + :type user_data: str + :param version: This is the version of the VM image. + :type version: str + :param vm_id: This is the unique identifier for the VM. + :type vm_id: str + :param vm_scale_set_name: This is the resource name of the VMSS. + :type vm_scale_set_name: str + :param vm_size: This is the size of the VM. + :type vm_size: str + :param zone: This is the availability zone of the VM. + :type zone: str + """ + + _attribute_map = { + 'az_environment': {'key': 'azEnvironment', 'type': 'str'}, + 'eviction_policy': {'key': 'evictionPolicy', 'type': 'str'}, + 'is_host_compatibility_layer_vm': {'key': 'isHostCompatibilityLayerVm', 'type': 'str'}, + 'license_type': {'key': 'licenseType', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'offer': {'key': 'offer', 'type': 'str'}, + 'os_profile': {'key': 'osProfile', 'type': 'OsProfile'}, + 'os_type': {'key': 'osType', 'type': 'str'}, + 'placement_group_id': {'key': 'placementGroupId', 'type': 'str'}, + 'plan': {'key': 'plan', 'type': 'PlanProperties'}, + 'public_keys': {'key': 'publicKeys', 'type': '[PublicKeysProperties]'}, + 'platform_fault_domain': {'key': 'platformFaultDomain', 'type': 'str'}, + 'platform_update_domain': {'key': 'platformUpdateDomain', 'type': 'str'}, + 'priority': {'key': 'priority', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'resource_group_name': {'key': 'resourceGroupName', 'type': 'str'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'security_profile': {'key': 'securityProfile', 'type': 'SecurityProfile'}, + 'sku': {'key': 'sku', 'type': 'str'}, + 'storage_profile': {'key': 'storageProfile', 'type': 'StorageProfile'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': 'str'}, + 'tags_list': {'key': 'tagsList', 'type': '[TagsProperties]'}, + 'user_data': {'key': 'userData', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'vm_id': {'key': 'vmId', 'type': 'str'}, + 'vm_scale_set_name': {'key': 'vmScaleSetName', 'type': 'str'}, + 'vm_size': {'key': 'vmSize', 'type': 'str'}, + 'zone': {'key': 'zone', 'type': 'str'}, + } + + def __init__(self, *, az_environment: str=None, eviction_policy: str=None, is_host_compatibility_layer_vm: str=None, license_type: str=None, location: str=None, name: str=None, offer: str=None, os_profile=None, os_type: str=None, placement_group_id: str=None, plan=None, public_keys=None, platform_fault_domain: str=None, platform_update_domain: str=None, priority: str=None, provider: str=None, publisher: str=None, resource_group_name: str=None, resource_id: str=None, security_profile=None, sku: str=None, storage_profile=None, subscription_id: str=None, tags: str=None, tags_list=None, user_data: str=None, version: str=None, vm_id: str=None, vm_scale_set_name: str=None, vm_size: str=None, zone: str=None, **kwargs) -> None: + super(Compute, self).__init__(**kwargs) + self.az_environment = az_environment + self.eviction_policy = eviction_policy + self.is_host_compatibility_layer_vm = is_host_compatibility_layer_vm + self.license_type = license_type + self.location = location + self.name = name + self.offer = offer + self.os_profile = os_profile + self.os_type = os_type + self.placement_group_id = placement_group_id + self.plan = plan + self.public_keys = public_keys + self.platform_fault_domain = platform_fault_domain + self.platform_update_domain = platform_update_domain + self.priority = priority + self.provider = provider + self.publisher = publisher + self.resource_group_name = resource_group_name + self.resource_id = resource_id + self.security_profile = security_profile + self.sku = sku + self.storage_profile = storage_profile + self.subscription_id = subscription_id + self.tags = tags + self.tags_list = tags_list + self.user_data = user_data + self.version = version + self.vm_id = vm_id + self.vm_scale_set_name = vm_scale_set_name + self.vm_size = vm_size + self.zone = zone + + +class DataDisk(Model): + """This contains information about the data disk. + + :param caching: This is the caching requirements. + :type caching: str + :param create_option: This is information about how the VM was created. + :type create_option: str + :param disk_size_gb: This is the size of the disk in GB. + :type disk_size_gb: str + :param image: This is the source user image virtual hard disk. + :type image: ~azure.imds.models.DiskImage + :param lun: This is the logical unit number of the disk. + :type lun: str + :param managed_disk: This is managed disk parameters. + :type managed_disk: ~azure.imds.models.ManagedDisk + :param name: This is the disk name. + :type name: str + :param vhd: This is the virtual hard disk. + :type vhd: ~azure.imds.models.VirtualHardDisk + :param write_accelerator_enabled: This specifies whether or not + writeAccelerator is enabled on the disk. + :type write_accelerator_enabled: str + """ + + _attribute_map = { + 'caching': {'key': 'caching', 'type': 'str'}, + 'create_option': {'key': 'createOption', 'type': 'str'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'str'}, + 'image': {'key': 'image', 'type': 'DiskImage'}, + 'lun': {'key': 'lun', 'type': 'str'}, + 'managed_disk': {'key': 'managedDisk', 'type': 'ManagedDisk'}, + 'name': {'key': 'name', 'type': 'str'}, + 'vhd': {'key': 'vhd', 'type': 'VirtualHardDisk'}, + 'write_accelerator_enabled': {'key': 'writeAcceleratorEnabled', 'type': 'str'}, + } + + def __init__(self, *, caching: str=None, create_option: str=None, disk_size_gb: str=None, image=None, lun: str=None, managed_disk=None, name: str=None, vhd=None, write_accelerator_enabled: str=None, **kwargs) -> None: + super(DataDisk, self).__init__(**kwargs) + self.caching = caching + self.create_option = create_option + self.disk_size_gb = disk_size_gb + self.image = image + self.lun = lun + self.managed_disk = managed_disk + self.name = name + self.vhd = vhd + self.write_accelerator_enabled = write_accelerator_enabled + + +class DiffDiskSettings(Model): + """This is the ephemeral disk settings. + + :param option: This specifies the ephemeral disk settings. + :type option: str + """ + + _attribute_map = { + 'option': {'key': 'option', 'type': 'str'}, + } + + def __init__(self, *, option: str=None, **kwargs) -> None: + super(DiffDiskSettings, self).__init__(**kwargs) + self.option = option + + +class DiskImage(Model): + """This is the source user image virtual hard disk. + + :param uri: This is the uri of the virtual hard disk. + :type uri: str + """ + + _attribute_map = { + 'uri': {'key': 'uri', 'type': 'str'}, + } + + def __init__(self, *, uri: str=None, **kwargs) -> None: + super(DiskImage, self).__init__(**kwargs) + self.uri = uri + + +class EncryptionSettings(Model): + """This is the encryption settings for the disk. + + :param enabled: This specifies whether or not disk encryption is enabled + on the VM. + :type enabled: str + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'str'}, + } + + def __init__(self, *, enabled: str=None, **kwargs) -> None: + super(EncryptionSettings, self).__init__(**kwargs) + self.enabled = enabled + + +class ErrorResponse(Model): + """This is the response from an operation in the case an error occurs. + + :param error: Error message indicating why the operation failed. + :type error: str + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'str'}, + } + + def __init__(self, *, error: str=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class IdentityErrorResponse(Model): + """This is the response from an Identity operation in the case an error + occurs. + + :param error: Error code. Possible values include: 'invalid_request', + 'unauthorized_client', 'access_denied', 'unsupported_response_type', + 'invalid_scope', 'server_error', 'service_unavailable', 'bad_request', + 'forbidden', 'not_found', 'method_not_allowed', 'too_many_requests' + :type error: str or ~azure.imds.models.Error + :param error_description: Error message indicating why the operation + failed. + :type error_description: str + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'str'}, + 'error_description': {'key': 'error_description', 'type': 'str'}, + } + + def __init__(self, *, error=None, error_description: str=None, **kwargs) -> None: + super(IdentityErrorResponse, self).__init__(**kwargs) + self.error = error + self.error_description = error_description + + +class IdentityErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'IdentityErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(IdentityErrorResponseException, self).__init__(deserialize, response, 'IdentityErrorResponse', *args) + + +class IdentityInfoResponse(Model): + """This is the response from the Identity_GetInfo operation. + + :param tenant_id: This is the AAD tenantId of the identity of the system + assigned managed identity. + :type tenant_id: str + """ + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + } + + def __init__(self, *, tenant_id: str=None, **kwargs) -> None: + super(IdentityInfoResponse, self).__init__(**kwargs) + self.tenant_id = tenant_id + + +class IdentityTokenResponse(Model): + """This is the response from the Identity_GetToken operation. + + :param access_token: This is the requested access token. The app can use + this token to authenticate to the sink resource. + :type access_token: str + :param expires_in: This is how long the access token is valid (in + seconds). + :type expires_in: str + :param expires_on: This is the time when the access token expires. The + date is represented as the number of seconds from 1970-01-01T0:0:0Z UTC + until the expiration time. This value is used to determine the lifetime of + cached tokens. + :type expires_on: str + :param ext_expires_in: This indicates the extended lifetime of the token + (in seconds). + :type ext_expires_in: str + :param not_before: This is the time when the access token becomes + effective. The date is represented as the number of seconds from + 1970-01-01T0:0:0Z UTC until the expiration time. + :type not_before: str + :param resource: This is the app ID URI of the sink resource. + :type resource: str + :param token_type: This indicates the token type value. + :type token_type: str + :param client_id: This is the client_id specified in the request, if any. + :type client_id: str + :param object_id: This is the object_id specified in the request, if any. + :type object_id: str + :param msi_res_id: This is the msi_res_id specified in the request, if + any. + :type msi_res_id: str + """ + + _attribute_map = { + 'access_token': {'key': 'access_token', 'type': 'str'}, + 'expires_in': {'key': 'expires_in', 'type': 'str'}, + 'expires_on': {'key': 'expires_on', 'type': 'str'}, + 'ext_expires_in': {'key': 'ext_expires_in', 'type': 'str'}, + 'not_before': {'key': 'not_before', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'token_type': {'key': 'token_type', 'type': 'str'}, + 'client_id': {'key': 'client_id', 'type': 'str'}, + 'object_id': {'key': 'object_id', 'type': 'str'}, + 'msi_res_id': {'key': 'msi_res_id', 'type': 'str'}, + } + + def __init__(self, *, access_token: str=None, expires_in: str=None, expires_on: str=None, ext_expires_in: str=None, not_before: str=None, resource: str=None, token_type: str=None, client_id: str=None, object_id: str=None, msi_res_id: str=None, **kwargs) -> None: + super(IdentityTokenResponse, self).__init__(**kwargs) + self.access_token = access_token + self.expires_in = expires_in + self.expires_on = expires_on + self.ext_expires_in = ext_expires_in + self.not_before = not_before + self.resource = resource + self.token_type = token_type + self.client_id = client_id + self.object_id = object_id + self.msi_res_id = msi_res_id + + +class ImageReference(Model): + """This contains information about the OS image. + + :param id: This is the resource ID. + :type id: str + :param offer: This is the offer of the platform or marketplace image. + :type offer: str + :param publisher: This is the image publisher. + :type publisher: str + :param sku: This is the image SKU. + :type sku: str + :param version: This is the version of the platform or marketplace image. + :type version: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'offer': {'key': 'offer', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__(self, *, id: str=None, offer: str=None, publisher: str=None, sku: str=None, version: str=None, **kwargs) -> None: + super(ImageReference, self).__init__(**kwargs) + self.id = id + self.offer = offer + self.publisher = publisher + self.sku = sku + self.version = version + + +class Instance(Model): + """This is the response from the Instance_GetMetadata operation. + + :param compute: Compute Metadata + :type compute: ~azure.imds.models.Compute + :param network: Network Metadata + :type network: ~azure.imds.models.Network + """ + + _attribute_map = { + 'compute': {'key': 'compute', 'type': 'Compute'}, + 'network': {'key': 'network', 'type': 'Network'}, + } + + def __init__(self, *, compute=None, network=None, **kwargs) -> None: + super(Instance, self).__init__(**kwargs) + self.compute = compute + self.network = network + + +class Ipv4Properties(Model): + """This contains the IPv4 properties. + + :param private_ip_address: This is the private IP address assigned to the + interface. + :type private_ip_address: str + :param public_ip_address: This is the public IP address assigned to the + interface. + :type public_ip_address: str + """ + + _attribute_map = { + 'private_ip_address': {'key': 'privateIpAddress', 'type': 'str'}, + 'public_ip_address': {'key': 'publicIpAddress', 'type': 'str'}, + } + + def __init__(self, *, private_ip_address: str=None, public_ip_address: str=None, **kwargs) -> None: + super(Ipv4Properties, self).__init__(**kwargs) + self.private_ip_address = private_ip_address + self.public_ip_address = public_ip_address + + +class Ipv6Properties(Model): + """This contains the IPv6 properties. + + :param private_ip_address: This is the private IPv6 address assigned to + the interface. + :type private_ip_address: str + """ + + _attribute_map = { + 'private_ip_address': {'key': 'privateIpAddress', 'type': 'str'}, + } + + def __init__(self, *, private_ip_address: str=None, **kwargs) -> None: + super(Ipv6Properties, self).__init__(**kwargs) + self.private_ip_address = private_ip_address + + +class ManagedDisk(Model): + """This is managed disk parameters. + + :param id: This is the resource ID. + :type id: str + :param storage_account_type: This is the storage account type for the + managed disk. + :type storage_account_type: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, + } + + def __init__(self, *, id: str=None, storage_account_type: str=None, **kwargs) -> None: + super(ManagedDisk, self).__init__(**kwargs) + self.id = id + self.storage_account_type = storage_account_type + + +class Network(Model): + """Network Metadata. + + :param interface: This contains data about the network interface. + :type interface: list[~azure.imds.models.NetworkInterface] + """ + + _attribute_map = { + 'interface': {'key': 'interface', 'type': '[NetworkInterface]'}, + } + + def __init__(self, *, interface=None, **kwargs) -> None: + super(Network, self).__init__(**kwargs) + self.interface = interface + + +class NetworkInterface(Model): + """This contains data about the network interface. + + :param ipv4: This contains the IPv4 address. + :type ipv4: ~azure.imds.models.NetworkInterfaceIpv4 + :param ipv6: This contains the IPv6 address. + :type ipv6: ~azure.imds.models.NetworkInterfaceIpv6 + :param mac_address: This is the MAC address of the interface. + :type mac_address: str + """ + + _attribute_map = { + 'ipv4': {'key': 'ipv4', 'type': 'NetworkInterfaceIpv4'}, + 'ipv6': {'key': 'ipv6', 'type': 'NetworkInterfaceIpv6'}, + 'mac_address': {'key': 'macAddress', 'type': 'str'}, + } + + def __init__(self, *, ipv4=None, ipv6=None, mac_address: str=None, **kwargs) -> None: + super(NetworkInterface, self).__init__(**kwargs) + self.ipv4 = ipv4 + self.ipv6 = ipv6 + self.mac_address = mac_address + + +class NetworkInterfaceIpv4(Model): + """This contains the IPv4 address. + + :param ip_address: This is the IP address + :type ip_address: list[~azure.imds.models.Ipv4Properties] + :param subnet: This is the subnet + :type subnet: list[~azure.imds.models.SubnetProperties] + """ + + _attribute_map = { + 'ip_address': {'key': 'ipAddress', 'type': '[Ipv4Properties]'}, + 'subnet': {'key': 'subnet', 'type': '[SubnetProperties]'}, + } + + def __init__(self, *, ip_address=None, subnet=None, **kwargs) -> None: + super(NetworkInterfaceIpv4, self).__init__(**kwargs) + self.ip_address = ip_address + self.subnet = subnet + + +class NetworkInterfaceIpv6(Model): + """This contains the IPv6 address. + + :param ip_address: This is the IP address + :type ip_address: list[~azure.imds.models.Ipv6Properties] + """ + + _attribute_map = { + 'ip_address': {'key': 'ipAddress', 'type': '[Ipv6Properties]'}, + } + + def __init__(self, *, ip_address=None, **kwargs) -> None: + super(NetworkInterfaceIpv6, self).__init__(**kwargs) + self.ip_address = ip_address + + +class OsDisk(Model): + """This contains information about the OS disk used by the VM. + + :param caching: This is the caching requirements. + :type caching: str + :param create_option: This is information about how the VM was created. + :type create_option: str + :param diff_disk_settings: This is the ephemeral disk settings. + :type diff_disk_settings: ~azure.imds.models.DiffDiskSettings + :param disk_size_gb: This is the size of the disk in GB. + :type disk_size_gb: str + :param encryption_settings: This is the encryption settings for the disk. + :type encryption_settings: ~azure.imds.models.EncryptionSettings + :param image: This is the source user image virtual hard disk. + :type image: ~azure.imds.models.DiskImage + :param managed_disk: This is managed disk parameters. + :type managed_disk: ~azure.imds.models.ManagedDisk + :param name: This is the disk name. + :type name: str + :param os_type: This is the type of OS included in the disk. + :type os_type: str + :param vhd: This is the virtual hard disk. + :type vhd: ~azure.imds.models.VirtualHardDisk + :param write_accelerator_enabled: This specifies whether or not + writeAccelerator is enabled on the disk. + :type write_accelerator_enabled: str + """ + + _attribute_map = { + 'caching': {'key': 'caching', 'type': 'str'}, + 'create_option': {'key': 'createOption', 'type': 'str'}, + 'diff_disk_settings': {'key': 'diffDiskSettings', 'type': 'DiffDiskSettings'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'str'}, + 'encryption_settings': {'key': 'encryptionSettings', 'type': 'EncryptionSettings'}, + 'image': {'key': 'image', 'type': 'DiskImage'}, + 'managed_disk': {'key': 'managedDisk', 'type': 'ManagedDisk'}, + 'name': {'key': 'name', 'type': 'str'}, + 'os_type': {'key': 'osType', 'type': 'str'}, + 'vhd': {'key': 'vhd', 'type': 'VirtualHardDisk'}, + 'write_accelerator_enabled': {'key': 'writeAcceleratorEnabled', 'type': 'str'}, + } + + def __init__(self, *, caching: str=None, create_option: str=None, diff_disk_settings=None, disk_size_gb: str=None, encryption_settings=None, image=None, managed_disk=None, name: str=None, os_type: str=None, vhd=None, write_accelerator_enabled: str=None, **kwargs) -> None: + super(OsDisk, self).__init__(**kwargs) + self.caching = caching + self.create_option = create_option + self.diff_disk_settings = diff_disk_settings + self.disk_size_gb = disk_size_gb + self.encryption_settings = encryption_settings + self.image = image + self.managed_disk = managed_disk + self.name = name + self.os_type = os_type + self.vhd = vhd + self.write_accelerator_enabled = write_accelerator_enabled + + +class OsProfile(Model): + """This contains the data about the OS. + + :param admin_username: This is admin account. + :type admin_username: str + :param computer_name: This is the name of the VM. + :type computer_name: str + :param disable_password_authentication: This specifies whether or not + password authentication is disabled. Note that this is present only for + Linux VMs. For a Windows VM, this value will be the empty string. + :type disable_password_authentication: str + """ + + _attribute_map = { + 'admin_username': {'key': 'adminUsername', 'type': 'str'}, + 'computer_name': {'key': 'computerName', 'type': 'str'}, + 'disable_password_authentication': {'key': 'disablePasswordAuthentication', 'type': 'str'}, + } + + def __init__(self, *, admin_username: str=None, computer_name: str=None, disable_password_authentication: str=None, **kwargs) -> None: + super(OsProfile, self).__init__(**kwargs) + self.admin_username = admin_username + self.computer_name = computer_name + self.disable_password_authentication = disable_password_authentication + + +class PlanProperties(Model): + """This contains the data about the plan. + + :param name: This is the Plan ID. + :type name: str + :param publisher: This is the publisher ID. + :type publisher: str + :param product: This is the product of the image from the Marketplace. + :type product: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, publisher: str=None, product: str=None, **kwargs) -> None: + super(PlanProperties, self).__init__(**kwargs) + self.name = name + self.publisher = publisher + self.product = product + + +class PublicKeysProperties(Model): + """This contains the data about the public key. + + :param path: This specifies the full path on the VM where the SSH public + key is stored. + :type path: str + :param key_data: This is the SSH public key certificate used to + authenticate with the VM. + :type key_data: str + """ + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'key_data': {'key': 'keyData', 'type': 'str'}, + } + + def __init__(self, *, path: str=None, key_data: str=None, **kwargs) -> None: + super(PublicKeysProperties, self).__init__(**kwargs) + self.path = path + self.key_data = key_data + + +class SecurityProfile(Model): + """This contains the data about the security profile associated with the VM. + + :param secure_boot_enabled: Identifies if UEFI secure boot is enabled on + the VM + :type secure_boot_enabled: str + :param virtual_tpm_enabled: Identifies if the virtual Trusted Platform + Module (TPM) is enabled on the VM + :type virtual_tpm_enabled: str + """ + + _attribute_map = { + 'secure_boot_enabled': {'key': 'secureBootEnabled', 'type': 'str'}, + 'virtual_tpm_enabled': {'key': 'virtualTpmEnabled', 'type': 'str'}, + } + + def __init__(self, *, secure_boot_enabled: str=None, virtual_tpm_enabled: str=None, **kwargs) -> None: + super(SecurityProfile, self).__init__(**kwargs) + self.secure_boot_enabled = secure_boot_enabled + self.virtual_tpm_enabled = virtual_tpm_enabled + + +class StorageProfile(Model): + """This contains the data about the storage disks associated with the VM. + + :param image_reference: Image information + :type image_reference: ~azure.imds.models.ImageReference + :param os_disk: OS disk information + :type os_disk: ~azure.imds.models.OsDisk + :param data_disks: Data disk information + :type data_disks: list[~azure.imds.models.DataDisk] + :param resource_disk: This contains data for the size of local temp disk + of the VM, if it exists. + :type resource_disk: ~azure.imds.models.StorageProfileResourceDisk + """ + + _attribute_map = { + 'image_reference': {'key': 'imageReference', 'type': 'ImageReference'}, + 'os_disk': {'key': 'osDisk', 'type': 'OsDisk'}, + 'data_disks': {'key': 'dataDisks', 'type': '[DataDisk]'}, + 'resource_disk': {'key': 'resourceDisk', 'type': 'StorageProfileResourceDisk'}, + } + + def __init__(self, *, image_reference=None, os_disk=None, data_disks=None, resource_disk=None, **kwargs) -> None: + super(StorageProfile, self).__init__(**kwargs) + self.image_reference = image_reference + self.os_disk = os_disk + self.data_disks = data_disks + self.resource_disk = resource_disk + + +class StorageProfileResourceDisk(Model): + """This contains data for the size of local temp disk of the VM, if it exists. + + :param size: The size of the local temp disk of the VM if it exists, in + kilobytes. If the VM has no local temp disk, this value is 0. + :type size: str + """ + + _attribute_map = { + 'size': {'key': 'size', 'type': 'str'}, + } + + def __init__(self, *, size: str=None, **kwargs) -> None: + super(StorageProfileResourceDisk, self).__init__(**kwargs) + self.size = size + + +class SubnetProperties(Model): + """This contains the properties of the subnet. + + :param address: This is the address range of the subnet. + :type address: str + :param prefix: This is the prefix of the subnet. + :type prefix: str + """ + + _attribute_map = { + 'address': {'key': 'address', 'type': 'str'}, + 'prefix': {'key': 'prefix', 'type': 'str'}, + } + + def __init__(self, *, address: str=None, prefix: str=None, **kwargs) -> None: + super(SubnetProperties, self).__init__(**kwargs) + self.address = address + self.prefix = prefix + + +class TagsProperties(Model): + """This contains the properties of the tags in a tagsList. + + :param name: This is the name of the tag. It is equivalent to the key in + the key-value pair format. + :type name: str + :param value: This is the value of the tag. It is, as expected, equivalent + to the value in the key-value pair format. + :type value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, value: str=None, **kwargs) -> None: + super(TagsProperties, self).__init__(**kwargs) + self.name = name + self.value = value + + +class VirtualHardDisk(Model): + """This is the virtual hard disk. + + :param uri: This is the uri of the virtual hard disk. + :type uri: str + """ + + _attribute_map = { + 'uri': {'key': 'uri', 'type': 'str'}, + } + + def __init__(self, *, uri: str=None, **kwargs) -> None: + super(VirtualHardDisk, self).__init__(**kwargs) + self.uri = uri diff --git a/sdk/azure-imds/azure/imds/operations/__init__.py b/sdk/azure-imds/azure/imds/operations/__init__.py new file mode 100644 index 0000000000000..272e0e229e1f2 --- /dev/null +++ b/sdk/azure-imds/azure/imds/operations/__init__.py @@ -0,0 +1,20 @@ +# 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 ._instances_operations import InstancesOperations +from ._attested_operations import AttestedOperations +from ._identity_operations import IdentityOperations + +__all__ = [ + 'InstancesOperations', + 'AttestedOperations', + 'IdentityOperations', +] diff --git a/sdk/azure-imds/azure/imds/operations/_attested_operations.py b/sdk/azure-imds/azure/imds/operations/_attested_operations.py new file mode 100644 index 0000000000000..50b14646a83bc --- /dev/null +++ b/sdk/azure-imds/azure/imds/operations/_attested_operations.py @@ -0,0 +1,97 @@ +# 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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class AttestedOperations(object): + """AttestedOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: This is the API version to use. Constant value: "2021-02-01". + :ivar metadata: This must be set to 'true'. Constant value: "true". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2021-02-01" + self.metadata = "true" + + self.config = config + + def get_document( + self, nonce=None, custom_headers=None, raw=False, **operation_config): + """Get Attested Data for the Virtual Machine. + + :param nonce: This is a string of up to 32 random alphanumeric + characters. + :type nonce: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AttestedData or ClientRawResponse if raw=true + :rtype: ~azure.imds.models.AttestedData or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_document.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if nonce is not None: + query_parameters['nonce'] = self._serialize.query("nonce", nonce, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + header_parameters['Metadata'] = self._serialize.header("self.metadata", self.metadata, 'str') + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AttestedData', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_document.metadata = {'url': '/attested/document'} diff --git a/sdk/azure-imds/azure/imds/operations/_identity_operations.py b/sdk/azure-imds/azure/imds/operations/_identity_operations.py new file mode 100644 index 0000000000000..296c866f883a3 --- /dev/null +++ b/sdk/azure-imds/azure/imds/operations/_identity_operations.py @@ -0,0 +1,183 @@ +# 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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class IdentityOperations(object): + """IdentityOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar metadata: This must be set to 'true'. Constant value: "true". + :ivar api_version: This is the API version to use. Constant value: "2021-02-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.metadata = "true" + self.api_version = "2021-02-01" + + self.config = config + + def get_token( + self, resource, client_id=None, object_id=None, msi_res_id=None, authority=None, bypass_cache=None, custom_headers=None, raw=False, **operation_config): + """Get a Token from Azure AD. + + :param resource: This is the urlencoded identifier URI of the sink + resource for the requested Azure AD token. The resulting token + contains the corresponding aud for this resource. + :type resource: str + :param client_id: This identifies, by Azure AD client id, a specific + explicit identity to use when authenticating to Azure AD. Mutually + exclusive with object_id and msi_res_id. + :type client_id: str + :param object_id: This identifies, by Azure AD object id, a specific + explicit identity to use when authenticating to Azure AD. Mutually + exclusive with client_id and msi_res_id. + :type object_id: str + :param msi_res_id: This identifies, by urlencoded ARM resource id, a + specific explicit identity to use when authenticating to Azure AD. + Mutually exclusive with client_id and object_id. + :type msi_res_id: str + :param authority: This indicates the authority to request AAD tokens + from. Defaults to the known authority of the identity to be used. + :type authority: str + :param bypass_cache: If provided, the value must be 'true'. This + indicates to the server that the token must be retrieved from Azure AD + and cannot be retrieved from an internal cache. Possible values + include: 'true' + :type bypass_cache: str or ~azure.imds.models.BypassCache + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: IdentityTokenResponse or ClientRawResponse if raw=true + :rtype: ~azure.imds.models.IdentityTokenResponse or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`IdentityErrorResponseException` + """ + # Construct URL + url = self.get_token.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['resource'] = self._serialize.query("resource", resource, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if client_id is not None: + query_parameters['client_id'] = self._serialize.query("client_id", client_id, 'str') + if object_id is not None: + query_parameters['object_id'] = self._serialize.query("object_id", object_id, 'str') + if msi_res_id is not None: + query_parameters['msi_res_id'] = self._serialize.query("msi_res_id", msi_res_id, 'str') + if authority is not None: + query_parameters['authority'] = self._serialize.query("authority", authority, 'str') + if bypass_cache is not None: + query_parameters['bypass_cache'] = self._serialize.query("bypass_cache", bypass_cache, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + header_parameters['Metadata'] = self._serialize.header("self.metadata", self.metadata, 'str') + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.IdentityErrorResponseException(self._deserialize, response) + + header_dict = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('IdentityTokenResponse', response) + header_dict = { + 'Www-Authenticate': 'str', + } + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + get_token.metadata = {'url': '/identity/oauth2/token'} + + def get_info( + self, custom_headers=None, raw=False, **operation_config): + """Get information about AAD Metadata. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: IdentityInfoResponse or ClientRawResponse if raw=true + :rtype: ~azure.imds.models.IdentityInfoResponse or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`IdentityErrorResponseException` + """ + # Construct URL + url = self.get_info.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + header_parameters['Metadata'] = self._serialize.header("self.metadata", self.metadata, 'str') + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.IdentityErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('IdentityInfoResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_info.metadata = {'url': '/identity/info'} diff --git a/sdk/azure-imds/azure/imds/operations/_instances_operations.py b/sdk/azure-imds/azure/imds/operations/_instances_operations.py new file mode 100644 index 0000000000000..9de875b7e1f7f --- /dev/null +++ b/sdk/azure-imds/azure/imds/operations/_instances_operations.py @@ -0,0 +1,92 @@ +# 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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class InstancesOperations(object): + """InstancesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: This is the API version to use. Constant value: "2021-02-01". + :ivar metadata: This must be set to 'true'. Constant value: "true". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2021-02-01" + self.metadata = "true" + + self.config = config + + def get_metadata( + self, custom_headers=None, raw=False, **operation_config): + """Get Instance Metadata for the Virtual Machine. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Instance or ClientRawResponse if raw=true + :rtype: ~azure.imds.models.Instance or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_metadata.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + header_parameters['Metadata'] = self._serialize.header("self.metadata", self.metadata, 'str') + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Instance', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_metadata.metadata = {'url': '/instance'} diff --git a/sdk/azure-imds/azure/imds/version.py b/sdk/azure-imds/azure/imds/version.py new file mode 100644 index 0000000000000..e0ec669828cbf --- /dev/null +++ b/sdk/azure-imds/azure/imds/version.py @@ -0,0 +1,13 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "0.1.0" +