Skip to content

Commit

Permalink
CodeGen from PR 14257 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge a9d57c4cea2dd6c7a71f8beb1a9c6f8c5d1c4163 into 119d0a9
  • Loading branch information
SDKAuto committed May 26, 2021
1 parent 7f05d8c commit 10e9712
Show file tree
Hide file tree
Showing 12 changed files with 2,414 additions and 0 deletions.
19 changes: 19 additions & 0 deletions sdk/azure-imds/azure/imds/__init__.py
Original file line number Diff line number Diff line change
@@ -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

43 changes: 43 additions & 0 deletions sdk/azure-imds/azure/imds/_configuration.py
Original file line number Diff line number Diff line change
@@ -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<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 = '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
57 changes: 57 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,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<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 = '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)
109 changes: 109 additions & 0 deletions sdk/azure-imds/azure/imds/models/__init__.py
Original file line number Diff line number Diff line change
@@ -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',
]
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 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"
Loading

0 comments on commit 10e9712

Please sign in to comment.