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
9 changes: 9 additions & 0 deletions azure-imds/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.. :changelog:

Release History
===============

0.1.0 (1970-01-01)
++++++++++++++++++

* Initial Release
3 changes: 3 additions & 0 deletions azure-imds/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include *.rst
include azure/__init__.py

49 changes: 49 additions & 0 deletions azure-imds/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Microsoft Azure SDK for Python
==============================

This is the Microsoft Azure MyService Management Client Library.

Azure Resource Manager (ARM) is the next generation of management APIs that
replace the old Azure Service Management (ASM).

This package has been tested with Python 2.7, 3.4, 3.5, 3.6 and 3.7.

For the older Azure Service Management (ASM) libraries, see
`azure-servicemanagement-legacy <https://pypi.python.org/pypi/azure-servicemanagement-legacy>`__ library.

For a more complete set of Azure libraries, see the `azure <https://pypi.python.org/pypi/azure>`__ bundle package.


Compatibility
=============

**IMPORTANT**: If you have an earlier version of the azure package
(version < 1.0), you should uninstall it before installing this package.

You can check the version using pip:

.. code:: shell

pip freeze

If you see azure==0.11.0 (or any version below 1.0), uninstall it first:

.. code:: shell

pip uninstall azure


Usage
=====

For code examples, see `MyService Management
<https://docs.microsoft.com/python/api/overview/azure/>`__
on docs.microsoft.com.


Provide Feedback
================

If you encounter any bugs or have suggestions, please file an issue in the
`Issues <https://github.com/Azure/azure-sdk-for-python/issues>`__
section of the project.
1 change: 1 addition & 0 deletions azure-imds/azure/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
18 changes: 18 additions & 0 deletions 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 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 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 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 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
Loading