diff --git a/sdk/subscription/azure-mgmt-subscription/MANIFEST.in b/sdk/subscription/azure-mgmt-subscription/MANIFEST.in index a3cb07df8765..3a9b6517412b 100644 --- a/sdk/subscription/azure-mgmt-subscription/MANIFEST.in +++ b/sdk/subscription/azure-mgmt-subscription/MANIFEST.in @@ -1,3 +1,4 @@ +include _meta.json recursive-include tests *.py *.yaml include *.md include azure/__init__.py diff --git a/sdk/subscription/azure-mgmt-subscription/_meta.json b/sdk/subscription/azure-mgmt-subscription/_meta.json new file mode 100644 index 000000000000..814aa10d3725 --- /dev/null +++ b/sdk/subscription/azure-mgmt-subscription/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.4.5", + "use": [ + "@autorest/python@5.8.4", + "@autorest/modelerfour@4.19.2" + ], + "commit": "5a26835f26fdb1ef29b1d1da6c51b10500f9de46", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/subscription/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "readme": "specification/subscription/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/__init__.py b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/__init__.py index a1d3eed7425f..6d8f45c77a61 100644 --- a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/__init__.py +++ b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/__init__.py @@ -7,6 +7,9 @@ # -------------------------------------------------------------------------- from ._subscription_client import SubscriptionClient +from ._version import VERSION + +__version__ = VERSION __all__ = ['SubscriptionClient'] try: diff --git a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/_configuration.py b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/_configuration.py index f4e3e5c64ca8..5915e6fc841c 100644 --- a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/_configuration.py +++ b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/_configuration.py @@ -12,13 +12,14 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from ._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any from azure.core.credentials import TokenCredential -VERSION = "unknown" class SubscriptionClientConfiguration(Configuration): """Configuration for SubscriptionClient. diff --git a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/_metadata.json b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/_metadata.json new file mode 100644 index 000000000000..f98a15163b82 --- /dev/null +++ b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/_metadata.json @@ -0,0 +1,95 @@ +{ + "chosen_version": "", + "total_api_version_list": ["2016-06-01", "2020-09-01"], + "client": { + "name": "SubscriptionClient", + "filename": "_subscription_client", + "description": "The subscription client.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"SubscriptionClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"SubscriptionClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + } + }, + "constant": { + }, + "call": "credential", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "subscriptions": "SubscriptionsOperations", + "tenants": "TenantsOperations", + "subscription": "SubscriptionOperations", + "operations": "Operations", + "alias": "AliasOperations" + } +} \ No newline at end of file diff --git a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/_subscription_client.py b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/_subscription_client.py index e746855a5ace..045202d0ec05 100644 --- a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/_subscription_client.py +++ b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/_subscription_client.py @@ -16,6 +16,7 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import SubscriptionClientConfiguration from .operations import SubscriptionsOperations @@ -30,15 +31,15 @@ class SubscriptionClient(object): """The subscription client. :ivar subscriptions: SubscriptionsOperations operations - :vartype subscriptions: subscription_client.operations.SubscriptionsOperations + :vartype subscriptions: azure.mgmt.subscription.operations.SubscriptionsOperations :ivar tenants: TenantsOperations operations - :vartype tenants: subscription_client.operations.TenantsOperations + :vartype tenants: azure.mgmt.subscription.operations.TenantsOperations :ivar subscription: SubscriptionOperations operations - :vartype subscription: subscription_client.operations.SubscriptionOperations + :vartype subscription: azure.mgmt.subscription.operations.SubscriptionOperations :ivar operations: Operations operations - :vartype operations: subscription_client.operations.Operations + :vartype operations: azure.mgmt.subscription.operations.Operations :ivar alias: AliasOperations operations - :vartype alias: subscription_client.operations.AliasOperations + :vartype alias: azure.mgmt.subscription.operations.AliasOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param str base_url: Service URL @@ -73,6 +74,21 @@ def __init__( self.alias = AliasOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + http_request.url = self._client.format_url(http_request.url) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() diff --git a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/_version.py b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/_version.py index c47f66669f1b..e5754a47ce68 100644 --- a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/_version.py +++ b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/aio/_configuration.py b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/aio/_configuration.py index b668b631b6a7..7d6a38539dd6 100644 --- a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/aio/_configuration.py +++ b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/aio/_configuration.py @@ -12,11 +12,12 @@ from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from .._version import VERSION + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -VERSION = "unknown" class SubscriptionClientConfiguration(Configuration): """Configuration for SubscriptionClient. diff --git a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/aio/_subscription_client.py b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/aio/_subscription_client.py index a60e85d09a74..259bd3b77c24 100644 --- a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/aio/_subscription_client.py +++ b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/aio/_subscription_client.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -28,15 +29,15 @@ class SubscriptionClient(object): """The subscription client. :ivar subscriptions: SubscriptionsOperations operations - :vartype subscriptions: subscription_client.aio.operations.SubscriptionsOperations + :vartype subscriptions: azure.mgmt.subscription.aio.operations.SubscriptionsOperations :ivar tenants: TenantsOperations operations - :vartype tenants: subscription_client.aio.operations.TenantsOperations + :vartype tenants: azure.mgmt.subscription.aio.operations.TenantsOperations :ivar subscription: SubscriptionOperations operations - :vartype subscription: subscription_client.aio.operations.SubscriptionOperations + :vartype subscription: azure.mgmt.subscription.aio.operations.SubscriptionOperations :ivar operations: Operations operations - :vartype operations: subscription_client.aio.operations.Operations + :vartype operations: azure.mgmt.subscription.aio.operations.Operations :ivar alias: AliasOperations operations - :vartype alias: subscription_client.aio.operations.AliasOperations + :vartype alias: azure.mgmt.subscription.aio.operations.AliasOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param str base_url: Service URL @@ -70,6 +71,20 @@ def __init__( self.alias = AliasOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + http_request.url = self._client.format_url(http_request.url) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() diff --git a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/aio/operations/_alias_operations.py b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/aio/operations/_alias_operations.py index 17d132ddb213..2b162f5b5e9d 100644 --- a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/aio/operations/_alias_operations.py +++ b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/aio/operations/_alias_operations.py @@ -15,7 +15,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -27,14 +27,14 @@ class AliasOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~subscription_client.models + :type models: ~azure.mgmt.subscription.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,10 +45,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def _create_initial( self, alias_name: str, - body: "models.PutAliasRequest", - **kwargs - ) -> "models.PutAliasResponse": - cls = kwargs.pop('cls', None) # type: ClsType["models.PutAliasResponse"] + body: "_models.PutAliasRequest", + **kwargs: Any + ) -> "_models.PutAliasResponse": + cls = kwargs.pop('cls', None) # type: ClsType["_models.PutAliasResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -82,7 +82,7 @@ async def _create_initial( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponseBody, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseBody, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -100,27 +100,29 @@ async def _create_initial( async def begin_create( self, alias_name: str, - body: "models.PutAliasRequest", - **kwargs - ) -> AsyncLROPoller["models.PutAliasResponse"]: + body: "_models.PutAliasRequest", + **kwargs: Any + ) -> AsyncLROPoller["_models.PutAliasResponse"]: """Create Alias Subscription. - :param alias_name: Alias Name. + :param alias_name: Name for this subscription creation request also known as alias. Note that + this is not the same as subscription name and this doesn’t have any other lifecycle need beyond + the request for subscription creation. :type alias_name: str :param body: - :type body: ~subscription_client.models.PutAliasRequest + :type body: ~azure.mgmt.subscription.models.PutAliasRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PutAliasResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~subscription_client.models.PutAliasResponse] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.subscription.models.PutAliasResponse] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.PutAliasResponse"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PutAliasResponse"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -144,7 +146,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'aliasName': self._serialize.url("alias_name", alias_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -161,18 +167,20 @@ def get_long_running_output(pipeline_response): async def get( self, alias_name: str, - **kwargs - ) -> "models.PutAliasResponse": + **kwargs: Any + ) -> "_models.PutAliasResponse": """Get Alias Subscription. - :param alias_name: Alias Name. + :param alias_name: Name for this subscription creation request also known as alias. Note that + this is not the same as subscription name and this doesn’t have any other lifecycle need beyond + the request for subscription creation. :type alias_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PutAliasResponse, or the result of cls(response) - :rtype: ~subscription_client.models.PutAliasResponse + :rtype: ~azure.mgmt.subscription.models.PutAliasResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PutAliasResponse"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PutAliasResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -201,7 +209,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponseBody, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseBody, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PutAliasResponse', pipeline_response) @@ -215,11 +223,13 @@ async def get( async def delete( self, alias_name: str, - **kwargs + **kwargs: Any ) -> None: """Delete Alias. - :param alias_name: Alias Name. + :param alias_name: Name for this subscription creation request also known as alias. Note that + this is not the same as subscription name and this doesn’t have any other lifecycle need beyond + the request for subscription creation. :type alias_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -255,7 +265,7 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponseBody, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseBody, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -265,16 +275,16 @@ async def delete( async def list( self, - **kwargs - ) -> "models.PutAliasListResult": + **kwargs: Any + ) -> "_models.PutAliasListResult": """Get Alias Subscription. :keyword callable cls: A custom type or function that will be passed the direct response :return: PutAliasListResult, or the result of cls(response) - :rtype: ~subscription_client.models.PutAliasListResult + :rtype: ~azure.mgmt.subscription.models.PutAliasListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PutAliasListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PutAliasListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -299,7 +309,7 @@ async def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponseBody, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseBody, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PutAliasListResult', pipeline_response) diff --git a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/aio/operations/_operations.py b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/aio/operations/_operations.py index 828c5e9776bd..43a6941756af 100644 --- a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/aio/operations/_operations.py +++ b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/aio/operations/_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -25,14 +25,14 @@ class Operations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~subscription_client.models + :type models: ~azure.mgmt.subscription.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -42,16 +42,16 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def list( self, - **kwargs - ) -> "models.OperationListResult": + **kwargs: Any + ) -> "_models.OperationListResult": """Lists all of the available Microsoft.Subscription API operations. :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationListResult, or the result of cls(response) - :rtype: ~subscription_client.models.OperationListResult + :rtype: ~azure.mgmt.subscription.models.OperationListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -76,7 +76,7 @@ async def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationListResult', pipeline_response) diff --git a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/aio/operations/_subscription_operations.py b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/aio/operations/_subscription_operations.py index dc02683d939f..c9f11cc26a30 100644 --- a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/aio/operations/_subscription_operations.py +++ b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/aio/operations/_subscription_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -25,14 +25,14 @@ class SubscriptionOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~subscription_client.models + :type models: ~azure.mgmt.subscription.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -43,18 +43,18 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def cancel( self, subscription_id: str, - **kwargs - ) -> "models.CanceledSubscriptionId": + **kwargs: Any + ) -> "_models.CanceledSubscriptionId": """The operation to cancel a subscription. :param subscription_id: Subscription Id. :type subscription_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CanceledSubscriptionId, or the result of cls(response) - :rtype: ~subscription_client.models.CanceledSubscriptionId + :rtype: ~azure.mgmt.subscription.models.CanceledSubscriptionId :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CanceledSubscriptionId"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CanceledSubscriptionId"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -83,7 +83,7 @@ async def cancel( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CanceledSubscriptionId', pipeline_response) @@ -97,21 +97,21 @@ async def cancel( async def rename( self, subscription_id: str, - body: "models.SubscriptionName", - **kwargs - ) -> "models.RenamedSubscriptionId": + body: "_models.SubscriptionName", + **kwargs: Any + ) -> "_models.RenamedSubscriptionId": """The operation to rename a subscription. :param subscription_id: Subscription Id. :type subscription_id: str :param body: Subscription Name. - :type body: ~subscription_client.models.SubscriptionName + :type body: ~azure.mgmt.subscription.models.SubscriptionName :keyword callable cls: A custom type or function that will be passed the direct response :return: RenamedSubscriptionId, or the result of cls(response) - :rtype: ~subscription_client.models.RenamedSubscriptionId + :rtype: ~azure.mgmt.subscription.models.RenamedSubscriptionId :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.RenamedSubscriptionId"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RenamedSubscriptionId"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -145,7 +145,7 @@ async def rename( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RenamedSubscriptionId', pipeline_response) @@ -159,18 +159,18 @@ async def rename( async def enable( self, subscription_id: str, - **kwargs - ) -> "models.EnabledSubscriptionId": + **kwargs: Any + ) -> "_models.EnabledSubscriptionId": """The operation to enable a subscription. :param subscription_id: Subscription Id. :type subscription_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EnabledSubscriptionId, or the result of cls(response) - :rtype: ~subscription_client.models.EnabledSubscriptionId + :rtype: ~azure.mgmt.subscription.models.EnabledSubscriptionId :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.EnabledSubscriptionId"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.EnabledSubscriptionId"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -199,7 +199,7 @@ async def enable( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EnabledSubscriptionId', pipeline_response) diff --git a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/aio/operations/_subscriptions_operations.py b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/aio/operations/_subscriptions_operations.py index b168ea30639e..2b261691043b 100644 --- a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/aio/operations/_subscriptions_operations.py +++ b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/aio/operations/_subscriptions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,14 +26,14 @@ class SubscriptionsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~subscription_client.models + :type models: ~azure.mgmt.subscription.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,8 +44,8 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list_locations( self, subscription_id: str, - **kwargs - ) -> AsyncIterable["models.LocationListResult"]: + **kwargs: Any + ) -> AsyncIterable["_models.LocationListResult"]: """Gets all available geo-locations. This operation provides all the locations that are available for resource providers; however, @@ -55,10 +55,10 @@ def list_locations( :type subscription_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either LocationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~subscription_client.models.LocationListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.subscription.models.LocationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LocationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LocationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -116,18 +116,18 @@ async def get_next(next_link=None): async def get( self, subscription_id: str, - **kwargs - ) -> "models.Subscription": + **kwargs: Any + ) -> "_models.Subscription": """Gets details about a specified subscription. :param subscription_id: The ID of the target subscription. :type subscription_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Subscription, or the result of cls(response) - :rtype: ~subscription_client.models.Subscription + :rtype: ~azure.mgmt.subscription.models.Subscription :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Subscription"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Subscription"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -168,16 +168,16 @@ async def get( def list( self, - **kwargs - ) -> AsyncIterable["models.SubscriptionListResult"]: + **kwargs: Any + ) -> AsyncIterable["_models.SubscriptionListResult"]: """Gets all subscriptions for a tenant. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SubscriptionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~subscription_client.models.SubscriptionListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.subscription.models.SubscriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SubscriptionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/aio/operations/_tenants_operations.py b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/aio/operations/_tenants_operations.py index 9dca210799dc..a3b83367b0d9 100644 --- a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/aio/operations/_tenants_operations.py +++ b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/aio/operations/_tenants_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,14 +26,14 @@ class TenantsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~subscription_client.models + :type models: ~azure.mgmt.subscription.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -43,16 +43,16 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, - **kwargs - ) -> AsyncIterable["models.TenantListResult"]: + **kwargs: Any + ) -> AsyncIterable["_models.TenantListResult"]: """Gets the tenants for your account. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TenantListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~subscription_client.models.TenantListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.subscription.models.TenantListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TenantListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TenantListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/models/_models.py b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/models/_models.py index 7e2e60058b6b..63e811b02246 100644 --- a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/models/_models.py +++ b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/models/_models.py @@ -87,7 +87,7 @@ class ErrorResponseBody(msrest.serialization.Model): """Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. :param error: The details of the error. - :type error: ~subscription_client.models.ErrorResponse + :type error: ~azure.mgmt.subscription.models.ErrorResponse """ _attribute_map = { @@ -157,7 +157,7 @@ class LocationListResult(msrest.serialization.Model): """Location list operation response. :param value: An array of locations. - :type value: list[~subscription_client.models.Location] + :type value: list[~azure.mgmt.subscription.models.Location] """ _attribute_map = { @@ -178,7 +178,7 @@ class Operation(msrest.serialization.Model): :param name: Operation name: {provider}/{resource}/{operation}. :type name: str :param display: The object that represents the operation. - :type display: ~subscription_client.models.OperationDisplay + :type display: ~azure.mgmt.subscription.models.OperationDisplay """ _attribute_map = { @@ -226,7 +226,7 @@ class OperationListResult(msrest.serialization.Model): """Result of the request to list operations. It contains a list of operations and a URL link to get the next set of results. :param value: List of operations. - :type value: list[~subscription_client.models.Operation] + :type value: list[~azure.mgmt.subscription.models.Operation] :param next_link: URL to get the next set of operation list results if there are any. :type next_link: str """ @@ -251,7 +251,7 @@ class PutAliasListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: The list of alias. - :vartype value: list[~subscription_client.models.PutAliasResponse] + :vartype value: list[~azure.mgmt.subscription.models.PutAliasResponse] :ivar next_link: The link (url) to the next page of results. :vartype next_link: str """ @@ -281,7 +281,7 @@ class PutAliasRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param properties: Required. Put alias request properties. - :type properties: ~subscription_client.models.PutAliasRequestProperties + :type properties: ~azure.mgmt.subscription.models.PutAliasRequestProperties """ _validation = { @@ -307,7 +307,7 @@ class PutAliasRequestProperties(msrest.serialization.Model): :type display_name: str :param workload: The workload type of the subscription. It can be either Production or DevTest. Possible values include: "Production", "DevTest". - :type workload: str or ~subscription_client.models.Workload + :type workload: str or ~azure.mgmt.subscription.models.Workload :param billing_scope: Determines whether subscription is fieldLed, partnerLed or LegacyEA. :type billing_scope: str :param subscription_id: This parameter can be used to create alias for existing subscription @@ -349,7 +349,7 @@ class PutAliasResponse(msrest.serialization.Model): :ivar type: Resource type, Microsoft.Subscription/aliases. :vartype type: str :param properties: Put Alias response properties. - :type properties: ~subscription_client.models.PutAliasResponseProperties + :type properties: ~azure.mgmt.subscription.models.PutAliasResponseProperties """ _validation = { @@ -385,7 +385,7 @@ class PutAliasResponseProperties(msrest.serialization.Model): :vartype subscription_id: str :param provisioning_state: The provisioning state of the resource. Possible values include: "Accepted", "Succeeded", "Failed". - :type provisioning_state: str or ~subscription_client.models.ProvisioningState + :type provisioning_state: str or ~azure.mgmt.subscription.models.ProvisioningState """ _validation = { @@ -445,9 +445,9 @@ class Subscription(msrest.serialization.Model): :vartype display_name: str :ivar state: The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted. Possible values include: "Enabled", "Warned", "PastDue", "Disabled", "Deleted". - :vartype state: str or ~subscription_client.models.SubscriptionState + :vartype state: str or ~azure.mgmt.subscription.models.SubscriptionState :param subscription_policies: The subscription policies. - :type subscription_policies: ~subscription_client.models.SubscriptionPolicies + :type subscription_policies: ~azure.mgmt.subscription.models.SubscriptionPolicies :param authorization_source: The authorization source of the request. Valid values are one or more combinations of Legacy, RoleBased, Bypassed, Direct and Management. For example, 'Legacy, RoleBased'. @@ -489,7 +489,7 @@ class SubscriptionListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param value: An array of subscriptions. - :type value: list[~subscription_client.models.Subscription] + :type value: list[~azure.mgmt.subscription.models.Subscription] :param next_link: Required. The URL to get the next set of results. :type next_link: str """ @@ -544,7 +544,7 @@ class SubscriptionPolicies(msrest.serialization.Model): :vartype quota_id: str :ivar spending_limit: The subscription spending limit. Possible values include: "On", "Off", "CurrentPeriodOff". - :vartype spending_limit: str or ~subscription_client.models.SpendingLimit + :vartype spending_limit: str or ~azure.mgmt.subscription.models.SpendingLimit """ _validation = { @@ -606,7 +606,7 @@ class TenantListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param value: An array of tenants. - :type value: list[~subscription_client.models.TenantIdDescription] + :type value: list[~azure.mgmt.subscription.models.TenantIdDescription] :param next_link: Required. The URL to use for getting the next set of results. :type next_link: str """ diff --git a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/models/_models_py3.py b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/models/_models_py3.py index 7067cd918eef..806a5ed75c50 100644 --- a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/models/_models_py3.py +++ b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/models/_models_py3.py @@ -94,7 +94,7 @@ class ErrorResponseBody(msrest.serialization.Model): """Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. :param error: The details of the error. - :type error: ~subscription_client.models.ErrorResponse + :type error: ~azure.mgmt.subscription.models.ErrorResponse """ _attribute_map = { @@ -166,7 +166,7 @@ class LocationListResult(msrest.serialization.Model): """Location list operation response. :param value: An array of locations. - :type value: list[~subscription_client.models.Location] + :type value: list[~azure.mgmt.subscription.models.Location] """ _attribute_map = { @@ -189,7 +189,7 @@ class Operation(msrest.serialization.Model): :param name: Operation name: {provider}/{resource}/{operation}. :type name: str :param display: The object that represents the operation. - :type display: ~subscription_client.models.OperationDisplay + :type display: ~azure.mgmt.subscription.models.OperationDisplay """ _attribute_map = { @@ -244,7 +244,7 @@ class OperationListResult(msrest.serialization.Model): """Result of the request to list operations. It contains a list of operations and a URL link to get the next set of results. :param value: List of operations. - :type value: list[~subscription_client.models.Operation] + :type value: list[~azure.mgmt.subscription.models.Operation] :param next_link: URL to get the next set of operation list results if there are any. :type next_link: str """ @@ -272,7 +272,7 @@ class PutAliasListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: The list of alias. - :vartype value: list[~subscription_client.models.PutAliasResponse] + :vartype value: list[~azure.mgmt.subscription.models.PutAliasResponse] :ivar next_link: The link (url) to the next page of results. :vartype next_link: str """ @@ -302,7 +302,7 @@ class PutAliasRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param properties: Required. Put alias request properties. - :type properties: ~subscription_client.models.PutAliasRequestProperties + :type properties: ~azure.mgmt.subscription.models.PutAliasRequestProperties """ _validation = { @@ -330,7 +330,7 @@ class PutAliasRequestProperties(msrest.serialization.Model): :type display_name: str :param workload: The workload type of the subscription. It can be either Production or DevTest. Possible values include: "Production", "DevTest". - :type workload: str or ~subscription_client.models.Workload + :type workload: str or ~azure.mgmt.subscription.models.Workload :param billing_scope: Determines whether subscription is fieldLed, partnerLed or LegacyEA. :type billing_scope: str :param subscription_id: This parameter can be used to create alias for existing subscription @@ -378,7 +378,7 @@ class PutAliasResponse(msrest.serialization.Model): :ivar type: Resource type, Microsoft.Subscription/aliases. :vartype type: str :param properties: Put Alias response properties. - :type properties: ~subscription_client.models.PutAliasResponseProperties + :type properties: ~azure.mgmt.subscription.models.PutAliasResponseProperties """ _validation = { @@ -416,7 +416,7 @@ class PutAliasResponseProperties(msrest.serialization.Model): :vartype subscription_id: str :param provisioning_state: The provisioning state of the resource. Possible values include: "Accepted", "Succeeded", "Failed". - :type provisioning_state: str or ~subscription_client.models.ProvisioningState + :type provisioning_state: str or ~azure.mgmt.subscription.models.ProvisioningState """ _validation = { @@ -478,9 +478,9 @@ class Subscription(msrest.serialization.Model): :vartype display_name: str :ivar state: The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted. Possible values include: "Enabled", "Warned", "PastDue", "Disabled", "Deleted". - :vartype state: str or ~subscription_client.models.SubscriptionState + :vartype state: str or ~azure.mgmt.subscription.models.SubscriptionState :param subscription_policies: The subscription policies. - :type subscription_policies: ~subscription_client.models.SubscriptionPolicies + :type subscription_policies: ~azure.mgmt.subscription.models.SubscriptionPolicies :param authorization_source: The authorization source of the request. Valid values are one or more combinations of Legacy, RoleBased, Bypassed, Direct and Management. For example, 'Legacy, RoleBased'. @@ -525,7 +525,7 @@ class SubscriptionListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param value: An array of subscriptions. - :type value: list[~subscription_client.models.Subscription] + :type value: list[~azure.mgmt.subscription.models.Subscription] :param next_link: Required. The URL to get the next set of results. :type next_link: str """ @@ -585,7 +585,7 @@ class SubscriptionPolicies(msrest.serialization.Model): :vartype quota_id: str :ivar spending_limit: The subscription spending limit. Possible values include: "On", "Off", "CurrentPeriodOff". - :vartype spending_limit: str or ~subscription_client.models.SpendingLimit + :vartype spending_limit: str or ~azure.mgmt.subscription.models.SpendingLimit """ _validation = { @@ -647,7 +647,7 @@ class TenantListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param value: An array of tenants. - :type value: list[~subscription_client.models.TenantIdDescription] + :type value: list[~azure.mgmt.subscription.models.TenantIdDescription] :param next_link: Required. The URL to use for getting the next set of results. :type next_link: str """ diff --git a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_alias_operations.py b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_alias_operations.py index 82a74dba009d..36dab8afec11 100644 --- a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_alias_operations.py +++ b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_alias_operations.py @@ -15,7 +15,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -31,14 +31,14 @@ class AliasOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~subscription_client.models + :type models: ~azure.mgmt.subscription.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,11 +49,11 @@ def __init__(self, client, config, serializer, deserializer): def _create_initial( self, alias_name, # type: str - body, # type: "models.PutAliasRequest" + body, # type: "_models.PutAliasRequest" **kwargs # type: Any ): - # type: (...) -> "models.PutAliasResponse" - cls = kwargs.pop('cls', None) # type: ClsType["models.PutAliasResponse"] + # type: (...) -> "_models.PutAliasResponse" + cls = kwargs.pop('cls', None) # type: ClsType["_models.PutAliasResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -87,7 +87,7 @@ def _create_initial( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponseBody, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseBody, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -105,28 +105,30 @@ def _create_initial( def begin_create( self, alias_name, # type: str - body, # type: "models.PutAliasRequest" + body, # type: "_models.PutAliasRequest" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.PutAliasResponse"] + # type: (...) -> LROPoller["_models.PutAliasResponse"] """Create Alias Subscription. - :param alias_name: Alias Name. + :param alias_name: Name for this subscription creation request also known as alias. Note that + this is not the same as subscription name and this doesn’t have any other lifecycle need beyond + the request for subscription creation. :type alias_name: str :param body: - :type body: ~subscription_client.models.PutAliasRequest + :type body: ~azure.mgmt.subscription.models.PutAliasRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either PutAliasResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~subscription_client.models.PutAliasResponse] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.subscription.models.PutAliasResponse] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.PutAliasResponse"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PutAliasResponse"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -150,7 +152,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'aliasName': self._serialize.url("alias_name", alias_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -169,17 +175,19 @@ def get( alias_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PutAliasResponse" + # type: (...) -> "_models.PutAliasResponse" """Get Alias Subscription. - :param alias_name: Alias Name. + :param alias_name: Name for this subscription creation request also known as alias. Note that + this is not the same as subscription name and this doesn’t have any other lifecycle need beyond + the request for subscription creation. :type alias_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PutAliasResponse, or the result of cls(response) - :rtype: ~subscription_client.models.PutAliasResponse + :rtype: ~azure.mgmt.subscription.models.PutAliasResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PutAliasResponse"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PutAliasResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -208,7 +216,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponseBody, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseBody, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PutAliasResponse', pipeline_response) @@ -227,7 +235,9 @@ def delete( # type: (...) -> None """Delete Alias. - :param alias_name: Alias Name. + :param alias_name: Name for this subscription creation request also known as alias. Note that + this is not the same as subscription name and this doesn’t have any other lifecycle need beyond + the request for subscription creation. :type alias_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -263,7 +273,7 @@ def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponseBody, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseBody, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -275,15 +285,15 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> "models.PutAliasListResult" + # type: (...) -> "_models.PutAliasListResult" """Get Alias Subscription. :keyword callable cls: A custom type or function that will be passed the direct response :return: PutAliasListResult, or the result of cls(response) - :rtype: ~subscription_client.models.PutAliasListResult + :rtype: ~azure.mgmt.subscription.models.PutAliasListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PutAliasListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PutAliasListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -308,7 +318,7 @@ def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponseBody, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseBody, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PutAliasListResult', pipeline_response) diff --git a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_operations.py b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_operations.py index a8de683e0452..5ff965c778e7 100644 --- a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_operations.py +++ b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -29,14 +29,14 @@ class Operations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~subscription_client.models + :type models: ~azure.mgmt.subscription.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -48,15 +48,15 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> "models.OperationListResult" + # type: (...) -> "_models.OperationListResult" """Lists all of the available Microsoft.Subscription API operations. :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationListResult, or the result of cls(response) - :rtype: ~subscription_client.models.OperationListResult + :rtype: ~azure.mgmt.subscription.models.OperationListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -81,7 +81,7 @@ def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationListResult', pipeline_response) diff --git a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_subscription_operations.py b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_subscription_operations.py index 41e4e3a98f3a..fdf319538569 100644 --- a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_subscription_operations.py +++ b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_subscription_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -29,14 +29,14 @@ class SubscriptionOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~subscription_client.models + :type models: ~azure.mgmt.subscription.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,17 +49,17 @@ def cancel( subscription_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.CanceledSubscriptionId" + # type: (...) -> "_models.CanceledSubscriptionId" """The operation to cancel a subscription. :param subscription_id: Subscription Id. :type subscription_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CanceledSubscriptionId, or the result of cls(response) - :rtype: ~subscription_client.models.CanceledSubscriptionId + :rtype: ~azure.mgmt.subscription.models.CanceledSubscriptionId :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CanceledSubscriptionId"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CanceledSubscriptionId"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -88,7 +88,7 @@ def cancel( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CanceledSubscriptionId', pipeline_response) @@ -102,22 +102,22 @@ def cancel( def rename( self, subscription_id, # type: str - body, # type: "models.SubscriptionName" + body, # type: "_models.SubscriptionName" **kwargs # type: Any ): - # type: (...) -> "models.RenamedSubscriptionId" + # type: (...) -> "_models.RenamedSubscriptionId" """The operation to rename a subscription. :param subscription_id: Subscription Id. :type subscription_id: str :param body: Subscription Name. - :type body: ~subscription_client.models.SubscriptionName + :type body: ~azure.mgmt.subscription.models.SubscriptionName :keyword callable cls: A custom type or function that will be passed the direct response :return: RenamedSubscriptionId, or the result of cls(response) - :rtype: ~subscription_client.models.RenamedSubscriptionId + :rtype: ~azure.mgmt.subscription.models.RenamedSubscriptionId :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.RenamedSubscriptionId"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RenamedSubscriptionId"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -151,7 +151,7 @@ def rename( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RenamedSubscriptionId', pipeline_response) @@ -167,17 +167,17 @@ def enable( subscription_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.EnabledSubscriptionId" + # type: (...) -> "_models.EnabledSubscriptionId" """The operation to enable a subscription. :param subscription_id: Subscription Id. :type subscription_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: EnabledSubscriptionId, or the result of cls(response) - :rtype: ~subscription_client.models.EnabledSubscriptionId + :rtype: ~azure.mgmt.subscription.models.EnabledSubscriptionId :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.EnabledSubscriptionId"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.EnabledSubscriptionId"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -206,7 +206,7 @@ def enable( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EnabledSubscriptionId', pipeline_response) diff --git a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_subscriptions_operations.py b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_subscriptions_operations.py index 4198de5d2471..2a1839707d11 100644 --- a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_subscriptions_operations.py +++ b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_subscriptions_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -30,14 +30,14 @@ class SubscriptionsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~subscription_client.models + :type models: ~azure.mgmt.subscription.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def list_locations( subscription_id, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.LocationListResult"] + # type: (...) -> Iterable["_models.LocationListResult"] """Gets all available geo-locations. This operation provides all the locations that are available for resource providers; however, @@ -60,10 +60,10 @@ def list_locations( :type subscription_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either LocationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~subscription_client.models.LocationListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.subscription.models.LocationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LocationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LocationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -123,17 +123,17 @@ def get( subscription_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Subscription" + # type: (...) -> "_models.Subscription" """Gets details about a specified subscription. :param subscription_id: The ID of the target subscription. :type subscription_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Subscription, or the result of cls(response) - :rtype: ~subscription_client.models.Subscription + :rtype: ~azure.mgmt.subscription.models.Subscription :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Subscription"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Subscription"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -176,15 +176,15 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.SubscriptionListResult"] + # type: (...) -> Iterable["_models.SubscriptionListResult"] """Gets all subscriptions for a tenant. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SubscriptionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~subscription_client.models.SubscriptionListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.subscription.models.SubscriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SubscriptionListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_tenants_operations.py b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_tenants_operations.py index 9d433ae62466..f3f7b2c9d9cd 100644 --- a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_tenants_operations.py +++ b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_tenants_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -30,14 +30,14 @@ class TenantsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~subscription_client.models + :type models: ~azure.mgmt.subscription.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,15 +49,15 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.TenantListResult"] + # type: (...) -> Iterable["_models.TenantListResult"] """Gets the tenants for your account. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TenantListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~subscription_client.models.TenantListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.subscription.models.TenantListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TenantListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TenantListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError }