Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions sdk/azure-imds/azure/imds/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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 .instance_metadata_client import InstanceMetadataClient
from .version import VERSION

__all__ = ['InstanceMetadataClient']

__version__ = VERSION

84 changes: 84 additions & 0 deletions sdk/azure-imds/azure/imds/instance_metadata_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# 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 msrestazure import AzureConfiguration
from .version import VERSION
from .operations.instances_operations import InstancesOperations
from .operations.attested_operations import AttestedOperations
from .operations.identity_operations import IdentityOperations
from . import models


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<msrestazure.azure_active_directory>`
: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 = 'https://169.254.169.254/metadata'

super(InstanceMetadataClientConfiguration, self).__init__(base_url)

self.add_user_agent('azure-imds/{}'.format(VERSION))
self.add_user_agent('Azure-SDK-For-Python')

self.credentials = credentials


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<msrestazure.azure_active_directory>`
: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 = '2018-10-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)
70 changes: 70 additions & 0 deletions sdk/azure-imds/azure/imds/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# 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 .plan_properties_py3 import PlanProperties
from .public_keys_properties_py3 import PublicKeysProperties
from .compute_py3 import Compute
from .ipv4_properties_py3 import Ipv4Properties
from .subnet_properties_py3 import SubnetProperties
from .network_interface_ipv4_py3 import NetworkInterfaceIpv4
from .ipv6_properties_py3 import Ipv6Properties
from .network_interface_ipv6_py3 import NetworkInterfaceIpv6
from .network_interface_py3 import NetworkInterface
from .network_py3 import Network
from .instance_py3 import Instance
from .attested_data_py3 import AttestedData
from .error_response_py3 import ErrorResponse, ErrorResponseException
from .identity_error_response_py3 import IdentityErrorResponse, IdentityErrorResponseException
from .identity_token_response_py3 import IdentityTokenResponse
from .identity_info_response_py3 import IdentityInfoResponse
except (SyntaxError, ImportError):
from .plan_properties import PlanProperties
from .public_keys_properties import PublicKeysProperties
from .compute import Compute
from .ipv4_properties import Ipv4Properties
from .subnet_properties import SubnetProperties
from .network_interface_ipv4 import NetworkInterfaceIpv4
from .ipv6_properties import Ipv6Properties
from .network_interface_ipv6 import NetworkInterfaceIpv6
from .network_interface import NetworkInterface
from .network import Network
from .instance import Instance
from .attested_data import AttestedData
from .error_response import ErrorResponse, ErrorResponseException
from .identity_error_response import IdentityErrorResponse, IdentityErrorResponseException
from .identity_token_response import IdentityTokenResponse
from .identity_info_response import IdentityInfoResponse
from .instance_metadata_client_enums import (
Error,
BypassCache,
)

__all__ = [
'PlanProperties',
'PublicKeysProperties',
'Compute',
'Ipv4Properties',
'SubnetProperties',
'NetworkInterfaceIpv4',
'Ipv6Properties',
'NetworkInterfaceIpv6',
'NetworkInterface',
'Network',
'Instance',
'AttestedData',
'ErrorResponse', 'ErrorResponseException',
'IdentityErrorResponse', 'IdentityErrorResponseException',
'IdentityTokenResponse',
'IdentityInfoResponse',
'Error',
'BypassCache',
]
33 changes: 33 additions & 0 deletions sdk/azure-imds/azure/imds/models/attested_data.py
Original file line number Diff line number Diff line change
@@ -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 msrest.serialization import Model


class AttestedData(Model):
"""This is the response from the Attested_GetDocument operation.

:param signature: This is the encoded string containing the VM ID, 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)
33 changes: 33 additions & 0 deletions sdk/azure-imds/azure/imds/models/attested_data_py3.py
Original file line number Diff line number Diff line change
@@ -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 msrest.serialization import Model


class AttestedData(Model):
"""This is the response from the Attested_GetDocument operation.

:param signature: This is the encoded string containing the VM ID, 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
112 changes: 112 additions & 0 deletions sdk/azure-imds/azure/imds/models/compute.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# 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


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 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_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 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 sku: This is the specific SKU for the VM image.
:type sku: str
: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 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'},
'location': {'key': 'location', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'offer': {'key': 'offer', 'type': 'str'},
'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'},
'provider': {'key': 'provider', 'type': 'str'},
'publisher': {'key': 'publisher', 'type': 'str'},
'resource_group_name': {'key': 'resourceGroupName', 'type': 'str'},
'sku': {'key': 'sku', 'type': 'str'},
'subscription_id': {'key': 'subscriptionId', 'type': 'str'},
'tags': {'key': 'tags', '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.location = kwargs.get('location', None)
self.name = kwargs.get('name', None)
self.offer = kwargs.get('offer', 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.provider = kwargs.get('provider', None)
self.publisher = kwargs.get('publisher', None)
self.resource_group_name = kwargs.get('resource_group_name', None)
self.sku = kwargs.get('sku', None)
self.subscription_id = kwargs.get('subscription_id', None)
self.tags = kwargs.get('tags', 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)
Loading