diff --git a/src/azure-cli-core/azure/cli/core/_profile.py b/src/azure-cli-core/azure/cli/core/_profile.py index 3b42daf3b0c..3f208e2b0cc 100644 --- a/src/azure-cli-core/azure/cli/core/_profile.py +++ b/src/azure-cli-core/azure/cli/core/_profile.py @@ -75,7 +75,7 @@ _AZ_LOGIN_MESSAGE = "Please run 'az login' to setup account." -_USE_VENDORED_SUBSCRIPTION_SDK = True +_USE_VENDORED_SUBSCRIPTION_SDK = False def load_subscriptions(cli_ctx, all_clouds=False, refresh=False): @@ -301,6 +301,7 @@ def _new_account(self): """Build an empty Subscription which will be used as a tenant account. API version doesn't matter as only specified attributes are preserved by _normalize_properties.""" if _USE_VENDORED_SUBSCRIPTION_SDK: + # pylint: disable=no-name-in-module, import-error from azure.cli.core.vendored_sdks.subscriptions.models import Subscription SubscriptionType = Subscription else: @@ -1047,6 +1048,7 @@ def _get_subscription_client_class(self): # pylint: disable=no-self-use """ if _USE_VENDORED_SUBSCRIPTION_SDK: # Use vendered subscription SDK to decouple from `resource` command module + # pylint: disable=no-name-in-module, import-error from azure.cli.core.vendored_sdks.subscriptions import SubscriptionClient client_type = SubscriptionClient else: diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/__init__.py b/src/azure-cli-core/azure/cli/core/vendored_sdks/__init__.py deleted file mode 100644 index 7ccdb55ab6d..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/__init__.py b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/__init__.py deleted file mode 100644 index a1d3eed7425..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# 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 ._subscription_client import SubscriptionClient -__all__ = ['SubscriptionClient'] - -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/_configuration.py b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/_configuration.py deleted file mode 100644 index 5f293b616b5..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/_configuration.py +++ /dev/null @@ -1,60 +0,0 @@ -# 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 typing import Any - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy - -from ._version import VERSION - - -class SubscriptionClientConfiguration(Configuration): - """Configuration for SubscriptionClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials.TokenCredential - """ - - def __init__( - self, - credential, # type: "TokenCredential" - **kwargs # type: Any - ): - # type: (...) -> None - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - super(SubscriptionClientConfiguration, self).__init__(**kwargs) - - self.credential = credential - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'azure-mgmt-resource/{}'.format(VERSION)) - self._configure(**kwargs) - - def _configure( - self, - **kwargs # type: Any - ): - # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') - if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/_operations_mixin.py b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/_operations_mixin.py deleted file mode 100644 index 1bce276b8fc..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/_operations_mixin.py +++ /dev/null @@ -1,61 +0,0 @@ -# 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 import Serializer, Deserializer -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - -class SubscriptionClientOperationsMixin(object): - - def check_resource_name( - self, - resource_name_definition=None, # type: Optional["models.ResourceName"] - **kwargs # type: Any - ): - """Checks resource name validity. - - A resource name is valid if it is not a reserved word, does not contains a reserved word and - does not start with a reserved word. - - :param resource_name_definition: Resource object with values for resource name and resource - type. - :type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.ResourceName - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckResourceNameResult, or the result of cls(response) - :rtype: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.CheckResourceNameResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = self._get_api_version('check_resource_name') - if api_version == '2016-06-01': - from .v2016_06_01.operations import SubscriptionClientOperationsMixin as OperationClass - elif api_version == '2018-06-01': - from .v2018_06_01.operations import SubscriptionClientOperationsMixin as OperationClass - elif api_version == '2019-06-01': - from .v2019_06_01.operations import SubscriptionClientOperationsMixin as OperationClass - elif api_version == '2019-11-01': - from .v2019_11_01.operations import SubscriptionClientOperationsMixin as OperationClass - else: - raise ValueError("API version {} does not have operation 'check_resource_name'".format(api_version)) - mixin_instance = OperationClass() - mixin_instance._client = self._client - mixin_instance._config = self._config - mixin_instance._serialize = Serializer(self._models_dict(api_version)) - mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) - return mixin_instance.check_resource_name(resource_name_definition, **kwargs) diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/_subscription_client.py b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/_subscription_client.py deleted file mode 100644 index 5ae49b182bb..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/_subscription_client.py +++ /dev/null @@ -1,171 +0,0 @@ -# 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 azure.mgmt.core import ARMPipelineClient -from msrest import Serializer, Deserializer - -from azure.profiles import KnownProfiles, ProfileDefinition -from azure.profiles.multiapiclient import MultiApiClientMixin -from ._configuration import SubscriptionClientConfiguration -from ._operations_mixin import SubscriptionClientOperationsMixin -class _SDKClient(object): - def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." - Will be removed in final version of multiapi azure-core based client - """ - pass - -class SubscriptionClient(SubscriptionClientOperationsMixin, MultiApiClientMixin, _SDKClient): - """All resource groups and resources exist within subscriptions. These operation enable you get information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your organization. - - This ready contains multiple API versions, to help you deal with all of the Azure clouds - (Azure Stack, Azure Government, Azure China, etc.). - By default, it uses the latest API version available on public Azure. - For production, you should stick to a particular api-version and/or profile. - The profile sets a mapping between an operation group and its API version. - The api-version parameter sets the default API version if the operation - group is not described in the profile. - - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials.TokenCredential - :param str api_version: API version to use if no profile is provided, or if - missing in profile. - :param str base_url: Service URL - :param profile: A profile definition, from KnownProfiles to dict. - :type profile: azure.profiles.KnownProfiles - """ - - DEFAULT_API_VERSION = '2019-11-01' - _PROFILE_TAG = "azure.mgmt.resource.SubscriptionClient" - LATEST_PROFILE = ProfileDefinition({ - _PROFILE_TAG: { - None: DEFAULT_API_VERSION, - }}, - _PROFILE_TAG + " latest" - ) - - def __init__( - self, - credential, # type: "TokenCredential" - api_version=None, - base_url=None, - profile=KnownProfiles.default, - **kwargs # type: Any - ): - if not base_url: - base_url = 'https://management.azure.com' - self._config = SubscriptionClientConfiguration(credential, **kwargs) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - super(SubscriptionClient, self).__init__( - api_version=api_version, - profile=profile - ) - - @classmethod - def _models_dict(cls, api_version): - return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)} - - @classmethod - def models(cls, api_version=DEFAULT_API_VERSION): - """Module depends on the API version: - - * 2016-06-01: :mod:`v2016_06_01.models` - * 2018-06-01: :mod:`v2018_06_01.models` - * 2019-06-01: :mod:`v2019_06_01.models` - * 2019-11-01: :mod:`v2019_11_01.models` - """ - if api_version == '2016-06-01': - from .v2016_06_01 import models - return models - elif api_version == '2018-06-01': - from .v2018_06_01 import models - return models - elif api_version == '2019-06-01': - from .v2019_06_01 import models - return models - elif api_version == '2019-11-01': - from .v2019_11_01 import models - return models - raise ValueError("API version {} is not available".format(api_version)) - - @property - def operations(self): - """Instance depends on the API version: - - * 2016-06-01: :class:`Operations` - * 2018-06-01: :class:`Operations` - * 2019-06-01: :class:`Operations` - * 2019-11-01: :class:`Operations` - """ - api_version = self._get_api_version('operations') - if api_version == '2016-06-01': - from .v2016_06_01.operations import Operations as OperationClass - elif api_version == '2018-06-01': - from .v2018_06_01.operations import Operations as OperationClass - elif api_version == '2019-06-01': - from .v2019_06_01.operations import Operations as OperationClass - elif api_version == '2019-11-01': - from .v2019_11_01.operations import Operations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - - @property - def subscriptions(self): - """Instance depends on the API version: - - * 2016-06-01: :class:`SubscriptionsOperations` - * 2018-06-01: :class:`SubscriptionsOperations` - * 2019-06-01: :class:`SubscriptionsOperations` - * 2019-11-01: :class:`SubscriptionsOperations` - """ - api_version = self._get_api_version('subscriptions') - if api_version == '2016-06-01': - from .v2016_06_01.operations import SubscriptionsOperations as OperationClass - elif api_version == '2018-06-01': - from .v2018_06_01.operations import SubscriptionsOperations as OperationClass - elif api_version == '2019-06-01': - from .v2019_06_01.operations import SubscriptionsOperations as OperationClass - elif api_version == '2019-11-01': - from .v2019_11_01.operations import SubscriptionsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'subscriptions'".format(api_version)) - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - - @property - def tenants(self): - """Instance depends on the API version: - - * 2016-06-01: :class:`TenantsOperations` - * 2018-06-01: :class:`TenantsOperations` - * 2019-06-01: :class:`TenantsOperations` - * 2019-11-01: :class:`TenantsOperations` - """ - api_version = self._get_api_version('tenants') - if api_version == '2016-06-01': - from .v2016_06_01.operations import TenantsOperations as OperationClass - elif api_version == '2018-06-01': - from .v2018_06_01.operations import TenantsOperations as OperationClass - elif api_version == '2019-06-01': - from .v2019_06_01.operations import TenantsOperations as OperationClass - elif api_version == '2019-11-01': - from .v2019_11_01.operations import TenantsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'tenants'".format(api_version)) - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - - def close(self): - self._client.close() - def __enter__(self): - self._client.__enter__() - return self - def __exit__(self, *exc_details): - self._client.__exit__(*exc_details) diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/_version.py b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/_version.py deleted file mode 100644 index a30a458f8b5..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/_version.py +++ /dev/null @@ -1,8 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -VERSION = "0.1.0" \ No newline at end of file diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/models.py b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/models.py deleted file mode 100644 index 28ba9b61c72..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/models.py +++ /dev/null @@ -1,7 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- -from .v2019_11_01.models import * diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/py.typed b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/py.typed deleted file mode 100644 index e5aff4f83af..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/__init__.py b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/__init__.py deleted file mode 100644 index a1d3eed7425..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# 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 ._subscription_client import SubscriptionClient -__all__ = ['SubscriptionClient'] - -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/_configuration.py b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/_configuration.py deleted file mode 100644 index 362180e421d..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/_configuration.py +++ /dev/null @@ -1,64 +0,0 @@ -# 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 typing import TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy - -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. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials.TokenCredential - """ - - def __init__( - self, - credential, # type: "TokenCredential" - **kwargs # type: Any - ): - # type: (...) -> None - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - super(SubscriptionClientConfiguration, self).__init__(**kwargs) - - self.credential = credential - self.api_version = "2016-06-01" - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-resource/{}'.format(VERSION)) - self._configure(**kwargs) - - def _configure( - self, - **kwargs # type: Any - ): - # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') - if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/_metadata.json b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/_metadata.json deleted file mode 100644 index 82aa0c625bb..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/_metadata.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "chosen_version": "2016-06-01", - "total_api_version_list": ["2016-06-01"], - "client": { - "name": "SubscriptionClient", - "filename": "_subscription_client", - "description": "All resource groups and resources exist within subscriptions. These operation enable you get information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your organization.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, - "azure_arm": true, - "has_lro_operations": false - }, - "global_parameters": { - "sync_method": { - "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true - } - }, - "async_method": { - "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - } - }, - "constant": { - }, - "call": "credential" - }, - "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 - }, - "operation_groups": { - "operations": "Operations", - "subscriptions": "SubscriptionsOperations", - "tenants": "TenantsOperations" - }, - "operation_mixins": { - "check_resource_name" : { - "sync": { - "signature": "def check_resource_name(\n self,\n resource_name_definition=None, # type: Optional[\"models.ResourceName\"]\n **kwargs # type: Any\n):\n", - "doc": "\"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type.\n:type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.ResourceName\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult, or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.CheckResourceNameResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "async": { - "coroutine": true, - "signature": "async def check_resource_name(\n self,\n resource_name_definition: Optional[\"models.ResourceName\"] = None,\n **kwargs\n) -\u003e \"models.CheckResourceNameResult\":\n", - "doc": "\"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type.\n:type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.ResourceName\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult, or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.CheckResourceNameResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "resource_name_definition" - } - }, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"ClientAuthenticationError\", \"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"ClientAuthenticationError\", \"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}" -} \ No newline at end of file diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/_subscription_client.py b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/_subscription_client.py deleted file mode 100644 index 4ea5a929ebe..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/_subscription_client.py +++ /dev/null @@ -1,77 +0,0 @@ -# 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 typing import TYPE_CHECKING - -from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - - from azure.core.credentials import TokenCredential - -from ._configuration import SubscriptionClientConfiguration -from .operations import Operations -from .operations import SubscriptionsOperations -from .operations import TenantsOperations -from .operations import SubscriptionClientOperationsMixin -from . import models - - -class SubscriptionClient(SubscriptionClientOperationsMixin): - """All resource groups and resources exist within subscriptions. These operation enable you get information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your organization. - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.resource.subscriptions.v2016_06_01.operations.Operations - :ivar subscriptions: SubscriptionsOperations operations - :vartype subscriptions: azure.mgmt.resource.subscriptions.v2016_06_01.operations.SubscriptionsOperations - :ivar tenants: TenantsOperations operations - :vartype tenants: azure.mgmt.resource.subscriptions.v2016_06_01.operations.TenantsOperations - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials.TokenCredential - :param str base_url: Service URL - """ - - def __init__( - self, - credential, # type: "TokenCredential" - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = SubscriptionClientConfiguration(credential, **kwargs) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False - self._deserialize = Deserializer(client_models) - - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.subscriptions = SubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tenants = TenantsOperations( - self._client, self._config, self._serialize, self._deserialize) - - def close(self): - # type: () -> None - self._client.close() - - def __enter__(self): - # type: () -> SubscriptionClient - self._client.__enter__() - return self - - def __exit__(self, *exc_details): - # type: (Any) -> None - self._client.__exit__(*exc_details) diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/models/__init__.py b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/models/__init__.py deleted file mode 100644 index 4d3bb8b7d25..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/models/__init__.py +++ /dev/null @@ -1,64 +0,0 @@ -# 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 CheckResourceNameResult - from ._models_py3 import ErrorDefinition - from ._models_py3 import ErrorResponse - from ._models_py3 import Location - from ._models_py3 import LocationListResult - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import ResourceName - from ._models_py3 import Subscription - from ._models_py3 import SubscriptionListResult - from ._models_py3 import SubscriptionPolicies - from ._models_py3 import TenantIdDescription - from ._models_py3 import TenantListResult -except (SyntaxError, ImportError): - from ._models import CheckResourceNameResult # type: ignore - from ._models import ErrorDefinition # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import Location # type: ignore - from ._models import LocationListResult # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import ResourceName # type: ignore - from ._models import Subscription # type: ignore - from ._models import SubscriptionListResult # type: ignore - from ._models import SubscriptionPolicies # type: ignore - from ._models import TenantIdDescription # type: ignore - from ._models import TenantListResult # type: ignore - -from ._subscription_client_enums import ( - ResourceNameStatus, - SpendingLimit, - SubscriptionState, -) - -__all__ = [ - 'CheckResourceNameResult', - 'ErrorDefinition', - 'ErrorResponse', - 'Location', - 'LocationListResult', - 'Operation', - 'OperationDisplay', - 'OperationListResult', - 'ResourceName', - 'Subscription', - 'SubscriptionListResult', - 'SubscriptionPolicies', - 'TenantIdDescription', - 'TenantListResult', - 'ResourceNameStatus', - 'SpendingLimit', - 'SubscriptionState', -] diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/models/_models.py b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/models/_models.py deleted file mode 100644 index 011eca63f95..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/models/_models.py +++ /dev/null @@ -1,438 +0,0 @@ -# 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 azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class CheckResourceNameResult(msrest.serialization.Model): - """Resource Name valid if not a reserved word, does not contain a reserved word and does not start with a reserved word. - - :param name: Name of Resource. - :type name: str - :param type: Type of Resource. - :type type: str - :param status: Is the resource name Allowed or Reserved. Possible values include: "Allowed", - "Reserved". - :type status: str or ~azure.mgmt.resource.subscriptions.v2016_06_01.models.ResourceNameStatus - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckResourceNameResult, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) - self.status = kwargs.get('status', None) - - -class ErrorDefinition(msrest.serialization.Model): - """Error description and code explaining why resource name is invalid. - - :param message: Description of the error. - :type message: str - :param code: Code of the error. - :type code: str - """ - - _attribute_map = { - 'message': {'key': 'message', 'type': 'str'}, - 'code': {'key': 'code', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorDefinition, self).__init__(**kwargs) - self.message = kwargs.get('message', None) - self.code = kwargs.get('code', None) - - -class ErrorResponse(msrest.serialization.Model): - """Error response. - - :param error: The error details. - :type error: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.ErrorDefinition - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class Location(msrest.serialization.Model): - """Location information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The fully qualified ID of the location. For example, - /subscriptions/00000000-0000-0000-0000-000000000000/locations/westus. - :vartype id: str - :ivar subscription_id: The subscription ID. - :vartype subscription_id: str - :ivar name: The location name. - :vartype name: str - :ivar display_name: The display name of the location. - :vartype display_name: str - :ivar latitude: The latitude of the location. - :vartype latitude: str - :ivar longitude: The longitude of the location. - :vartype longitude: str - """ - - _validation = { - 'id': {'readonly': True}, - 'subscription_id': {'readonly': True}, - 'name': {'readonly': True}, - 'display_name': {'readonly': True}, - 'latitude': {'readonly': True}, - 'longitude': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'latitude': {'key': 'latitude', 'type': 'str'}, - 'longitude': {'key': 'longitude', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Location, self).__init__(**kwargs) - self.id = None - self.subscription_id = None - self.name = None - self.display_name = None - self.latitude = None - self.longitude = None - - -class LocationListResult(msrest.serialization.Model): - """Location list operation response. - - :param value: An array of locations. - :type value: list[~azure.mgmt.resource.subscriptions.v2016_06_01.models.Location] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Location]'}, - } - - def __init__( - self, - **kwargs - ): - super(LocationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class Operation(msrest.serialization.Model): - """Microsoft.Resources operation. - - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The object that represents the operation. - :type display: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.OperationDisplay - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - - -class OperationDisplay(msrest.serialization.Model): - """The object that represents the operation. - - :param provider: Service provider: Microsoft.Resources. - :type provider: str - :param resource: Resource on which the operation is performed: Profile, endpoint, etc. - :type resource: str - :param operation: Operation type: Read, write, delete, etc. - :type operation: str - :param description: Description of the operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.Model): - """Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get the next set of results. - - :param value: List of Microsoft.Resources operations. - :type value: list[~azure.mgmt.resource.subscriptions.v2016_06_01.models.Operation] - :param next_link: URL to get the next set of operation list results if there are any. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ResourceName(msrest.serialization.Model): - """Name and Type of the Resource. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Name of the resource. - :type name: str - :param type: Required. The type of the resource. - :type type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceName, self).__init__(**kwargs) - self.name = kwargs['name'] - self.type = kwargs['type'] - - -class Subscription(msrest.serialization.Model): - """Subscription information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The fully qualified ID for the subscription. For example, - /subscriptions/00000000-0000-0000-0000-000000000000. - :vartype id: str - :ivar subscription_id: The subscription ID. - :vartype subscription_id: str - :ivar display_name: The subscription display name. - :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 ~azure.mgmt.resource.subscriptions.v2016_06_01.models.SubscriptionState - :param subscription_policies: The subscription policies. - :type subscription_policies: - ~azure.mgmt.resource.subscriptions.v2016_06_01.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'. - :type authorization_source: str - """ - - _validation = { - 'id': {'readonly': True}, - 'subscription_id': {'readonly': True}, - 'display_name': {'readonly': True}, - 'state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'subscription_policies': {'key': 'subscriptionPolicies', 'type': 'SubscriptionPolicies'}, - 'authorization_source': {'key': 'authorizationSource', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Subscription, self).__init__(**kwargs) - self.id = None - self.subscription_id = None - self.display_name = None - self.state = None - self.subscription_policies = kwargs.get('subscription_policies', None) - self.authorization_source = kwargs.get('authorization_source', None) - - -class SubscriptionListResult(msrest.serialization.Model): - """Subscription list operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: An array of subscriptions. - :type value: list[~azure.mgmt.resource.subscriptions.v2016_06_01.models.Subscription] - :param next_link: Required. The URL to get the next set of results. - :type next_link: str - """ - - _validation = { - 'next_link': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Subscription]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SubscriptionListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs['next_link'] - - -class SubscriptionPolicies(msrest.serialization.Model): - """Subscription policies. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar location_placement_id: The subscription location placement ID. The ID indicates which - regions are visible for a subscription. For example, a subscription with a location placement - Id of Public_2014-09-01 has access to Azure public regions. - :vartype location_placement_id: str - :ivar quota_id: The subscription quota ID. - :vartype quota_id: str - :ivar spending_limit: The subscription spending limit. Possible values include: "On", "Off", - "CurrentPeriodOff". - :vartype spending_limit: str or - ~azure.mgmt.resource.subscriptions.v2016_06_01.models.SpendingLimit - """ - - _validation = { - 'location_placement_id': {'readonly': True}, - 'quota_id': {'readonly': True}, - 'spending_limit': {'readonly': True}, - } - - _attribute_map = { - 'location_placement_id': {'key': 'locationPlacementId', 'type': 'str'}, - 'quota_id': {'key': 'quotaId', 'type': 'str'}, - 'spending_limit': {'key': 'spendingLimit', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SubscriptionPolicies, self).__init__(**kwargs) - self.location_placement_id = None - self.quota_id = None - self.spending_limit = None - - -class TenantIdDescription(msrest.serialization.Model): - """Tenant Id information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The fully qualified ID of the tenant. For example, - /tenants/00000000-0000-0000-0000-000000000000. - :vartype id: str - :ivar tenant_id: The tenant ID. For example, 00000000-0000-0000-0000-000000000000. - :vartype tenant_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TenantIdDescription, self).__init__(**kwargs) - self.id = None - self.tenant_id = None - - -class TenantListResult(msrest.serialization.Model): - """Tenant Ids information. - - All required parameters must be populated in order to send to Azure. - - :param value: An array of tenants. - :type value: list[~azure.mgmt.resource.subscriptions.v2016_06_01.models.TenantIdDescription] - :param next_link: Required. The URL to use for getting the next set of results. - :type next_link: str - """ - - _validation = { - 'next_link': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[TenantIdDescription]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TenantListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs['next_link'] diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/models/_models_py3.py b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/models/_models_py3.py deleted file mode 100644 index b6e20cf666d..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/models/_models_py3.py +++ /dev/null @@ -1,476 +0,0 @@ -# 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 typing import List, Optional, Union - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - -from ._subscription_client_enums import * - - -class CheckResourceNameResult(msrest.serialization.Model): - """Resource Name valid if not a reserved word, does not contain a reserved word and does not start with a reserved word. - - :param name: Name of Resource. - :type name: str - :param type: Type of Resource. - :type type: str - :param status: Is the resource name Allowed or Reserved. Possible values include: "Allowed", - "Reserved". - :type status: str or ~azure.mgmt.resource.subscriptions.v2016_06_01.models.ResourceNameStatus - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - type: Optional[str] = None, - status: Optional[Union[str, "ResourceNameStatus"]] = None, - **kwargs - ): - super(CheckResourceNameResult, self).__init__(**kwargs) - self.name = name - self.type = type - self.status = status - - -class ErrorDefinition(msrest.serialization.Model): - """Error description and code explaining why resource name is invalid. - - :param message: Description of the error. - :type message: str - :param code: Code of the error. - :type code: str - """ - - _attribute_map = { - 'message': {'key': 'message', 'type': 'str'}, - 'code': {'key': 'code', 'type': 'str'}, - } - - def __init__( - self, - *, - message: Optional[str] = None, - code: Optional[str] = None, - **kwargs - ): - super(ErrorDefinition, self).__init__(**kwargs) - self.message = message - self.code = code - - -class ErrorResponse(msrest.serialization.Model): - """Error response. - - :param error: The error details. - :type error: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.ErrorDefinition - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDefinition'}, - } - - def __init__( - self, - *, - error: Optional["ErrorDefinition"] = None, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = error - - -class Location(msrest.serialization.Model): - """Location information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The fully qualified ID of the location. For example, - /subscriptions/00000000-0000-0000-0000-000000000000/locations/westus. - :vartype id: str - :ivar subscription_id: The subscription ID. - :vartype subscription_id: str - :ivar name: The location name. - :vartype name: str - :ivar display_name: The display name of the location. - :vartype display_name: str - :ivar latitude: The latitude of the location. - :vartype latitude: str - :ivar longitude: The longitude of the location. - :vartype longitude: str - """ - - _validation = { - 'id': {'readonly': True}, - 'subscription_id': {'readonly': True}, - 'name': {'readonly': True}, - 'display_name': {'readonly': True}, - 'latitude': {'readonly': True}, - 'longitude': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'latitude': {'key': 'latitude', 'type': 'str'}, - 'longitude': {'key': 'longitude', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Location, self).__init__(**kwargs) - self.id = None - self.subscription_id = None - self.name = None - self.display_name = None - self.latitude = None - self.longitude = None - - -class LocationListResult(msrest.serialization.Model): - """Location list operation response. - - :param value: An array of locations. - :type value: list[~azure.mgmt.resource.subscriptions.v2016_06_01.models.Location] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Location]'}, - } - - def __init__( - self, - *, - value: Optional[List["Location"]] = None, - **kwargs - ): - super(LocationListResult, self).__init__(**kwargs) - self.value = value - - -class Operation(msrest.serialization.Model): - """Microsoft.Resources operation. - - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The object that represents the operation. - :type display: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.OperationDisplay - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display: Optional["OperationDisplay"] = None, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = name - self.display = display - - -class OperationDisplay(msrest.serialization.Model): - """The object that represents the operation. - - :param provider: Service provider: Microsoft.Resources. - :type provider: str - :param resource: Resource on which the operation is performed: Profile, endpoint, etc. - :type resource: str - :param operation: Operation type: Read, write, delete, etc. - :type operation: str - :param description: Description of the operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - *, - provider: Optional[str] = None, - resource: Optional[str] = None, - operation: Optional[str] = None, - description: Optional[str] = None, - **kwargs - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationListResult(msrest.serialization.Model): - """Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get the next set of results. - - :param value: List of Microsoft.Resources operations. - :type value: list[~azure.mgmt.resource.subscriptions.v2016_06_01.models.Operation] - :param next_link: URL to get the next set of operation list results if there are any. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["Operation"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ResourceName(msrest.serialization.Model): - """Name and Type of the Resource. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Name of the resource. - :type name: str - :param type: Required. The type of the resource. - :type type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - *, - name: str, - type: str, - **kwargs - ): - super(ResourceName, self).__init__(**kwargs) - self.name = name - self.type = type - - -class Subscription(msrest.serialization.Model): - """Subscription information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The fully qualified ID for the subscription. For example, - /subscriptions/00000000-0000-0000-0000-000000000000. - :vartype id: str - :ivar subscription_id: The subscription ID. - :vartype subscription_id: str - :ivar display_name: The subscription display name. - :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 ~azure.mgmt.resource.subscriptions.v2016_06_01.models.SubscriptionState - :param subscription_policies: The subscription policies. - :type subscription_policies: - ~azure.mgmt.resource.subscriptions.v2016_06_01.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'. - :type authorization_source: str - """ - - _validation = { - 'id': {'readonly': True}, - 'subscription_id': {'readonly': True}, - 'display_name': {'readonly': True}, - 'state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'subscription_policies': {'key': 'subscriptionPolicies', 'type': 'SubscriptionPolicies'}, - 'authorization_source': {'key': 'authorizationSource', 'type': 'str'}, - } - - def __init__( - self, - *, - subscription_policies: Optional["SubscriptionPolicies"] = None, - authorization_source: Optional[str] = None, - **kwargs - ): - super(Subscription, self).__init__(**kwargs) - self.id = None - self.subscription_id = None - self.display_name = None - self.state = None - self.subscription_policies = subscription_policies - self.authorization_source = authorization_source - - -class SubscriptionListResult(msrest.serialization.Model): - """Subscription list operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: An array of subscriptions. - :type value: list[~azure.mgmt.resource.subscriptions.v2016_06_01.models.Subscription] - :param next_link: Required. The URL to get the next set of results. - :type next_link: str - """ - - _validation = { - 'next_link': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Subscription]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - next_link: str, - value: Optional[List["Subscription"]] = None, - **kwargs - ): - super(SubscriptionListResult, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SubscriptionPolicies(msrest.serialization.Model): - """Subscription policies. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar location_placement_id: The subscription location placement ID. The ID indicates which - regions are visible for a subscription. For example, a subscription with a location placement - Id of Public_2014-09-01 has access to Azure public regions. - :vartype location_placement_id: str - :ivar quota_id: The subscription quota ID. - :vartype quota_id: str - :ivar spending_limit: The subscription spending limit. Possible values include: "On", "Off", - "CurrentPeriodOff". - :vartype spending_limit: str or - ~azure.mgmt.resource.subscriptions.v2016_06_01.models.SpendingLimit - """ - - _validation = { - 'location_placement_id': {'readonly': True}, - 'quota_id': {'readonly': True}, - 'spending_limit': {'readonly': True}, - } - - _attribute_map = { - 'location_placement_id': {'key': 'locationPlacementId', 'type': 'str'}, - 'quota_id': {'key': 'quotaId', 'type': 'str'}, - 'spending_limit': {'key': 'spendingLimit', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SubscriptionPolicies, self).__init__(**kwargs) - self.location_placement_id = None - self.quota_id = None - self.spending_limit = None - - -class TenantIdDescription(msrest.serialization.Model): - """Tenant Id information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The fully qualified ID of the tenant. For example, - /tenants/00000000-0000-0000-0000-000000000000. - :vartype id: str - :ivar tenant_id: The tenant ID. For example, 00000000-0000-0000-0000-000000000000. - :vartype tenant_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TenantIdDescription, self).__init__(**kwargs) - self.id = None - self.tenant_id = None - - -class TenantListResult(msrest.serialization.Model): - """Tenant Ids information. - - All required parameters must be populated in order to send to Azure. - - :param value: An array of tenants. - :type value: list[~azure.mgmt.resource.subscriptions.v2016_06_01.models.TenantIdDescription] - :param next_link: Required. The URL to use for getting the next set of results. - :type next_link: str - """ - - _validation = { - 'next_link': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[TenantIdDescription]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - next_link: str, - value: Optional[List["TenantIdDescription"]] = None, - **kwargs - ): - super(TenantListResult, self).__init__(**kwargs) - self.value = value - self.next_link = next_link diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/models/_subscription_client_enums.py b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/models/_subscription_client_enums.py deleted file mode 100644 index cec9f01471e..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/models/_subscription_client_enums.py +++ /dev/null @@ -1,52 +0,0 @@ -# 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, EnumMeta -from six import with_metaclass - -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class ResourceNameStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Is the resource name Allowed or Reserved - """ - - ALLOWED = "Allowed" - RESERVED = "Reserved" - -class SpendingLimit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The subscription spending limit. - """ - - ON = "On" - OFF = "Off" - CURRENT_PERIOD_OFF = "CurrentPeriodOff" - -class SubscriptionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted. - """ - - ENABLED = "Enabled" - WARNED = "Warned" - PAST_DUE = "PastDue" - DISABLED = "Disabled" - DELETED = "Deleted" diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/operations/__init__.py b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/operations/__init__.py deleted file mode 100644 index 228a89205db..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/operations/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# 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 ._operations import Operations -from ._subscriptions_operations import SubscriptionsOperations -from ._tenants_operations import TenantsOperations -from ._subscription_client_operations import SubscriptionClientOperationsMixin - -__all__ = [ - 'Operations', - 'SubscriptionsOperations', - 'TenantsOperations', - 'SubscriptionClientOperationsMixin', -] diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/operations/_operations.py b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/operations/_operations.py deleted file mode 100644 index 5ecdee7b607..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/operations/_operations.py +++ /dev/null @@ -1,109 +0,0 @@ -# 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 typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.resource.subscriptions.v2016_06_01.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 - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.OperationListResult"] - """Lists all of the available Microsoft.Resources REST API operations. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.subscriptions.v2016_06_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/providers/Microsoft.Resources/operations'} # type: ignore diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/operations/_subscription_client_operations.py b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/operations/_subscription_client_operations.py deleted file mode 100644 index 48bf0371300..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/operations/_subscription_client_operations.py +++ /dev/null @@ -1,88 +0,0 @@ -# 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 typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class SubscriptionClientOperationsMixin(object): - - def check_resource_name( - self, - resource_name_definition=None, # type: Optional["models.ResourceName"] - **kwargs # type: Any - ): - # type: (...) -> "models.CheckResourceNameResult" - """Checks resource name validity. - - A resource name is valid if it is not a reserved word, does not contains a reserved word and - does not start with a reserved word. - - :param resource_name_definition: Resource object with values for resource name and resource - type. - :type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.ResourceName - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckResourceNameResult, or the result of cls(response) - :rtype: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.CheckResourceNameResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckResourceNameResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_resource_name.metadata['url'] # type: ignore - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - if resource_name_definition is not None: - body_content = self._serialize.body(resource_name_definition, 'ResourceName') - else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - 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) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CheckResourceNameResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - check_resource_name.metadata = {'url': '/providers/Microsoft.Resources/checkResourceName'} # type: ignore diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/operations/_subscriptions_operations.py b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/operations/_subscriptions_operations.py deleted file mode 100644 index 97e7851ece6..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/operations/_subscriptions_operations.py +++ /dev/null @@ -1,236 +0,0 @@ -# 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 typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class SubscriptionsOperations(object): - """SubscriptionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.resource.subscriptions.v2016_06_01.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 - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list_locations( - self, - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.LocationListResult"] - """Gets all available geo-locations. - - This operation provides all the locations that are available for resource providers; however, - each resource provider may support a subset of this list. - - :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: An iterator like instance of either LocationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.subscriptions.v2016_06_01.models.LocationListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LocationListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list_locations.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('LocationListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_locations.metadata = {'url': '/subscriptions/{subscriptionId}/locations'} # type: ignore - - def get( - self, - subscription_id, # type: str - **kwargs # type: Any - ): - # 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: ~azure.mgmt.resource.subscriptions.v2016_06_01.models.Subscription - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Subscription"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Subscription', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}'} # type: ignore - - def list( - self, - **kwargs # type: Any - ): - # 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[~azure.mgmt.resource.subscriptions.v2016_06_01.models.SubscriptionListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SubscriptionListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('SubscriptionListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions'} # type: ignore diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/operations/_tenants_operations.py b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/operations/_tenants_operations.py deleted file mode 100644 index 3a4ec17c755..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/operations/_tenants_operations.py +++ /dev/null @@ -1,109 +0,0 @@ -# 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 typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class TenantsOperations(object): - """TenantsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.resource.subscriptions.v2016_06_01.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 - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - **kwargs # type: Any - ): - # 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[~azure.mgmt.resource.subscriptions.v2016_06_01.models.TenantListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TenantListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('TenantListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/tenants'} # type: ignore diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/py.typed b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/py.typed deleted file mode 100644 index e5aff4f83af..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2016_06_01/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/__init__.py b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/__init__.py deleted file mode 100644 index a1d3eed7425..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# 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 ._subscription_client import SubscriptionClient -__all__ = ['SubscriptionClient'] - -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/_configuration.py b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/_configuration.py deleted file mode 100644 index fe418b780a3..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/_configuration.py +++ /dev/null @@ -1,64 +0,0 @@ -# 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 typing import TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy - -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. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials.TokenCredential - """ - - def __init__( - self, - credential, # type: "TokenCredential" - **kwargs # type: Any - ): - # type: (...) -> None - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - super(SubscriptionClientConfiguration, self).__init__(**kwargs) - - self.credential = credential - self.api_version = "2019-11-01" - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-resource/{}'.format(VERSION)) - self._configure(**kwargs) - - def _configure( - self, - **kwargs # type: Any - ): - # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') - if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/_metadata.json b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/_metadata.json deleted file mode 100644 index f156f87e352..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/_metadata.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "chosen_version": "2019-11-01", - "total_api_version_list": ["2019-11-01"], - "client": { - "name": "SubscriptionClient", - "filename": "_subscription_client", - "description": "All resource groups and resources exist within subscriptions. These operation enable you get information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your organization.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, - "azure_arm": true, - "has_lro_operations": false - }, - "global_parameters": { - "sync_method": { - "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true - } - }, - "async_method": { - "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - } - }, - "constant": { - }, - "call": "credential" - }, - "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 - }, - "operation_groups": { - "operations": "Operations", - "subscriptions": "SubscriptionsOperations", - "tenants": "TenantsOperations" - }, - "operation_mixins": { - "check_resource_name" : { - "sync": { - "signature": "def check_resource_name(\n self,\n resource_name_definition=None, # type: Optional[\"models.ResourceName\"]\n **kwargs # type: Any\n):\n", - "doc": "\"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type.\n:type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.ResourceName\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult, or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.CheckResourceNameResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "async": { - "coroutine": true, - "signature": "async def check_resource_name(\n self,\n resource_name_definition: Optional[\"models.ResourceName\"] = None,\n **kwargs\n) -\u003e \"models.CheckResourceNameResult\":\n", - "doc": "\"\"\"Checks resource name validity.\n\nA resource name is valid if it is not a reserved word, does not contains a reserved word and\ndoes not start with a reserved word.\n\n:param resource_name_definition: Resource object with values for resource name and resource\n type.\n:type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.ResourceName\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CheckResourceNameResult, or the result of cls(response)\n:rtype: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.CheckResourceNameResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "resource_name_definition" - } - }, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"ClientAuthenticationError\", \"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"ClientAuthenticationError\", \"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}" -} \ No newline at end of file diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/_subscription_client.py b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/_subscription_client.py deleted file mode 100644 index c5a657890a8..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/_subscription_client.py +++ /dev/null @@ -1,77 +0,0 @@ -# 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 typing import TYPE_CHECKING - -from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - - from azure.core.credentials import TokenCredential - -from ._configuration import SubscriptionClientConfiguration -from .operations import Operations -from .operations import SubscriptionsOperations -from .operations import TenantsOperations -from .operations import SubscriptionClientOperationsMixin -from . import models - - -class SubscriptionClient(SubscriptionClientOperationsMixin): - """All resource groups and resources exist within subscriptions. These operation enable you get information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your organization. - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.resource.subscriptions.v2019_11_01.operations.Operations - :ivar subscriptions: SubscriptionsOperations operations - :vartype subscriptions: azure.mgmt.resource.subscriptions.v2019_11_01.operations.SubscriptionsOperations - :ivar tenants: TenantsOperations operations - :vartype tenants: azure.mgmt.resource.subscriptions.v2019_11_01.operations.TenantsOperations - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials.TokenCredential - :param str base_url: Service URL - """ - - def __init__( - self, - credential, # type: "TokenCredential" - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = SubscriptionClientConfiguration(credential, **kwargs) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False - self._deserialize = Deserializer(client_models) - - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.subscriptions = SubscriptionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.tenants = TenantsOperations( - self._client, self._config, self._serialize, self._deserialize) - - def close(self): - # type: () -> None - self._client.close() - - def __enter__(self): - # type: () -> SubscriptionClient - self._client.__enter__() - return self - - def __exit__(self, *exc_details): - # type: (Any) -> None - self._client.__exit__(*exc_details) diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/models/__init__.py b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/models/__init__.py deleted file mode 100644 index 961846b3a32..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/models/__init__.py +++ /dev/null @@ -1,79 +0,0 @@ -# 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 CheckResourceNameResult - from ._models_py3 import ErrorDefinition - from ._models_py3 import ErrorResponse - from ._models_py3 import Location - from ._models_py3 import LocationListResult - from ._models_py3 import LocationMetadata - from ._models_py3 import ManagedByTenant - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import PairedRegion - from ._models_py3 import ResourceName - from ._models_py3 import Subscription - from ._models_py3 import SubscriptionListResult - from ._models_py3 import SubscriptionPolicies - from ._models_py3 import TenantIdDescription - from ._models_py3 import TenantListResult -except (SyntaxError, ImportError): - from ._models import CheckResourceNameResult # type: ignore - from ._models import ErrorDefinition # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import Location # type: ignore - from ._models import LocationListResult # type: ignore - from ._models import LocationMetadata # type: ignore - from ._models import ManagedByTenant # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import PairedRegion # type: ignore - from ._models import ResourceName # type: ignore - from ._models import Subscription # type: ignore - from ._models import SubscriptionListResult # type: ignore - from ._models import SubscriptionPolicies # type: ignore - from ._models import TenantIdDescription # type: ignore - from ._models import TenantListResult # type: ignore - -from ._subscription_client_enums import ( - RegionCategory, - RegionType, - ResourceNameStatus, - SpendingLimit, - SubscriptionState, - TenantCategory, -) - -__all__ = [ - 'CheckResourceNameResult', - 'ErrorDefinition', - 'ErrorResponse', - 'Location', - 'LocationListResult', - 'LocationMetadata', - 'ManagedByTenant', - 'Operation', - 'OperationDisplay', - 'OperationListResult', - 'PairedRegion', - 'ResourceName', - 'Subscription', - 'SubscriptionListResult', - 'SubscriptionPolicies', - 'TenantIdDescription', - 'TenantListResult', - 'RegionCategory', - 'RegionType', - 'ResourceNameStatus', - 'SpendingLimit', - 'SubscriptionState', - 'TenantCategory', -] diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/models/_models.py b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/models/_models.py deleted file mode 100644 index cd7ffe36059..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/models/_models.py +++ /dev/null @@ -1,595 +0,0 @@ -# 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 azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class CheckResourceNameResult(msrest.serialization.Model): - """Resource Name valid if not a reserved word, does not contain a reserved word and does not start with a reserved word. - - :param name: Name of Resource. - :type name: str - :param type: Type of Resource. - :type type: str - :param status: Is the resource name Allowed or Reserved. Possible values include: "Allowed", - "Reserved". - :type status: str or ~azure.mgmt.resource.subscriptions.v2019_11_01.models.ResourceNameStatus - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckResourceNameResult, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) - self.status = kwargs.get('status', None) - - -class ErrorDefinition(msrest.serialization.Model): - """Error description and code explaining why resource name is invalid. - - :param message: Description of the error. - :type message: str - :param code: Code of the error. - :type code: str - """ - - _attribute_map = { - 'message': {'key': 'message', 'type': 'str'}, - 'code': {'key': 'code', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorDefinition, self).__init__(**kwargs) - self.message = kwargs.get('message', None) - self.code = kwargs.get('code', None) - - -class ErrorResponse(msrest.serialization.Model): - """Error response. - - :param error: The error details. - :type error: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.ErrorDefinition - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class Location(msrest.serialization.Model): - """Location information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The fully qualified ID of the location. For example, - /subscriptions/00000000-0000-0000-0000-000000000000/locations/westus. - :vartype id: str - :ivar subscription_id: The subscription ID. - :vartype subscription_id: str - :ivar name: The location name. - :vartype name: str - :ivar display_name: The display name of the location. - :vartype display_name: str - :ivar regional_display_name: The display name of the location and its region. - :vartype regional_display_name: str - :param metadata: Metadata of the location, such as lat/long, paired region, and others. - :type metadata: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.LocationMetadata - """ - - _validation = { - 'id': {'readonly': True}, - 'subscription_id': {'readonly': True}, - 'name': {'readonly': True}, - 'display_name': {'readonly': True}, - 'regional_display_name': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'regional_display_name': {'key': 'regionalDisplayName', 'type': 'str'}, - 'metadata': {'key': 'metadata', 'type': 'LocationMetadata'}, - } - - def __init__( - self, - **kwargs - ): - super(Location, self).__init__(**kwargs) - self.id = None - self.subscription_id = None - self.name = None - self.display_name = None - self.regional_display_name = None - self.metadata = kwargs.get('metadata', None) - - -class LocationListResult(msrest.serialization.Model): - """Location list operation response. - - :param value: An array of locations. - :type value: list[~azure.mgmt.resource.subscriptions.v2019_11_01.models.Location] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Location]'}, - } - - def __init__( - self, - **kwargs - ): - super(LocationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class LocationMetadata(msrest.serialization.Model): - """Location metadata information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar region_type: The type of the region. Possible values include: "Physical", "Logical". - :vartype region_type: str or ~azure.mgmt.resource.subscriptions.v2019_11_01.models.RegionType - :ivar region_category: The category of the region. Possible values include: "Recommended", - "Other". - :vartype region_category: str or - ~azure.mgmt.resource.subscriptions.v2019_11_01.models.RegionCategory - :ivar geography_group: The geography group of the location. - :vartype geography_group: str - :ivar longitude: The longitude of the location. - :vartype longitude: str - :ivar latitude: The latitude of the location. - :vartype latitude: str - :ivar physical_location: The physical location of the Azure location. - :vartype physical_location: str - :param paired_region: The regions paired to this region. - :type paired_region: list[~azure.mgmt.resource.subscriptions.v2019_11_01.models.PairedRegion] - """ - - _validation = { - 'region_type': {'readonly': True}, - 'region_category': {'readonly': True}, - 'geography_group': {'readonly': True}, - 'longitude': {'readonly': True}, - 'latitude': {'readonly': True}, - 'physical_location': {'readonly': True}, - } - - _attribute_map = { - 'region_type': {'key': 'regionType', 'type': 'str'}, - 'region_category': {'key': 'regionCategory', 'type': 'str'}, - 'geography_group': {'key': 'geographyGroup', 'type': 'str'}, - 'longitude': {'key': 'longitude', 'type': 'str'}, - 'latitude': {'key': 'latitude', 'type': 'str'}, - 'physical_location': {'key': 'physicalLocation', 'type': 'str'}, - 'paired_region': {'key': 'pairedRegion', 'type': '[PairedRegion]'}, - } - - def __init__( - self, - **kwargs - ): - super(LocationMetadata, self).__init__(**kwargs) - self.region_type = None - self.region_category = None - self.geography_group = None - self.longitude = None - self.latitude = None - self.physical_location = None - self.paired_region = kwargs.get('paired_region', None) - - -class ManagedByTenant(msrest.serialization.Model): - """Information about a tenant managing the subscription. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar tenant_id: The tenant ID of the managing tenant. This is a GUID. - :vartype tenant_id: str - """ - - _validation = { - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedByTenant, self).__init__(**kwargs) - self.tenant_id = None - - -class Operation(msrest.serialization.Model): - """Microsoft.Resources operation. - - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The object that represents the operation. - :type display: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.OperationDisplay - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - - -class OperationDisplay(msrest.serialization.Model): - """The object that represents the operation. - - :param provider: Service provider: Microsoft.Resources. - :type provider: str - :param resource: Resource on which the operation is performed: Profile, endpoint, etc. - :type resource: str - :param operation: Operation type: Read, write, delete, etc. - :type operation: str - :param description: Description of the operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.Model): - """Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get the next set of results. - - :param value: List of Microsoft.Resources operations. - :type value: list[~azure.mgmt.resource.subscriptions.v2019_11_01.models.Operation] - :param next_link: URL to get the next set of operation list results if there are any. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class PairedRegion(msrest.serialization.Model): - """Information regarding paired region. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the paired region. - :vartype name: str - :ivar id: The fully qualified ID of the location. For example, - /subscriptions/00000000-0000-0000-0000-000000000000/locations/westus. - :vartype id: str - :ivar subscription_id: The subscription ID. - :vartype subscription_id: str - """ - - _validation = { - 'name': {'readonly': True}, - 'id': {'readonly': True}, - 'subscription_id': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PairedRegion, self).__init__(**kwargs) - self.name = None - self.id = None - self.subscription_id = None - - -class ResourceName(msrest.serialization.Model): - """Name and Type of the Resource. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Name of the resource. - :type name: str - :param type: Required. The type of the resource. - :type type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceName, self).__init__(**kwargs) - self.name = kwargs['name'] - self.type = kwargs['type'] - - -class Subscription(msrest.serialization.Model): - """Subscription information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The fully qualified ID for the subscription. For example, - /subscriptions/00000000-0000-0000-0000-000000000000. - :vartype id: str - :ivar subscription_id: The subscription ID. - :vartype subscription_id: str - :ivar display_name: The subscription display name. - :vartype display_name: str - :ivar tenant_id: The subscription tenant ID. - :vartype tenant_id: 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 ~azure.mgmt.resource.subscriptions.v2019_11_01.models.SubscriptionState - :param subscription_policies: The subscription policies. - :type subscription_policies: - ~azure.mgmt.resource.subscriptions.v2019_11_01.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'. - :type authorization_source: str - :param managed_by_tenants: An array containing the tenants managing the subscription. - :type managed_by_tenants: - list[~azure.mgmt.resource.subscriptions.v2019_11_01.models.ManagedByTenant] - :param tags: A set of tags. The tags attached to the subscription. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'subscription_id': {'readonly': True}, - 'display_name': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'subscription_policies': {'key': 'subscriptionPolicies', 'type': 'SubscriptionPolicies'}, - 'authorization_source': {'key': 'authorizationSource', 'type': 'str'}, - 'managed_by_tenants': {'key': 'managedByTenants', 'type': '[ManagedByTenant]'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(Subscription, self).__init__(**kwargs) - self.id = None - self.subscription_id = None - self.display_name = None - self.tenant_id = None - self.state = None - self.subscription_policies = kwargs.get('subscription_policies', None) - self.authorization_source = kwargs.get('authorization_source', None) - self.managed_by_tenants = kwargs.get('managed_by_tenants', None) - self.tags = kwargs.get('tags', None) - - -class SubscriptionListResult(msrest.serialization.Model): - """Subscription list operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: An array of subscriptions. - :type value: list[~azure.mgmt.resource.subscriptions.v2019_11_01.models.Subscription] - :param next_link: Required. The URL to get the next set of results. - :type next_link: str - """ - - _validation = { - 'next_link': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Subscription]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SubscriptionListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs['next_link'] - - -class SubscriptionPolicies(msrest.serialization.Model): - """Subscription policies. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar location_placement_id: The subscription location placement ID. The ID indicates which - regions are visible for a subscription. For example, a subscription with a location placement - Id of Public_2014-09-01 has access to Azure public regions. - :vartype location_placement_id: str - :ivar quota_id: The subscription quota ID. - :vartype quota_id: str - :ivar spending_limit: The subscription spending limit. Possible values include: "On", "Off", - "CurrentPeriodOff". - :vartype spending_limit: str or - ~azure.mgmt.resource.subscriptions.v2019_11_01.models.SpendingLimit - """ - - _validation = { - 'location_placement_id': {'readonly': True}, - 'quota_id': {'readonly': True}, - 'spending_limit': {'readonly': True}, - } - - _attribute_map = { - 'location_placement_id': {'key': 'locationPlacementId', 'type': 'str'}, - 'quota_id': {'key': 'quotaId', 'type': 'str'}, - 'spending_limit': {'key': 'spendingLimit', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SubscriptionPolicies, self).__init__(**kwargs) - self.location_placement_id = None - self.quota_id = None - self.spending_limit = None - - -class TenantIdDescription(msrest.serialization.Model): - """Tenant Id information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The fully qualified ID of the tenant. For example, - /tenants/00000000-0000-0000-0000-000000000000. - :vartype id: str - :ivar tenant_id: The tenant ID. For example, 00000000-0000-0000-0000-000000000000. - :vartype tenant_id: str - :ivar tenant_category: Category of the tenant. Possible values include: "Home", "ProjectedBy", - "ManagedBy". - :vartype tenant_category: str or - ~azure.mgmt.resource.subscriptions.v2019_11_01.models.TenantCategory - :ivar country: Country/region name of the address for the tenant. - :vartype country: str - :ivar country_code: Country/region abbreviation for the tenant. - :vartype country_code: str - :ivar display_name: The display name of the tenant. - :vartype display_name: str - :ivar domains: The list of domains for the tenant. - :vartype domains: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'tenant_category': {'readonly': True}, - 'country': {'readonly': True}, - 'country_code': {'readonly': True}, - 'display_name': {'readonly': True}, - 'domains': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'tenant_category': {'key': 'tenantCategory', 'type': 'str'}, - 'country': {'key': 'country', 'type': 'str'}, - 'country_code': {'key': 'countryCode', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'domains': {'key': 'domains', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(TenantIdDescription, self).__init__(**kwargs) - self.id = None - self.tenant_id = None - self.tenant_category = None - self.country = None - self.country_code = None - self.display_name = None - self.domains = None - - -class TenantListResult(msrest.serialization.Model): - """Tenant Ids information. - - All required parameters must be populated in order to send to Azure. - - :param value: An array of tenants. - :type value: list[~azure.mgmt.resource.subscriptions.v2019_11_01.models.TenantIdDescription] - :param next_link: Required. The URL to use for getting the next set of results. - :type next_link: str - """ - - _validation = { - 'next_link': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[TenantIdDescription]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TenantListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs['next_link'] diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/models/_models_py3.py b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/models/_models_py3.py deleted file mode 100644 index b1564c2e400..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/models/_models_py3.py +++ /dev/null @@ -1,639 +0,0 @@ -# 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 typing import Dict, List, Optional, Union - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - -from ._subscription_client_enums import * - - -class CheckResourceNameResult(msrest.serialization.Model): - """Resource Name valid if not a reserved word, does not contain a reserved word and does not start with a reserved word. - - :param name: Name of Resource. - :type name: str - :param type: Type of Resource. - :type type: str - :param status: Is the resource name Allowed or Reserved. Possible values include: "Allowed", - "Reserved". - :type status: str or ~azure.mgmt.resource.subscriptions.v2019_11_01.models.ResourceNameStatus - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - type: Optional[str] = None, - status: Optional[Union[str, "ResourceNameStatus"]] = None, - **kwargs - ): - super(CheckResourceNameResult, self).__init__(**kwargs) - self.name = name - self.type = type - self.status = status - - -class ErrorDefinition(msrest.serialization.Model): - """Error description and code explaining why resource name is invalid. - - :param message: Description of the error. - :type message: str - :param code: Code of the error. - :type code: str - """ - - _attribute_map = { - 'message': {'key': 'message', 'type': 'str'}, - 'code': {'key': 'code', 'type': 'str'}, - } - - def __init__( - self, - *, - message: Optional[str] = None, - code: Optional[str] = None, - **kwargs - ): - super(ErrorDefinition, self).__init__(**kwargs) - self.message = message - self.code = code - - -class ErrorResponse(msrest.serialization.Model): - """Error response. - - :param error: The error details. - :type error: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.ErrorDefinition - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDefinition'}, - } - - def __init__( - self, - *, - error: Optional["ErrorDefinition"] = None, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = error - - -class Location(msrest.serialization.Model): - """Location information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The fully qualified ID of the location. For example, - /subscriptions/00000000-0000-0000-0000-000000000000/locations/westus. - :vartype id: str - :ivar subscription_id: The subscription ID. - :vartype subscription_id: str - :ivar name: The location name. - :vartype name: str - :ivar display_name: The display name of the location. - :vartype display_name: str - :ivar regional_display_name: The display name of the location and its region. - :vartype regional_display_name: str - :param metadata: Metadata of the location, such as lat/long, paired region, and others. - :type metadata: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.LocationMetadata - """ - - _validation = { - 'id': {'readonly': True}, - 'subscription_id': {'readonly': True}, - 'name': {'readonly': True}, - 'display_name': {'readonly': True}, - 'regional_display_name': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'regional_display_name': {'key': 'regionalDisplayName', 'type': 'str'}, - 'metadata': {'key': 'metadata', 'type': 'LocationMetadata'}, - } - - def __init__( - self, - *, - metadata: Optional["LocationMetadata"] = None, - **kwargs - ): - super(Location, self).__init__(**kwargs) - self.id = None - self.subscription_id = None - self.name = None - self.display_name = None - self.regional_display_name = None - self.metadata = metadata - - -class LocationListResult(msrest.serialization.Model): - """Location list operation response. - - :param value: An array of locations. - :type value: list[~azure.mgmt.resource.subscriptions.v2019_11_01.models.Location] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Location]'}, - } - - def __init__( - self, - *, - value: Optional[List["Location"]] = None, - **kwargs - ): - super(LocationListResult, self).__init__(**kwargs) - self.value = value - - -class LocationMetadata(msrest.serialization.Model): - """Location metadata information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar region_type: The type of the region. Possible values include: "Physical", "Logical". - :vartype region_type: str or ~azure.mgmt.resource.subscriptions.v2019_11_01.models.RegionType - :ivar region_category: The category of the region. Possible values include: "Recommended", - "Other". - :vartype region_category: str or - ~azure.mgmt.resource.subscriptions.v2019_11_01.models.RegionCategory - :ivar geography_group: The geography group of the location. - :vartype geography_group: str - :ivar longitude: The longitude of the location. - :vartype longitude: str - :ivar latitude: The latitude of the location. - :vartype latitude: str - :ivar physical_location: The physical location of the Azure location. - :vartype physical_location: str - :param paired_region: The regions paired to this region. - :type paired_region: list[~azure.mgmt.resource.subscriptions.v2019_11_01.models.PairedRegion] - """ - - _validation = { - 'region_type': {'readonly': True}, - 'region_category': {'readonly': True}, - 'geography_group': {'readonly': True}, - 'longitude': {'readonly': True}, - 'latitude': {'readonly': True}, - 'physical_location': {'readonly': True}, - } - - _attribute_map = { - 'region_type': {'key': 'regionType', 'type': 'str'}, - 'region_category': {'key': 'regionCategory', 'type': 'str'}, - 'geography_group': {'key': 'geographyGroup', 'type': 'str'}, - 'longitude': {'key': 'longitude', 'type': 'str'}, - 'latitude': {'key': 'latitude', 'type': 'str'}, - 'physical_location': {'key': 'physicalLocation', 'type': 'str'}, - 'paired_region': {'key': 'pairedRegion', 'type': '[PairedRegion]'}, - } - - def __init__( - self, - *, - paired_region: Optional[List["PairedRegion"]] = None, - **kwargs - ): - super(LocationMetadata, self).__init__(**kwargs) - self.region_type = None - self.region_category = None - self.geography_group = None - self.longitude = None - self.latitude = None - self.physical_location = None - self.paired_region = paired_region - - -class ManagedByTenant(msrest.serialization.Model): - """Information about a tenant managing the subscription. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar tenant_id: The tenant ID of the managing tenant. This is a GUID. - :vartype tenant_id: str - """ - - _validation = { - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedByTenant, self).__init__(**kwargs) - self.tenant_id = None - - -class Operation(msrest.serialization.Model): - """Microsoft.Resources operation. - - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The object that represents the operation. - :type display: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.OperationDisplay - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display: Optional["OperationDisplay"] = None, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = name - self.display = display - - -class OperationDisplay(msrest.serialization.Model): - """The object that represents the operation. - - :param provider: Service provider: Microsoft.Resources. - :type provider: str - :param resource: Resource on which the operation is performed: Profile, endpoint, etc. - :type resource: str - :param operation: Operation type: Read, write, delete, etc. - :type operation: str - :param description: Description of the operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - *, - provider: Optional[str] = None, - resource: Optional[str] = None, - operation: Optional[str] = None, - description: Optional[str] = None, - **kwargs - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationListResult(msrest.serialization.Model): - """Result of the request to list Microsoft.Resources operations. It contains a list of operations and a URL link to get the next set of results. - - :param value: List of Microsoft.Resources operations. - :type value: list[~azure.mgmt.resource.subscriptions.v2019_11_01.models.Operation] - :param next_link: URL to get the next set of operation list results if there are any. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["Operation"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class PairedRegion(msrest.serialization.Model): - """Information regarding paired region. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the paired region. - :vartype name: str - :ivar id: The fully qualified ID of the location. For example, - /subscriptions/00000000-0000-0000-0000-000000000000/locations/westus. - :vartype id: str - :ivar subscription_id: The subscription ID. - :vartype subscription_id: str - """ - - _validation = { - 'name': {'readonly': True}, - 'id': {'readonly': True}, - 'subscription_id': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PairedRegion, self).__init__(**kwargs) - self.name = None - self.id = None - self.subscription_id = None - - -class ResourceName(msrest.serialization.Model): - """Name and Type of the Resource. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Name of the resource. - :type name: str - :param type: Required. The type of the resource. - :type type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - *, - name: str, - type: str, - **kwargs - ): - super(ResourceName, self).__init__(**kwargs) - self.name = name - self.type = type - - -class Subscription(msrest.serialization.Model): - """Subscription information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The fully qualified ID for the subscription. For example, - /subscriptions/00000000-0000-0000-0000-000000000000. - :vartype id: str - :ivar subscription_id: The subscription ID. - :vartype subscription_id: str - :ivar display_name: The subscription display name. - :vartype display_name: str - :ivar tenant_id: The subscription tenant ID. - :vartype tenant_id: 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 ~azure.mgmt.resource.subscriptions.v2019_11_01.models.SubscriptionState - :param subscription_policies: The subscription policies. - :type subscription_policies: - ~azure.mgmt.resource.subscriptions.v2019_11_01.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'. - :type authorization_source: str - :param managed_by_tenants: An array containing the tenants managing the subscription. - :type managed_by_tenants: - list[~azure.mgmt.resource.subscriptions.v2019_11_01.models.ManagedByTenant] - :param tags: A set of tags. The tags attached to the subscription. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'subscription_id': {'readonly': True}, - 'display_name': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'subscription_policies': {'key': 'subscriptionPolicies', 'type': 'SubscriptionPolicies'}, - 'authorization_source': {'key': 'authorizationSource', 'type': 'str'}, - 'managed_by_tenants': {'key': 'managedByTenants', 'type': '[ManagedByTenant]'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - *, - subscription_policies: Optional["SubscriptionPolicies"] = None, - authorization_source: Optional[str] = None, - managed_by_tenants: Optional[List["ManagedByTenant"]] = None, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - super(Subscription, self).__init__(**kwargs) - self.id = None - self.subscription_id = None - self.display_name = None - self.tenant_id = None - self.state = None - self.subscription_policies = subscription_policies - self.authorization_source = authorization_source - self.managed_by_tenants = managed_by_tenants - self.tags = tags - - -class SubscriptionListResult(msrest.serialization.Model): - """Subscription list operation response. - - All required parameters must be populated in order to send to Azure. - - :param value: An array of subscriptions. - :type value: list[~azure.mgmt.resource.subscriptions.v2019_11_01.models.Subscription] - :param next_link: Required. The URL to get the next set of results. - :type next_link: str - """ - - _validation = { - 'next_link': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Subscription]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - next_link: str, - value: Optional[List["Subscription"]] = None, - **kwargs - ): - super(SubscriptionListResult, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SubscriptionPolicies(msrest.serialization.Model): - """Subscription policies. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar location_placement_id: The subscription location placement ID. The ID indicates which - regions are visible for a subscription. For example, a subscription with a location placement - Id of Public_2014-09-01 has access to Azure public regions. - :vartype location_placement_id: str - :ivar quota_id: The subscription quota ID. - :vartype quota_id: str - :ivar spending_limit: The subscription spending limit. Possible values include: "On", "Off", - "CurrentPeriodOff". - :vartype spending_limit: str or - ~azure.mgmt.resource.subscriptions.v2019_11_01.models.SpendingLimit - """ - - _validation = { - 'location_placement_id': {'readonly': True}, - 'quota_id': {'readonly': True}, - 'spending_limit': {'readonly': True}, - } - - _attribute_map = { - 'location_placement_id': {'key': 'locationPlacementId', 'type': 'str'}, - 'quota_id': {'key': 'quotaId', 'type': 'str'}, - 'spending_limit': {'key': 'spendingLimit', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SubscriptionPolicies, self).__init__(**kwargs) - self.location_placement_id = None - self.quota_id = None - self.spending_limit = None - - -class TenantIdDescription(msrest.serialization.Model): - """Tenant Id information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The fully qualified ID of the tenant. For example, - /tenants/00000000-0000-0000-0000-000000000000. - :vartype id: str - :ivar tenant_id: The tenant ID. For example, 00000000-0000-0000-0000-000000000000. - :vartype tenant_id: str - :ivar tenant_category: Category of the tenant. Possible values include: "Home", "ProjectedBy", - "ManagedBy". - :vartype tenant_category: str or - ~azure.mgmt.resource.subscriptions.v2019_11_01.models.TenantCategory - :ivar country: Country/region name of the address for the tenant. - :vartype country: str - :ivar country_code: Country/region abbreviation for the tenant. - :vartype country_code: str - :ivar display_name: The display name of the tenant. - :vartype display_name: str - :ivar domains: The list of domains for the tenant. - :vartype domains: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'tenant_category': {'readonly': True}, - 'country': {'readonly': True}, - 'country_code': {'readonly': True}, - 'display_name': {'readonly': True}, - 'domains': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'tenant_category': {'key': 'tenantCategory', 'type': 'str'}, - 'country': {'key': 'country', 'type': 'str'}, - 'country_code': {'key': 'countryCode', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'domains': {'key': 'domains', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(TenantIdDescription, self).__init__(**kwargs) - self.id = None - self.tenant_id = None - self.tenant_category = None - self.country = None - self.country_code = None - self.display_name = None - self.domains = None - - -class TenantListResult(msrest.serialization.Model): - """Tenant Ids information. - - All required parameters must be populated in order to send to Azure. - - :param value: An array of tenants. - :type value: list[~azure.mgmt.resource.subscriptions.v2019_11_01.models.TenantIdDescription] - :param next_link: Required. The URL to use for getting the next set of results. - :type next_link: str - """ - - _validation = { - 'next_link': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[TenantIdDescription]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - next_link: str, - value: Optional[List["TenantIdDescription"]] = None, - **kwargs - ): - super(TenantListResult, self).__init__(**kwargs) - self.value = value - self.next_link = next_link diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/models/_subscription_client_enums.py b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/models/_subscription_client_enums.py deleted file mode 100644 index 94c6f35f02b..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/models/_subscription_client_enums.py +++ /dev/null @@ -1,74 +0,0 @@ -# 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, EnumMeta -from six import with_metaclass - -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class RegionCategory(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The category of the region. - """ - - RECOMMENDED = "Recommended" - OTHER = "Other" - -class RegionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The type of the region. - """ - - PHYSICAL = "Physical" - LOGICAL = "Logical" - -class ResourceNameStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Is the resource name Allowed or Reserved - """ - - ALLOWED = "Allowed" - RESERVED = "Reserved" - -class SpendingLimit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The subscription spending limit. - """ - - ON = "On" - OFF = "Off" - CURRENT_PERIOD_OFF = "CurrentPeriodOff" - -class SubscriptionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted. - """ - - ENABLED = "Enabled" - WARNED = "Warned" - PAST_DUE = "PastDue" - DISABLED = "Disabled" - DELETED = "Deleted" - -class TenantCategory(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Category of the tenant. - """ - - HOME = "Home" - PROJECTED_BY = "ProjectedBy" - MANAGED_BY = "ManagedBy" diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/operations/__init__.py b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/operations/__init__.py deleted file mode 100644 index 228a89205db..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/operations/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# 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 ._operations import Operations -from ._subscriptions_operations import SubscriptionsOperations -from ._tenants_operations import TenantsOperations -from ._subscription_client_operations import SubscriptionClientOperationsMixin - -__all__ = [ - 'Operations', - 'SubscriptionsOperations', - 'TenantsOperations', - 'SubscriptionClientOperationsMixin', -] diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/operations/_operations.py b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/operations/_operations.py deleted file mode 100644 index 3cbc9139d46..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/operations/_operations.py +++ /dev/null @@ -1,109 +0,0 @@ -# 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 typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.resource.subscriptions.v2019_11_01.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 - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.OperationListResult"] - """Lists all of the available Microsoft.Resources REST API operations. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.subscriptions.v2019_11_01.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/providers/Microsoft.Resources/operations'} # type: ignore diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/operations/_subscription_client_operations.py b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/operations/_subscription_client_operations.py deleted file mode 100644 index bef87f0e352..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/operations/_subscription_client_operations.py +++ /dev/null @@ -1,88 +0,0 @@ -# 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 typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class SubscriptionClientOperationsMixin(object): - - def check_resource_name( - self, - resource_name_definition=None, # type: Optional["models.ResourceName"] - **kwargs # type: Any - ): - # type: (...) -> "models.CheckResourceNameResult" - """Checks resource name validity. - - A resource name is valid if it is not a reserved word, does not contains a reserved word and - does not start with a reserved word. - - :param resource_name_definition: Resource object with values for resource name and resource - type. - :type resource_name_definition: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.ResourceName - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckResourceNameResult, or the result of cls(response) - :rtype: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.CheckResourceNameResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckResourceNameResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_resource_name.metadata['url'] # type: ignore - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - if resource_name_definition is not None: - body_content = self._serialize.body(resource_name_definition, 'ResourceName') - else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - 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) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CheckResourceNameResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - check_resource_name.metadata = {'url': '/providers/Microsoft.Resources/checkResourceName'} # type: ignore diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/operations/_subscriptions_operations.py b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/operations/_subscriptions_operations.py deleted file mode 100644 index 28409e8836c..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/operations/_subscriptions_operations.py +++ /dev/null @@ -1,236 +0,0 @@ -# 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 typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class SubscriptionsOperations(object): - """SubscriptionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.resource.subscriptions.v2019_11_01.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 - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list_locations( - self, - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.LocationListResult"] - """Gets all available geo-locations. - - This operation provides all the locations that are available for resource providers; however, - each resource provider may support a subset of this list. - - :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: An iterator like instance of either LocationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.subscriptions.v2019_11_01.models.LocationListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LocationListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list_locations.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('LocationListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_locations.metadata = {'url': '/subscriptions/{subscriptionId}/locations'} # type: ignore - - def get( - self, - subscription_id, # type: str - **kwargs # type: Any - ): - # 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: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.Subscription - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Subscription"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Subscription', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}'} # type: ignore - - def list( - self, - **kwargs # type: Any - ): - # 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[~azure.mgmt.resource.subscriptions.v2019_11_01.models.SubscriptionListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SubscriptionListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('SubscriptionListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions'} # type: ignore diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/operations/_tenants_operations.py b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/operations/_tenants_operations.py deleted file mode 100644 index 70e257db0f1..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/operations/_tenants_operations.py +++ /dev/null @@ -1,109 +0,0 @@ -# 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 typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class TenantsOperations(object): - """TenantsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.resource.subscriptions.v2019_11_01.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 - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - **kwargs # type: Any - ): - # 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[~azure.mgmt.resource.subscriptions.v2019_11_01.models.TenantListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TenantListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - accept = "application/json" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('TenantListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/tenants'} # type: ignore diff --git a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/py.typed b/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/py.typed deleted file mode 100644 index e5aff4f83af..00000000000 --- a/src/azure-cli-core/azure/cli/core/vendored_sdks/subscriptions/v2019_11_01/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file