forked from Azure/azure-sdk-for-python
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CodeGen from PR 11826 in Azure/azure-rest-api-specs
Merge c4a7a8891adb9c6237fadbc0ac3a064389a3641e into b02ad20
- Loading branch information
SDKAuto
committed
Nov 26, 2020
1 parent
e1f2009
commit 9fc33b5
Showing
12 changed files
with
1,602 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = 'https://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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = '2019-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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ._models_py3 import AttestedData | ||
from ._models_py3 import Compute | ||
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 Instance | ||
from ._models_py3 import Ipv4Properties | ||
from ._models_py3 import Ipv6Properties | ||
from ._models_py3 import Network | ||
from ._models_py3 import NetworkInterface | ||
from ._models_py3 import NetworkInterfaceIpv4 | ||
from ._models_py3 import NetworkInterfaceIpv6 | ||
from ._models_py3 import PlanProperties | ||
from ._models_py3 import PublicKeysProperties | ||
from ._models_py3 import SubnetProperties | ||
except (SyntaxError, ImportError): | ||
from ._models import AttestedData | ||
from ._models import Compute | ||
from ._models import ErrorResponse, ErrorResponseException | ||
from ._models import IdentityErrorResponse, IdentityErrorResponseException | ||
from ._models import IdentityInfoResponse | ||
from ._models import IdentityTokenResponse | ||
from ._models import Instance | ||
from ._models import Ipv4Properties | ||
from ._models import Ipv6Properties | ||
from ._models import Network | ||
from ._models import NetworkInterface | ||
from ._models import NetworkInterfaceIpv4 | ||
from ._models import NetworkInterfaceIpv6 | ||
from ._models import PlanProperties | ||
from ._models import PublicKeysProperties | ||
from ._models import SubnetProperties | ||
from ._instance_metadata_client_enums import ( | ||
Error, | ||
BypassCache, | ||
) | ||
|
||
__all__ = [ | ||
'AttestedData', | ||
'Compute', | ||
'ErrorResponse', 'ErrorResponseException', | ||
'IdentityErrorResponse', 'IdentityErrorResponseException', | ||
'IdentityInfoResponse', | ||
'IdentityTokenResponse', | ||
'Instance', | ||
'Ipv4Properties', | ||
'Ipv6Properties', | ||
'Network', | ||
'NetworkInterface', | ||
'NetworkInterfaceIpv4', | ||
'NetworkInterfaceIpv6', | ||
'PlanProperties', | ||
'PublicKeysProperties', | ||
'SubnetProperties', | ||
'Error', | ||
'BypassCache', | ||
] |
33 changes: 33 additions & 0 deletions
33
sdk/azure-imds/azure/imds/models/_instance_metadata_client_enums.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
Oops, something went wrong.