From 57f8eb2b908beb51292adbb0426cb5b2f835921f Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Fri, 10 Jul 2020 04:45:37 +0000 Subject: [PATCH] Generated from 4f88bac3517e256c8377497490cfefb2a0d4c90b override policyclient --- .../_deployment_scripts_operations_async.py | 37 +- .../_deployment_scripts_operations.py | 33 +- .../subscriptions/v2016_06_01/_metadata.json | 17 +- .../v2016_06_01/_subscription_client.py | 3 +- .../aio/_subscription_client_async.py | 3 +- .../aio/operations_async/__init__.py | 2 + .../_subscription_client_operations_async.py | 81 +++ .../v2016_06_01/models/__init__.py | 14 + .../v2016_06_01/models/_models.py | 101 ++++ .../v2016_06_01/models/_models_py3.py | 117 +++- .../models/_subscription_client_enums.py | 7 + .../v2016_06_01/operations/__init__.py | 2 + .../_subscription_client_operations.py | 86 +++ .../subscriptions/v2018_06_01/_metadata.json | 17 +- .../v2018_06_01/_subscription_client.py | 3 +- .../aio/_subscription_client_async.py | 3 +- .../aio/operations_async/__init__.py | 2 + .../_subscription_client_operations_async.py | 81 +++ .../v2018_06_01/models/__init__.py | 14 + .../v2018_06_01/models/_models.py | 101 ++++ .../v2018_06_01/models/_models_py3.py | 117 +++- .../models/_subscription_client_enums.py | 7 + .../v2018_06_01/operations/__init__.py | 2 + .../_subscription_client_operations.py | 86 +++ .../subscriptions/v2019_06_01/_metadata.json | 17 +- .../v2019_06_01/_subscription_client.py | 3 +- .../aio/_subscription_client_async.py | 3 +- .../aio/operations_async/__init__.py | 2 + .../_subscription_client_operations_async.py | 81 +++ .../v2019_06_01/models/__init__.py | 14 + .../v2019_06_01/models/_models.py | 101 ++++ .../v2019_06_01/models/_models_py3.py | 117 +++- .../models/_subscription_client_enums.py | 7 + .../v2019_06_01/operations/__init__.py | 2 + .../_subscription_client_operations.py | 86 +++ .../subscriptions/v2019_11_01/_metadata.json | 17 +- .../v2019_11_01/_subscription_client.py | 3 +- .../aio/_subscription_client_async.py | 3 +- .../aio/operations_async/__init__.py | 2 + .../_subscription_client_operations_async.py | 81 +++ .../v2019_11_01/models/__init__.py | 14 + .../v2019_11_01/models/_models.py | 101 ++++ .../v2019_11_01/models/_models_py3.py | 117 +++- .../models/_subscription_client_enums.py | 7 + .../v2019_11_01/operations/__init__.py | 2 + .../_subscription_client_operations.py | 86 +++ .../mgmt/resource/templatespecs/__init__.py | 16 - .../resource/templatespecs/_configuration.py | 65 -- .../templatespecs/_template_specs_client.py | 125 ---- .../mgmt/resource/templatespecs/_version.py | 8 - .../resource/templatespecs/aio/__init__.py | 10 - .../templatespecs/aio/_configuration_async.py | 64 -- .../aio/_template_specs_client_async.py | 125 ---- .../mgmt/resource/templatespecs/models.py | 7 - .../mgmt/resource/templatespecs/py.typed | 1 - .../v2019_06_preview/__init__.py | 16 - .../v2019_06_preview/_configuration.py | 69 --- .../v2019_06_preview/_metadata.json | 54 -- .../_template_specs_client.py | 74 --- .../v2019_06_preview/aio/__init__.py | 10 - .../aio/_configuration_async.py | 65 -- .../aio/_template_specs_client_async.py | 68 --- .../aio/operations_async/__init__.py | 15 - ...template_spec_versions_operations_async.py | 377 ------------ .../_template_specs_operations_async.py | 420 ------------- .../v2019_06_preview/models/__init__.py | 57 -- .../v2019_06_preview/models/_models.py | 524 ---------------- .../v2019_06_preview/models/_models_py3.py | 562 ------------------ .../models/_template_specs_client_enums.py | 18 - .../v2019_06_preview/operations/__init__.py | 15 - .../_template_spec_versions_operations.py | 386 ------------ .../operations/_template_specs_operations.py | 430 -------------- .../templatespecs/v2019_06_preview/py.typed | 1 - 73 files changed, 1750 insertions(+), 3634 deletions(-) create mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations_async/_subscription_client_operations_async.py create mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_subscription_client_operations.py create mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations_async/_subscription_client_operations_async.py create mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_subscription_client_operations.py create mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations_async/_subscription_client_operations_async.py create mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_subscription_client_operations.py create mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations_async/_subscription_client_operations_async.py create mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_subscription_client_operations.py delete mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/__init__.py delete mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/_configuration.py delete mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/_template_specs_client.py delete mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/_version.py delete mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/aio/__init__.py delete mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/aio/_configuration_async.py delete mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/aio/_template_specs_client_async.py delete mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/models.py delete mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/py.typed delete mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/__init__.py delete mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/_configuration.py delete mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/_metadata.json delete mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/_template_specs_client.py delete mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/aio/__init__.py delete mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/aio/_configuration_async.py delete mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/aio/_template_specs_client_async.py delete mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/aio/operations_async/__init__.py delete mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/aio/operations_async/_template_spec_versions_operations_async.py delete mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/aio/operations_async/_template_specs_operations_async.py delete mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/models/__init__.py delete mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/models/_models.py delete mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/models/_models_py3.py delete mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/models/_template_specs_client_enums.py delete mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/operations/__init__.py delete mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/operations/_template_spec_versions_operations.py delete mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/operations/_template_specs_operations.py delete mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/py.typed diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_preview/aio/operations_async/_deployment_scripts_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_preview/aio/operations_async/_deployment_scripts_operations_async.py index 4ae1d7598342..3e873ec2253e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_preview/aio/operations_async/_deployment_scripts_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_preview/aio/operations_async/_deployment_scripts_operations_async.py @@ -74,6 +74,7 @@ async def _create_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' + # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(deployment_script, 'DeploymentScript') body_content_kwargs['content'] = body_content @@ -87,6 +88,7 @@ async def _create_initial( error = self._deserialize(models.DeploymentScriptsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentScript', pipeline_response) @@ -105,7 +107,7 @@ async def begin_create( script_name: str, deployment_script: "models.DeploymentScript", **kwargs - ) -> AsyncLROPoller["models.DeploymentScript"]: + ) -> "models.DeploymentScript": """Creates a deployment script. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -120,8 +122,8 @@ async def begin_create( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DeploymentScript or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.deploymentscripts.v2019_10_preview.models.DeploymentScript] + :return: DeploymentScript, or the result of cls(response) + :rtype: ~azure.mgmt.resource.deploymentscripts.v2019_10_preview.models.DeploymentScript :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -208,6 +210,7 @@ async def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' + # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] if deployment_script is not None: body_content = self._serialize.body(deployment_script, 'DeploymentScriptUpdateParameter') @@ -271,6 +274,7 @@ async def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' + # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -327,6 +331,7 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] + # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -358,10 +363,6 @@ def list_by_subscription( api_version = "2019-10-01-preview" def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - if not next_link: # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore @@ -373,11 +374,15 @@ def prepare_request(next_link=None): 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) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): @@ -444,6 +449,7 @@ async def get_logs( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' + # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -507,6 +513,7 @@ async def get_logs_default( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' + # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -544,10 +551,6 @@ def list_by_resource_group( api_version = "2019-10-01-preview" def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -560,11 +563,15 @@ def prepare_request(next_link=None): 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) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_preview/operations/_deployment_scripts_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_preview/operations/_deployment_scripts_operations.py index 7ead4f288f73..825f11b619d7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_preview/operations/_deployment_scripts_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_preview/operations/_deployment_scripts_operations.py @@ -79,6 +79,7 @@ def _create_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' + # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(deployment_script, 'DeploymentScript') body_content_kwargs['content'] = body_content @@ -92,6 +93,7 @@ def _create_initial( error = self._deserialize(models.DeploymentScriptsError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = None if response.status_code == 200: deserialized = self._deserialize('DeploymentScript', pipeline_response) @@ -111,7 +113,7 @@ def begin_create( deployment_script, # type: "models.DeploymentScript" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.DeploymentScript"] + # type: (...) -> LROPoller """Creates a deployment script. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -215,6 +217,7 @@ def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' + # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] if deployment_script is not None: body_content = self._serialize.body(deployment_script, 'DeploymentScriptUpdateParameter') @@ -279,6 +282,7 @@ def get( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' + # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -336,6 +340,7 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] + # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -368,10 +373,6 @@ def list_by_subscription( api_version = "2019-10-01-preview" def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - if not next_link: # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore @@ -383,11 +384,15 @@ def prepare_request(next_link=None): 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) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): @@ -455,6 +460,7 @@ def get_logs( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' + # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -519,6 +525,7 @@ def get_logs_default( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' + # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -557,10 +564,6 @@ def list_by_resource_group( api_version = "2019-10-01-preview" def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore @@ -573,11 +576,15 @@ def prepare_request(next_link=None): 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) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_metadata.json index a7e8a9df7ec4..3652ff20bdb8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_metadata.json @@ -34,10 +34,21 @@ "operation_groups": { "operations": "Operations", "subscriptions": "SubscriptionsOperations", - "tenants": "TenantsOperations" + "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" + }, + "async": { + "signature": "async def check_resource_name(\n self,\n resource_name_definition: Optional[\"models.ResourceName\"] = None,\n **kwargs\n) -\u003e \"models.CheckResourceNameResult\":\n", + "coroutine": true + }, + "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": "None", - "async_imports": "None" + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"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\": [\"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/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_subscription_client.py index 572467e82fec..d4cbff79c14f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_subscription_client.py @@ -21,10 +21,11 @@ from .operations import Operations from .operations import SubscriptionsOperations from .operations import TenantsOperations +from .operations import SubscriptionClientOperationsMixin from . import models -class SubscriptionClient(object): +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 diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/_subscription_client_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/_subscription_client_async.py index c78438f69703..4ad10727c363 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/_subscription_client_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/_subscription_client_async.py @@ -19,10 +19,11 @@ from .operations_async import Operations from .operations_async import SubscriptionsOperations from .operations_async import TenantsOperations +from .operations_async import SubscriptionClientOperationsMixin from .. import models -class SubscriptionClient(object): +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 diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations_async/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations_async/__init__.py index 05cc20fe3ece..3f6612d8579c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations_async/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations_async/__init__.py @@ -9,9 +9,11 @@ from ._operations_async import Operations from ._subscriptions_operations_async import SubscriptionsOperations from ._tenants_operations_async import TenantsOperations +from ._subscription_client_operations_async import SubscriptionClientOperationsMixin __all__ = [ 'Operations', 'SubscriptionsOperations', 'TenantsOperations', + 'SubscriptionClientOperationsMixin', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations_async/_subscription_client_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations_async/_subscription_client_operations_async.py new file mode 100644 index 000000000000..6dfeea116982 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations_async/_subscription_client_operations_async.py @@ -0,0 +1,81 @@ +# 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, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SubscriptionClientOperationsMixin: + + async def check_resource_name( + self, + resource_name_definition: Optional["models.ResourceName"] = None, + **kwargs + ) -> "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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-06-01" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + 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 = await 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/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/__init__.py index 4a05f8dc94cf..4d3bb8b7d259 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/__init__.py @@ -7,22 +7,30 @@ # -------------------------------------------------------------------------- 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 @@ -30,21 +38,27 @@ 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/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_models.py index e11afbf9b663..011eca63f953 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_models.py @@ -6,9 +6,80 @@ # 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. @@ -156,6 +227,36 @@ def __init__( 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. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_models_py3.py index 26c4b37031ab..b6e20cf666d5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_models_py3.py @@ -6,10 +6,92 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional +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. @@ -171,6 +253,39 @@ def __init__( 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. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_subscription_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_subscription_client_enums.py index 85f50e46d3d8..cd0d7b838fe6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_subscription_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_subscription_client_enums.py @@ -8,6 +8,13 @@ from enum import Enum +class ResourceNameStatus(str, Enum): + """Is the resource name Allowed or Reserved + """ + + allowed = "Allowed" + reserved = "Reserved" + class SpendingLimit(str, Enum): """The subscription spending limit. """ diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/__init__.py index 5ba2b6faf288..228a89205dbd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/__init__.py @@ -9,9 +9,11 @@ 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/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_subscription_client_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_subscription_client_operations.py new file mode 100644 index 000000000000..59def24d129a --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_subscription_client_operations.py @@ -0,0 +1,86 @@ +# 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 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-06-01" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + 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/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_metadata.json index baca80a1b7b7..12ec4815857e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_metadata.json @@ -34,10 +34,21 @@ "operation_groups": { "operations": "Operations", "subscriptions": "SubscriptionsOperations", - "tenants": "TenantsOperations" + "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" + }, + "async": { + "signature": "async def check_resource_name(\n self,\n resource_name_definition: Optional[\"models.ResourceName\"] = None,\n **kwargs\n) -\u003e \"models.CheckResourceNameResult\":\n", + "coroutine": true + }, + "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.v2018_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.v2018_06_01.models.CheckResourceNameResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"", + "call": "resource_name_definition" + } }, - "sync_imports": "None", - "async_imports": "None" + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"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\": [\"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/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_subscription_client.py index 67a56238b6fb..d46379adfdce 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_subscription_client.py @@ -21,10 +21,11 @@ from .operations import Operations from .operations import SubscriptionsOperations from .operations import TenantsOperations +from .operations import SubscriptionClientOperationsMixin from . import models -class SubscriptionClient(object): +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 diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/_subscription_client_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/_subscription_client_async.py index 6bc878d2697c..eb935268d9ea 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/_subscription_client_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/_subscription_client_async.py @@ -19,10 +19,11 @@ from .operations_async import Operations from .operations_async import SubscriptionsOperations from .operations_async import TenantsOperations +from .operations_async import SubscriptionClientOperationsMixin from .. import models -class SubscriptionClient(object): +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 diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations_async/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations_async/__init__.py index 05cc20fe3ece..3f6612d8579c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations_async/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations_async/__init__.py @@ -9,9 +9,11 @@ from ._operations_async import Operations from ._subscriptions_operations_async import SubscriptionsOperations from ._tenants_operations_async import TenantsOperations +from ._subscription_client_operations_async import SubscriptionClientOperationsMixin __all__ = [ 'Operations', 'SubscriptionsOperations', 'TenantsOperations', + 'SubscriptionClientOperationsMixin', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations_async/_subscription_client_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations_async/_subscription_client_operations_async.py new file mode 100644 index 000000000000..6d418e5b7ce9 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations_async/_subscription_client_operations_async.py @@ -0,0 +1,81 @@ +# 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, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SubscriptionClientOperationsMixin: + + async def check_resource_name( + self, + resource_name_definition: Optional["models.ResourceName"] = None, + **kwargs + ) -> "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.v2018_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.v2018_06_01.models.CheckResourceNameResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckResourceNameResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-06-01" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + 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 = await 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/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/__init__.py index 4a05f8dc94cf..4d3bb8b7d259 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/__init__.py @@ -7,22 +7,30 @@ # -------------------------------------------------------------------------- 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 @@ -30,21 +38,27 @@ 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/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_models.py index fc434bb268ce..e7f7b644f9b0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_models.py @@ -6,9 +6,80 @@ # 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.v2018_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.v2018_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. @@ -156,6 +227,36 @@ def __init__( 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. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_models_py3.py index 7f56bf3f2989..c0e1457f1a77 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_models_py3.py @@ -6,10 +6,92 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional +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.v2018_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.v2018_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. @@ -171,6 +253,39 @@ def __init__( 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. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_subscription_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_subscription_client_enums.py index 85f50e46d3d8..cd0d7b838fe6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_subscription_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_subscription_client_enums.py @@ -8,6 +8,13 @@ from enum import Enum +class ResourceNameStatus(str, Enum): + """Is the resource name Allowed or Reserved + """ + + allowed = "Allowed" + reserved = "Reserved" + class SpendingLimit(str, Enum): """The subscription spending limit. """ diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/__init__.py index 5ba2b6faf288..228a89205dbd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/__init__.py @@ -9,9 +9,11 @@ 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/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_subscription_client_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_subscription_client_operations.py new file mode 100644 index 000000000000..d5e9269d7033 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_subscription_client_operations.py @@ -0,0 +1,86 @@ +# 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 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.v2018_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.v2018_06_01.models.CheckResourceNameResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckResourceNameResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2018-06-01" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + 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/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_metadata.json index 2677a4beed04..ce7a35e35e84 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_metadata.json @@ -34,10 +34,21 @@ "operation_groups": { "operations": "Operations", "subscriptions": "SubscriptionsOperations", - "tenants": "TenantsOperations" + "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" + }, + "async": { + "signature": "async def check_resource_name(\n self,\n resource_name_definition: Optional[\"models.ResourceName\"] = None,\n **kwargs\n) -\u003e \"models.CheckResourceNameResult\":\n", + "coroutine": true + }, + "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_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.v2019_06_01.models.CheckResourceNameResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"", + "call": "resource_name_definition" + } }, - "sync_imports": "None", - "async_imports": "None" + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"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\": [\"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/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_subscription_client.py index a51dab34e904..474d1fc8fff5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_subscription_client.py @@ -21,10 +21,11 @@ from .operations import Operations from .operations import SubscriptionsOperations from .operations import TenantsOperations +from .operations import SubscriptionClientOperationsMixin from . import models -class SubscriptionClient(object): +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 diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/_subscription_client_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/_subscription_client_async.py index 3fe2fdb3d5a0..077aed2178ae 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/_subscription_client_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/_subscription_client_async.py @@ -19,10 +19,11 @@ from .operations_async import Operations from .operations_async import SubscriptionsOperations from .operations_async import TenantsOperations +from .operations_async import SubscriptionClientOperationsMixin from .. import models -class SubscriptionClient(object): +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 diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations_async/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations_async/__init__.py index 05cc20fe3ece..3f6612d8579c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations_async/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations_async/__init__.py @@ -9,9 +9,11 @@ from ._operations_async import Operations from ._subscriptions_operations_async import SubscriptionsOperations from ._tenants_operations_async import TenantsOperations +from ._subscription_client_operations_async import SubscriptionClientOperationsMixin __all__ = [ 'Operations', 'SubscriptionsOperations', 'TenantsOperations', + 'SubscriptionClientOperationsMixin', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations_async/_subscription_client_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations_async/_subscription_client_operations_async.py new file mode 100644 index 000000000000..e165b2879c18 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations_async/_subscription_client_operations_async.py @@ -0,0 +1,81 @@ +# 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, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SubscriptionClientOperationsMixin: + + async def check_resource_name( + self, + resource_name_definition: Optional["models.ResourceName"] = None, + **kwargs + ) -> "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_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.v2019_06_01.models.CheckResourceNameResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckResourceNameResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + 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 = await 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/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/__init__.py index fe0f04cc3aed..7dccb979f7cf 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/__init__.py @@ -7,24 +7,32 @@ # -------------------------------------------------------------------------- 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 ManagedByTenant 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 ManagedByTenant # 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 @@ -32,23 +40,29 @@ from ._models import TenantListResult # type: ignore from ._subscription_client_enums import ( + ResourceNameStatus, SpendingLimit, SubscriptionState, TenantCategory, ) __all__ = [ + 'CheckResourceNameResult', + 'ErrorDefinition', + 'ErrorResponse', 'Location', 'LocationListResult', 'ManagedByTenant', 'Operation', 'OperationDisplay', 'OperationListResult', + 'ResourceName', 'Subscription', 'SubscriptionListResult', 'SubscriptionPolicies', 'TenantIdDescription', 'TenantListResult', + 'ResourceNameStatus', 'SpendingLimit', 'SubscriptionState', 'TenantCategory', diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_models.py index 3a23caf3cee0..098139fbac4f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_models.py @@ -6,9 +6,80 @@ # 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_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.v2019_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. @@ -181,6 +252,36 @@ def __init__( 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. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_models_py3.py index aa8046de37fa..9187caff6e22 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_models_py3.py @@ -6,10 +6,92 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, Optional +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.v2019_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.v2019_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. @@ -196,6 +278,39 @@ def __init__( 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. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_subscription_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_subscription_client_enums.py index 0bc0d2215c9b..984662740cba 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_subscription_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_subscription_client_enums.py @@ -8,6 +8,13 @@ from enum import Enum +class ResourceNameStatus(str, Enum): + """Is the resource name Allowed or Reserved + """ + + allowed = "Allowed" + reserved = "Reserved" + class SpendingLimit(str, Enum): """The subscription spending limit. """ diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/__init__.py index 5ba2b6faf288..228a89205dbd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/__init__.py @@ -9,9 +9,11 @@ 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/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_subscription_client_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_subscription_client_operations.py new file mode 100644 index 000000000000..a880c12dceb3 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_subscription_client_operations.py @@ -0,0 +1,86 @@ +# 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 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_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.v2019_06_01.models.CheckResourceNameResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckResourceNameResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + 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/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_metadata.json index 4fbc9a86fb64..56ad8e276956 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_metadata.json @@ -34,10 +34,21 @@ "operation_groups": { "operations": "Operations", "subscriptions": "SubscriptionsOperations", - "tenants": "TenantsOperations" + "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" + }, + "async": { + "signature": "async def check_resource_name(\n self,\n resource_name_definition: Optional[\"models.ResourceName\"] = None,\n **kwargs\n) -\u003e \"models.CheckResourceNameResult\":\n", + "coroutine": true + }, + "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": "None", - "async_imports": "None" + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"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\": [\"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/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_subscription_client.py index 779e502a5f2c..dcb7b28e5a66 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_subscription_client.py @@ -21,10 +21,11 @@ from .operations import Operations from .operations import SubscriptionsOperations from .operations import TenantsOperations +from .operations import SubscriptionClientOperationsMixin from . import models -class SubscriptionClient(object): +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 diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/_subscription_client_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/_subscription_client_async.py index d6f7ced83db2..9a247a796d30 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/_subscription_client_async.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/_subscription_client_async.py @@ -19,10 +19,11 @@ from .operations_async import Operations from .operations_async import SubscriptionsOperations from .operations_async import TenantsOperations +from .operations_async import SubscriptionClientOperationsMixin from .. import models -class SubscriptionClient(object): +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 diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations_async/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations_async/__init__.py index 05cc20fe3ece..3f6612d8579c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations_async/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations_async/__init__.py @@ -9,9 +9,11 @@ from ._operations_async import Operations from ._subscriptions_operations_async import SubscriptionsOperations from ._tenants_operations_async import TenantsOperations +from ._subscription_client_operations_async import SubscriptionClientOperationsMixin __all__ = [ 'Operations', 'SubscriptionsOperations', 'TenantsOperations', + 'SubscriptionClientOperationsMixin', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations_async/_subscription_client_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations_async/_subscription_client_operations_async.py new file mode 100644 index 000000000000..82c7d1f05319 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations_async/_subscription_client_operations_async.py @@ -0,0 +1,81 @@ +# 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, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SubscriptionClientOperationsMixin: + + async def check_resource_name( + self, + resource_name_definition: Optional["models.ResourceName"] = None, + **kwargs + ) -> "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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + 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 = await 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/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/__init__.py index 0880e6f4cf8f..961846b3a326 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/__init__.py @@ -7,6 +7,9 @@ # -------------------------------------------------------------------------- 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 @@ -15,12 +18,16 @@ 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 @@ -29,6 +36,7 @@ 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 @@ -38,12 +46,16 @@ from ._subscription_client_enums import ( RegionCategory, RegionType, + ResourceNameStatus, SpendingLimit, SubscriptionState, TenantCategory, ) __all__ = [ + 'CheckResourceNameResult', + 'ErrorDefinition', + 'ErrorResponse', 'Location', 'LocationListResult', 'LocationMetadata', @@ -52,6 +64,7 @@ 'OperationDisplay', 'OperationListResult', 'PairedRegion', + 'ResourceName', 'Subscription', 'SubscriptionListResult', 'SubscriptionPolicies', @@ -59,6 +72,7 @@ 'TenantListResult', 'RegionCategory', 'RegionType', + 'ResourceNameStatus', 'SpendingLimit', 'SubscriptionState', 'TenantCategory', diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models.py index b0f74f8caa5d..cd7ffe360594 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models.py @@ -6,9 +6,80 @@ # 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. @@ -272,6 +343,36 @@ def __init__( 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. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models_py3.py index 6059c37ad69e..b1564c2e4008 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models_py3.py @@ -6,10 +6,92 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional +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. @@ -291,6 +373,39 @@ def __init__( 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. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_subscription_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_subscription_client_enums.py index bdac328047d3..f8a54f4e71b7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_subscription_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_subscription_client_enums.py @@ -22,6 +22,13 @@ class RegionType(str, Enum): physical = "Physical" logical = "Logical" +class ResourceNameStatus(str, Enum): + """Is the resource name Allowed or Reserved + """ + + allowed = "Allowed" + reserved = "Reserved" + class SpendingLimit(str, Enum): """The subscription spending limit. """ diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/__init__.py index 5ba2b6faf288..228a89205dbd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/__init__.py @@ -9,9 +9,11 @@ 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/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_subscription_client_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_subscription_client_operations.py new file mode 100644 index 000000000000..201c29fb1570 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_subscription_client_operations.py @@ -0,0 +1,86 @@ +# 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 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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + 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/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/__init__.py deleted file mode 100644 index c168f3639e61..000000000000 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/__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 ._template_specs_client import TemplateSpecsClient -__all__ = ['TemplateSpecsClient'] - -try: - from ._patch import patch_sdk - patch_sdk() -except ImportError: - pass diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/_configuration.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/_configuration.py deleted file mode 100644 index e5e2994ab07a..000000000000 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/_configuration.py +++ /dev/null @@ -1,65 +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 ._version import VERSION - - -class TemplateSpecsClientConfiguration(Configuration): - """Configuration for TemplateSpecsClient. - - 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 - :param subscription_id: Subscription Id which forms part of the URI for every service call. - :type subscription_id: str - """ - - def __init__( - self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - super(TemplateSpecsClientConfiguration, self).__init__(**kwargs) - - self.credential = credential - self.subscription_id = subscription_id - self.credential_scopes = ['https://management.azure.com/.default'] - self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) - 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.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/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/_template_specs_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/_template_specs_client.py deleted file mode 100644 index f11577af6cfa..000000000000 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/_template_specs_client.py +++ /dev/null @@ -1,125 +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 TemplateSpecsClientConfiguration - -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 TemplateSpecsClient(MultiApiClientMixin, _SDKClient): - """The APIs listed in this specification can be used to manage Template Spec resources through the Azure Resource Manager. - - 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 subscription_id: Subscription Id which forms part of the URI for every service call. - :type subscription_id: str - :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 - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - """ - - DEFAULT_API_VERSION = '2019-06-01-preview' - _PROFILE_TAG = "azure.mgmt.resource.TemplateSpecsClient" - LATEST_PROFILE = ProfileDefinition({ - _PROFILE_TAG: { - None: DEFAULT_API_VERSION, - }}, - _PROFILE_TAG + " latest" - ) - - def __init__( - self, - credential, # type: "TokenCredential" - subscription_id, # type: str - api_version=None, - base_url=None, - profile=KnownProfiles.default, - **kwargs # type: Any - ): - if not base_url: - base_url = 'https://management.azure.com' - self._config = TemplateSpecsClientConfiguration(credential, subscription_id, **kwargs) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - super(TemplateSpecsClient, self).__init__( - credential, - self._config, - 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: - - * 2019-06-01-preview: :mod:`v2019_06_preview.models` - """ - if api_version == '2019-06-01-preview': - from .v2019_06_preview import models - return models - raise NotImplementedError("APIVersion {} is not available".format(api_version)) - - @property - def template_spec_versions(self): - """Instance depends on the API version: - - * 2019-06-01-preview: :class:`TemplateSpecVersionsOperations` - """ - api_version = self._get_api_version('template_spec_versions') - if api_version == '2019-06-01-preview': - from .v2019_06_preview.operations import TemplateSpecVersionsOperations as OperationClass - else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - - @property - def template_specs(self): - """Instance depends on the API version: - - * 2019-06-01-preview: :class:`TemplateSpecsOperations` - """ - api_version = self._get_api_version('template_specs') - if api_version == '2019-06-01-preview': - from .v2019_06_preview.operations import TemplateSpecsOperations as OperationClass - else: - raise NotImplementedError("APIVersion {} is not available".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/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/_version.py deleted file mode 100644 index a30a458f8b5b..000000000000 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/_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/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/aio/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/aio/__init__.py deleted file mode 100644 index 7cbe5c7d3c81..000000000000 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/aio/__init__.py +++ /dev/null @@ -1,10 +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 ._template_specs_client_async import TemplateSpecsClient -__all__ = ['TemplateSpecsClient'] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/aio/_configuration_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/aio/_configuration_async.py deleted file mode 100644 index 3a32e9a9726d..000000000000 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/aio/_configuration_async.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 Any - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies - -from .._version import VERSION - - -class TemplateSpecsClientConfiguration(Configuration): - """Configuration for TemplateSpecsClient. - - 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_async.AsyncTokenCredential - :param subscription_id: Subscription Id which forms part of the URI for every service call. - :type subscription_id: str - """ - - def __init__( - self, - credential, # type: "AsyncTokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ) -> None: - # type: (...) -> None - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - super(TemplateSpecsClientConfiguration, self).__init__(**kwargs) - - self.credential = credential - self.subscription_id = subscription_id - self.credential_scopes = ['https://management.azure.com/.default'] - self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) - kwargs.setdefault('sdk_moniker', 'azure-mgmt-resource/{}'.format(VERSION)) - self._configure(**kwargs) - - def _configure( - self, - **kwargs: Any - ) -> 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.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') - if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/aio/_template_specs_client_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/aio/_template_specs_client_async.py deleted file mode 100644 index a768b172389b..000000000000 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/aio/_template_specs_client_async.py +++ /dev/null @@ -1,125 +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 AsyncARMPipelineClient -from msrest import Serializer, Deserializer - -from azure.profiles import KnownProfiles, ProfileDefinition -from azure.profiles.multiapiclient import MultiApiClientMixin -from ._configuration_async import TemplateSpecsClientConfiguration - -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 TemplateSpecsClient(MultiApiClientMixin, _SDKClient): - """The APIs listed in this specification can be used to manage Template Spec resources through the Azure Resource Manager. - - 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_async.AsyncTokenCredential - :param subscription_id: Subscription Id which forms part of the URI for every service call. - :type subscription_id: str - :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 - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - """ - - DEFAULT_API_VERSION = '2019-06-01-preview' - _PROFILE_TAG = "azure.mgmt.resource.TemplateSpecsClient" - LATEST_PROFILE = ProfileDefinition({ - _PROFILE_TAG: { - None: DEFAULT_API_VERSION, - }}, - _PROFILE_TAG + " latest" - ) - - def __init__( - self, - credential, # type: "AsyncTokenCredential" - subscription_id, # type: str - api_version=None, - base_url=None, - profile=KnownProfiles.default, - **kwargs # type: Any - ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = TemplateSpecsClientConfiguration(credential, subscription_id, **kwargs) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - super(TemplateSpecsClient, self).__init__( - credential, - self._config, - 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: - - * 2019-06-01-preview: :mod:`v2019_06_preview.models` - """ - if api_version == '2019-06-01-preview': - from ..v2019_06_preview import models - return models - raise NotImplementedError("APIVersion {} is not available".format(api_version)) - - @property - def template_spec_versions(self): - """Instance depends on the API version: - - * 2019-06-01-preview: :class:`TemplateSpecVersionsOperations` - """ - api_version = self._get_api_version('template_spec_versions') - if api_version == '2019-06-01-preview': - from ..v2019_06_preview.aio.operations_async import TemplateSpecVersionsOperations as OperationClass - else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - - @property - def template_specs(self): - """Instance depends on the API version: - - * 2019-06-01-preview: :class:`TemplateSpecsOperations` - """ - api_version = self._get_api_version('template_specs') - if api_version == '2019-06-01-preview': - from ..v2019_06_preview.aio.operations_async import TemplateSpecsOperations as OperationClass - else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - - async def close(self): - await self._client.close() - async def __aenter__(self): - await self._client.__aenter__() - return self - async def __aexit__(self, *exc_details): - await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/models.py deleted file mode 100644 index ee3facccb01d..000000000000 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/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_06_preview.models import * diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/py.typed b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/__init__.py deleted file mode 100644 index c168f3639e61..000000000000 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/__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 ._template_specs_client import TemplateSpecsClient -__all__ = ['TemplateSpecsClient'] - -try: - from ._patch import patch_sdk - patch_sdk() -except ImportError: - pass diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/_configuration.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/_configuration.py deleted file mode 100644 index fbe514f51df8..000000000000 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/_configuration.py +++ /dev/null @@ -1,69 +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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any - - from azure.core.credentials import TokenCredential - -VERSION = "unknown" - -class TemplateSpecsClientConfiguration(Configuration): - """Configuration for TemplateSpecsClient. - - 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 - :param subscription_id: Subscription Id which forms part of the URI for every service call. - :type subscription_id: str - """ - - def __init__( - self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - super(TemplateSpecsClientConfiguration, self).__init__(**kwargs) - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = "2019-06-01-preview" - self.credential_scopes = ['https://management.azure.com/.default'] - self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) - 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.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/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/_metadata.json deleted file mode 100644 index 9fc5200afb72..000000000000 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/_metadata.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "chosen_version": "2019-06-01-preview", - "total_api_version_list": ["2019-06-01-preview"], - "client": { - "name": "TemplateSpecsClient", - "filename": "_template_specs_client", - "description": "The APIs listed in this specification can be used to manage Template Spec resources through the Azure Resource Manager." - }, - "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 - }, - "subscription_id": { - "method_signature": "subscription_id, # type: str", - "description": "Subscription Id which forms part of the URI for every service call.", - "docstring_type": "str", - "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 - }, - "subscription_id": { - "method_signature": "subscription_id, # type: str", - "description": "Subscription Id which forms part of the URI for every service call.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id" - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"] - }, - "operation_groups": { - "template_specs": "TemplateSpecsOperations", - "template_spec_versions": "TemplateSpecVersionsOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" -} \ No newline at end of file diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/_template_specs_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/_template_specs_client.py deleted file mode 100644 index acba2582d7f3..000000000000 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/_template_specs_client.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 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 TemplateSpecsClientConfiguration -from .operations import TemplateSpecsOperations -from .operations import TemplateSpecVersionsOperations -from . import models - - -class TemplateSpecsClient(object): - """The APIs listed in this specification can be used to manage Template Spec resources through the Azure Resource Manager. - - :ivar template_specs: TemplateSpecsOperations operations - :vartype template_specs: azure.mgmt.resource.templatespecs.v2019_06_preview.operations.TemplateSpecsOperations - :ivar template_spec_versions: TemplateSpecVersionsOperations operations - :vartype template_spec_versions: azure.mgmt.resource.templatespecs.v2019_06_preview.operations.TemplateSpecVersionsOperations - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Subscription Id which forms part of the URI for every service call. - :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - """ - - def __init__( - self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = TemplateSpecsClientConfiguration(credential, subscription_id, **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._deserialize = Deserializer(client_models) - - self.template_specs = TemplateSpecsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.template_spec_versions = TemplateSpecVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - - def close(self): - # type: () -> None - self._client.close() - - def __enter__(self): - # type: () -> TemplateSpecsClient - self._client.__enter__() - return self - - def __exit__(self, *exc_details): - # type: (Any) -> None - self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/aio/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/aio/__init__.py deleted file mode 100644 index 7cbe5c7d3c81..000000000000 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/aio/__init__.py +++ /dev/null @@ -1,10 +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 ._template_specs_client_async import TemplateSpecsClient -__all__ = ['TemplateSpecsClient'] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/aio/_configuration_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/aio/_configuration_async.py deleted file mode 100644 index a92459eae388..000000000000 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/aio/_configuration_async.py +++ /dev/null @@ -1,65 +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, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - -VERSION = "unknown" - -class TemplateSpecsClientConfiguration(Configuration): - """Configuration for TemplateSpecsClient. - - 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_async.AsyncTokenCredential - :param subscription_id: Subscription Id which forms part of the URI for every service call. - :type subscription_id: str - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - super(TemplateSpecsClientConfiguration, self).__init__(**kwargs) - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = "2019-06-01-preview" - self.credential_scopes = ['https://management.azure.com/.default'] - self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) - kwargs.setdefault('sdk_moniker', 'mgmt-resource/{}'.format(VERSION)) - self._configure(**kwargs) - - def _configure( - self, - **kwargs: Any - ) -> 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.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') - if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/aio/_template_specs_client_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/aio/_template_specs_client_async.py deleted file mode 100644 index 35120da77cf9..000000000000 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/aio/_template_specs_client_async.py +++ /dev/null @@ -1,68 +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, Optional, TYPE_CHECKING - -from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - -from ._configuration_async import TemplateSpecsClientConfiguration -from .operations_async import TemplateSpecsOperations -from .operations_async import TemplateSpecVersionsOperations -from .. import models - - -class TemplateSpecsClient(object): - """The APIs listed in this specification can be used to manage Template Spec resources through the Azure Resource Manager. - - :ivar template_specs: TemplateSpecsOperations operations - :vartype template_specs: azure.mgmt.resource.templatespecs.v2019_06_preview.aio.operations_async.TemplateSpecsOperations - :ivar template_spec_versions: TemplateSpecVersionsOperations operations - :vartype template_spec_versions: azure.mgmt.resource.templatespecs.v2019_06_preview.aio.operations_async.TemplateSpecVersionsOperations - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Subscription Id which forms part of the URI for every service call. - :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: Optional[str] = None, - **kwargs: Any - ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = TemplateSpecsClientConfiguration(credential, subscription_id, **kwargs) - self._client = AsyncARMPipelineClient(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._deserialize = Deserializer(client_models) - - self.template_specs = TemplateSpecsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.template_spec_versions = TemplateSpecVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "TemplateSpecsClient": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/aio/operations_async/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/aio/operations_async/__init__.py deleted file mode 100644 index abd8a12ca789..000000000000 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/aio/operations_async/__init__.py +++ /dev/null @@ -1,15 +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 ._template_specs_operations_async import TemplateSpecsOperations -from ._template_spec_versions_operations_async import TemplateSpecVersionsOperations - -__all__ = [ - 'TemplateSpecsOperations', - 'TemplateSpecVersionsOperations', -] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/aio/operations_async/_template_spec_versions_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/aio/operations_async/_template_spec_versions_operations_async.py deleted file mode 100644 index af04c7f44fba..000000000000 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/aio/operations_async/_template_spec_versions_operations_async.py +++ /dev/null @@ -1,377 +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, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class TemplateSpecVersionsOperations: - """TemplateSpecVersionsOperations async 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.templatespecs.v2019_06_preview.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) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - async def create_or_update( - self, - resource_group_name: str, - template_spec_name: str, - template_spec_version: str, - template_spec_version_model: "models.TemplateSpecVersion", - **kwargs - ) -> "models.TemplateSpecVersion": - """Creates or updates a Template Spec version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param template_spec_name: Name of the Template Spec. - :type template_spec_name: str - :param template_spec_version: The version of the Template Spec. - :type template_spec_version: str - :param template_spec_version_model: Template Spec Version supplied to the operation. - :type template_spec_version_model: ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.TemplateSpecVersion - :keyword callable cls: A custom type or function that will be passed the direct response - :return: TemplateSpecVersion, or the result of cls(response) - :rtype: ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.TemplateSpecVersion - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpecVersion"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'templateSpecName': self._serialize.url("template_spec_name", template_spec_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'templateSpecVersion': self._serialize.url("template_spec_version", template_spec_version, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - 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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(template_spec_version_model, 'TemplateSpecVersion') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.TemplateSpecsError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('TemplateSpecVersion', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('TemplateSpecVersion', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName}/versions/{templateSpecVersion}'} # type: ignore - - async def update( - self, - resource_group_name: str, - template_spec_name: str, - template_spec_version: str, - template_spec_version_update_model: Optional["models.TemplateSpecVersionUpdateModel"] = None, - **kwargs - ) -> "models.TemplateSpecVersion": - """Updates Template Spec Version tags with specified values. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param template_spec_name: Name of the Template Spec. - :type template_spec_name: str - :param template_spec_version: The version of the Template Spec. - :type template_spec_version: str - :param template_spec_version_update_model: Template Spec Version resource with the tags to be - updated. - :type template_spec_version_update_model: ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.TemplateSpecVersionUpdateModel - :keyword callable cls: A custom type or function that will be passed the direct response - :return: TemplateSpecVersion, or the result of cls(response) - :rtype: ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.TemplateSpecVersion - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpecVersion"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'templateSpecName': self._serialize.url("template_spec_name", template_spec_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'templateSpecVersion': self._serialize.url("template_spec_version", template_spec_version, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - 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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - body_content_kwargs = {} # type: Dict[str, Any] - if template_spec_version_update_model is not None: - body_content = self._serialize.body(template_spec_version_update_model, 'TemplateSpecVersionUpdateModel') - else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - - pipeline_response = await 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.TemplateSpecsError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('TemplateSpecVersion', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName}/versions/{templateSpecVersion}'} # type: ignore - - async def get( - self, - resource_group_name: str, - template_spec_name: str, - template_spec_version: str, - **kwargs - ) -> "models.TemplateSpecVersion": - """Gets a Template Spec version from a specific Template Spec. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param template_spec_name: Name of the Template Spec. - :type template_spec_name: str - :param template_spec_version: The version of the Template Spec. - :type template_spec_version: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: TemplateSpecVersion, or the result of cls(response) - :rtype: ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.TemplateSpecVersion - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpecVersion"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'templateSpecName': self._serialize.url("template_spec_name", template_spec_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'templateSpecVersion': self._serialize.url("template_spec_version", template_spec_version, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - 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'] = 'application/json' - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await 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.TemplateSpecsError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('TemplateSpecVersion', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName}/versions/{templateSpecVersion}'} # type: ignore - - async def delete( - self, - resource_group_name: str, - template_spec_name: str, - template_spec_version: str, - **kwargs - ) -> None: - """Deletes a specific version from a Template Spec. When operation completes, status code 200 - returned without content. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param template_spec_name: Name of the Template Spec. - :type template_spec_name: str - :param template_spec_version: The version of the Template Spec. - :type template_spec_version: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'templateSpecName': self._serialize.url("template_spec_name", template_spec_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'templateSpecVersion': self._serialize.url("template_spec_version", template_spec_version, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - 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] - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.TemplateSpecsError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName}/versions/{templateSpecVersion}'} # type: ignore - - def list( - self, - resource_group_name: str, - template_spec_name: str, - **kwargs - ) -> AsyncIterable["models.TemplateSpecVersionsListResult"]: - """Lists all the Template Spec versions in the specified Template Spec. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param template_spec_name: Name of the Template Spec. - :type template_spec_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TemplateSpecVersionsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.templatespecs.v2019_06_preview.models.TemplateSpecVersionsListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpecVersionsListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'templateSpecName': self._serialize.url("template_spec_name", template_spec_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - 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 - - async def extract_data(pipeline_response): - deserialized = self._deserialize('TemplateSpecVersionsListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.TemplateSpecsError, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName}/versions'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/aio/operations_async/_template_specs_operations_async.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/aio/operations_async/_template_specs_operations_async.py deleted file mode 100644 index 927558d4f239..000000000000 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/aio/operations_async/_template_specs_operations_async.py +++ /dev/null @@ -1,420 +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, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class TemplateSpecsOperations: - """TemplateSpecsOperations async 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.templatespecs.v2019_06_preview.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) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - async def create_or_update( - self, - resource_group_name: str, - template_spec_name: str, - template_spec: "models.TemplateSpec", - **kwargs - ) -> "models.TemplateSpec": - """Creates or updates a Template Spec. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param template_spec_name: Name of the Template Spec. - :type template_spec_name: str - :param template_spec: Template Spec supplied to the operation. - :type template_spec: ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.TemplateSpec - :keyword callable cls: A custom type or function that will be passed the direct response - :return: TemplateSpec, or the result of cls(response) - :rtype: ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.TemplateSpec - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpec"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'templateSpecName': self._serialize.url("template_spec_name", template_spec_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - 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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(template_spec, 'TemplateSpec') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.TemplateSpecsError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('TemplateSpec', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('TemplateSpec', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName}'} # type: ignore - - async def update( - self, - resource_group_name: str, - template_spec_name: str, - template_spec: Optional["models.TemplateSpecUpdateModel"] = None, - **kwargs - ) -> "models.TemplateSpec": - """Updates Template Spec tags with specified values. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param template_spec_name: Name of the Template Spec. - :type template_spec_name: str - :param template_spec: Template Spec resource with the tags to be updated. - :type template_spec: ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.TemplateSpecUpdateModel - :keyword callable cls: A custom type or function that will be passed the direct response - :return: TemplateSpec, or the result of cls(response) - :rtype: ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.TemplateSpec - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpec"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'templateSpecName': self._serialize.url("template_spec_name", template_spec_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - 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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - body_content_kwargs = {} # type: Dict[str, Any] - if template_spec is not None: - body_content = self._serialize.body(template_spec, 'TemplateSpecUpdateModel') - else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - - pipeline_response = await 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.TemplateSpecsError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('TemplateSpec', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName}'} # type: ignore - - async def get( - self, - resource_group_name: str, - template_spec_name: str, - **kwargs - ) -> "models.TemplateSpec": - """Gets a Template Spec with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param template_spec_name: Name of the Template Spec. - :type template_spec_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: TemplateSpec, or the result of cls(response) - :rtype: ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.TemplateSpec - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpec"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'templateSpecName': self._serialize.url("template_spec_name", template_spec_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - 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'] = 'application/json' - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await 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.TemplateSpecsError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('TemplateSpec', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName}'} # type: ignore - - async def delete( - self, - resource_group_name: str, - template_spec_name: str, - **kwargs - ) -> None: - """Deletes a Template Spec by name. When operation completes, status code 200 returned without - content. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param template_spec_name: Name of the Template Spec. - :type template_spec_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'templateSpecName': self._serialize.url("template_spec_name", template_spec_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - 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] - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.TemplateSpecsError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName}'} # type: ignore - - def list_by_subscription( - self, - **kwargs - ) -> AsyncIterable["models.TemplateSpecsListResult"]: - """Lists all the Template Specs within the specified subscriptions. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TemplateSpecsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.templatespecs.v2019_06_preview.models.TemplateSpecsListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpecsListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.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 - - async def extract_data(pipeline_response): - deserialized = self._deserialize('TemplateSpecsListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.TemplateSpecsError, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/templateSpecs/'} # type: ignore - - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs - ) -> AsyncIterable["models.TemplateSpecsListResult"]: - """Lists all the Template Specs within the specified resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TemplateSpecsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.templatespecs.v2019_06_preview.models.TemplateSpecsListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpecsListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - 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 - - async def extract_data(pipeline_response): - deserialized = self._deserialize('TemplateSpecsListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.TemplateSpecsError, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/models/__init__.py deleted file mode 100644 index f72927bdc0fa..000000000000 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/models/__init__.py +++ /dev/null @@ -1,57 +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 AzureResourceBase - from ._models_py3 import ErrorAdditionalInfo - from ._models_py3 import ErrorResponse - from ._models_py3 import SystemData - from ._models_py3 import TemplateSpec - from ._models_py3 import TemplateSpecArtifact - from ._models_py3 import TemplateSpecTemplateArtifact - from ._models_py3 import TemplateSpecUpdateModel - from ._models_py3 import TemplateSpecVersion - from ._models_py3 import TemplateSpecVersionUpdateModel - from ._models_py3 import TemplateSpecVersionsListResult - from ._models_py3 import TemplateSpecsError - from ._models_py3 import TemplateSpecsListResult -except (SyntaxError, ImportError): - from ._models import AzureResourceBase # type: ignore - from ._models import ErrorAdditionalInfo # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import SystemData # type: ignore - from ._models import TemplateSpec # type: ignore - from ._models import TemplateSpecArtifact # type: ignore - from ._models import TemplateSpecTemplateArtifact # type: ignore - from ._models import TemplateSpecUpdateModel # type: ignore - from ._models import TemplateSpecVersion # type: ignore - from ._models import TemplateSpecVersionUpdateModel # type: ignore - from ._models import TemplateSpecVersionsListResult # type: ignore - from ._models import TemplateSpecsError # type: ignore - from ._models import TemplateSpecsListResult # type: ignore - -from ._template_specs_client_enums import ( - CreatedByType, -) - -__all__ = [ - 'AzureResourceBase', - 'ErrorAdditionalInfo', - 'ErrorResponse', - 'SystemData', - 'TemplateSpec', - 'TemplateSpecArtifact', - 'TemplateSpecTemplateArtifact', - 'TemplateSpecUpdateModel', - 'TemplateSpecVersion', - 'TemplateSpecVersionUpdateModel', - 'TemplateSpecVersionsListResult', - 'TemplateSpecsError', - 'TemplateSpecsListResult', - 'CreatedByType', -] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/models/_models.py deleted file mode 100644 index 7edc8d96b69b..000000000000 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/models/_models.py +++ /dev/null @@ -1,524 +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 AzureResourceBase(msrest.serialization.Model): - """Common properties for all Azure resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: String Id used to locate any resource on Azure. - :vartype id: str - :ivar name: Name of this resource. - :vartype name: str - :ivar type: Type of this resource. - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureResourceBase, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class ErrorAdditionalInfo(msrest.serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: object - """ - - _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorAdditionalInfo, self).__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorResponse(msrest.serialization.Model): - """The resource management error response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: - list[~azure.mgmt.resource.templatespecs.v2019_06_preview.models.ErrorResponse] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.mgmt.resource.templatespecs.v2019_06_preview.models.ErrorAdditionalInfo] - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorResponse]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or - ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or - ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.CreatedByType - :param last_modified_at: The type of identity that last modified the resource. - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class TemplateSpec(AzureResourceBase): - """Template Spec object. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: String Id used to locate any resource on Azure. - :vartype id: str - :ivar name: Name of this resource. - :vartype name: str - :ivar type: Type of this resource. - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.SystemData - :param location: Required. The location of the Template Spec. It cannot be changed after - Template Spec creation. It must be one of the supported Azure locations. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param description: Template Spec description. - :type description: str - :param display_name: Template Spec display name. - :type display_name: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'description': {'max_length': 4096, 'min_length': 0}, - 'display_name': {'max_length': 64, 'min_length': 0}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TemplateSpec, self).__init__(**kwargs) - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.description = kwargs.get('description', None) - self.display_name = kwargs.get('display_name', None) - - -class TemplateSpecArtifact(msrest.serialization.Model): - """Represents a Template Spec artifact. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: TemplateSpecTemplateArtifact. - - All required parameters must be populated in order to send to Azure. - - :param path: Required. A filesystem safe relative path of the artifact. - :type path: str - :param kind: Required. The kind of artifact.Constant filled by server. - :type kind: str - """ - - _validation = { - 'path': {'required': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'path': {'key': 'path', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - } - - _subtype_map = { - 'kind': {'template': 'TemplateSpecTemplateArtifact'} - } - - def __init__( - self, - **kwargs - ): - super(TemplateSpecArtifact, self).__init__(**kwargs) - self.path = kwargs['path'] - self.kind = None - - -class TemplateSpecsError(msrest.serialization.Model): - """Template Specs error response. - - :param error: The resource management error response. - :type error: ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.ErrorResponse - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponse'}, - } - - def __init__( - self, - **kwargs - ): - super(TemplateSpecsError, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class TemplateSpecsListResult(msrest.serialization.Model): - """List of Template Specs. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: An array of Template Specs. - :type value: list[~azure.mgmt.resource.templatespecs.v2019_06_preview.models.TemplateSpec] - :ivar next_link: The URL to use for getting the next set of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[TemplateSpec]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TemplateSpecsListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class TemplateSpecTemplateArtifact(TemplateSpecArtifact): - """Represents a Template Spec artifact containing an embedded Azure Resource Manager template. - - All required parameters must be populated in order to send to Azure. - - :param path: Required. A filesystem safe relative path of the artifact. - :type path: str - :param kind: Required. The kind of artifact.Constant filled by server. - :type kind: str - :param template: Required. The Azure Resource Manager template. - :type template: object - """ - - _validation = { - 'path': {'required': True}, - 'kind': {'required': True}, - 'template': {'required': True}, - } - - _attribute_map = { - 'path': {'key': 'path', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'template': {'key': 'template', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(TemplateSpecTemplateArtifact, self).__init__(**kwargs) - self.kind = 'template' - self.template = kwargs['template'] - - -class TemplateSpecUpdateModel(AzureResourceBase): - """Template Spec properties to be updated (only tags are currently supported). - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: String Id used to locate any resource on Azure. - :vartype id: str - :ivar name: Name of this resource. - :vartype name: str - :ivar type: Type of this resource. - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.SystemData - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(TemplateSpecUpdateModel, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class TemplateSpecVersion(AzureResourceBase): - """Template Spec Version object. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: String Id used to locate any resource on Azure. - :vartype id: str - :ivar name: Name of this resource. - :vartype name: str - :ivar type: Type of this resource. - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.SystemData - :param location: Required. The location of the Template Spec Version. It must match the - location of the parent Template Spec. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param artifacts: An array of Template Spec artifacts. - :type artifacts: - list[~azure.mgmt.resource.templatespecs.v2019_06_preview.models.TemplateSpecArtifact] - :param description: Template Spec version description. - :type description: str - :param template: The Azure Resource Manager template content. - :type template: object - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'description': {'max_length': 4096, 'min_length': 0}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'artifacts': {'key': 'properties.artifacts', 'type': '[TemplateSpecArtifact]'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'template': {'key': 'properties.template', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(TemplateSpecVersion, self).__init__(**kwargs) - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.artifacts = kwargs.get('artifacts', None) - self.description = kwargs.get('description', None) - self.template = kwargs.get('template', None) - - -class TemplateSpecVersionsListResult(msrest.serialization.Model): - """List of Template Specs versions. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: An array of Template Spec versions. - :type value: - list[~azure.mgmt.resource.templatespecs.v2019_06_preview.models.TemplateSpecVersion] - :ivar next_link: The URL to use for getting the next set of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[TemplateSpecVersion]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TemplateSpecVersionsListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class TemplateSpecVersionUpdateModel(AzureResourceBase): - """Template Spec Version properties to be updated (only tags are currently supported). - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: String Id used to locate any resource on Azure. - :vartype id: str - :ivar name: Name of this resource. - :vartype name: str - :ivar type: Type of this resource. - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.SystemData - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(TemplateSpecVersionUpdateModel, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/models/_models_py3.py deleted file mode 100644 index a69e18f7d9d2..000000000000 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/models/_models_py3.py +++ /dev/null @@ -1,562 +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. -# -------------------------------------------------------------------------- - -import datetime -from typing import Dict, List, Optional, Union - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - -from ._template_specs_client_enums import * - - -class AzureResourceBase(msrest.serialization.Model): - """Common properties for all Azure resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: String Id used to locate any resource on Azure. - :vartype id: str - :ivar name: Name of this resource. - :vartype name: str - :ivar type: Type of this resource. - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureResourceBase, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class ErrorAdditionalInfo(msrest.serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: object - """ - - _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorAdditionalInfo, self).__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorResponse(msrest.serialization.Model): - """The resource management error response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: - list[~azure.mgmt.resource.templatespecs.v2019_06_preview.models.ErrorResponse] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.mgmt.resource.templatespecs.v2019_06_preview.models.ErrorAdditionalInfo] - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorResponse]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or - ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or - ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.CreatedByType - :param last_modified_at: The type of identity that last modified the resource. - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at - - -class TemplateSpec(AzureResourceBase): - """Template Spec object. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: String Id used to locate any resource on Azure. - :vartype id: str - :ivar name: Name of this resource. - :vartype name: str - :ivar type: Type of this resource. - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.SystemData - :param location: Required. The location of the Template Spec. It cannot be changed after - Template Spec creation. It must be one of the supported Azure locations. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param description: Template Spec description. - :type description: str - :param display_name: Template Spec display name. - :type display_name: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'description': {'max_length': 4096, 'min_length': 0}, - 'display_name': {'max_length': 64, 'min_length': 0}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - description: Optional[str] = None, - display_name: Optional[str] = None, - **kwargs - ): - super(TemplateSpec, self).__init__(**kwargs) - self.location = location - self.tags = tags - self.description = description - self.display_name = display_name - - -class TemplateSpecArtifact(msrest.serialization.Model): - """Represents a Template Spec artifact. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: TemplateSpecTemplateArtifact. - - All required parameters must be populated in order to send to Azure. - - :param path: Required. A filesystem safe relative path of the artifact. - :type path: str - :param kind: Required. The kind of artifact.Constant filled by server. - :type kind: str - """ - - _validation = { - 'path': {'required': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'path': {'key': 'path', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - } - - _subtype_map = { - 'kind': {'template': 'TemplateSpecTemplateArtifact'} - } - - def __init__( - self, - *, - path: str, - **kwargs - ): - super(TemplateSpecArtifact, self).__init__(**kwargs) - self.path = path - self.kind: Optional[str] = None - - -class TemplateSpecsError(msrest.serialization.Model): - """Template Specs error response. - - :param error: The resource management error response. - :type error: ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.ErrorResponse - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponse'}, - } - - def __init__( - self, - *, - error: Optional["ErrorResponse"] = None, - **kwargs - ): - super(TemplateSpecsError, self).__init__(**kwargs) - self.error = error - - -class TemplateSpecsListResult(msrest.serialization.Model): - """List of Template Specs. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: An array of Template Specs. - :type value: list[~azure.mgmt.resource.templatespecs.v2019_06_preview.models.TemplateSpec] - :ivar next_link: The URL to use for getting the next set of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[TemplateSpec]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["TemplateSpec"]] = None, - **kwargs - ): - super(TemplateSpecsListResult, self).__init__(**kwargs) - self.value = value - self.next_link = None - - -class TemplateSpecTemplateArtifact(TemplateSpecArtifact): - """Represents a Template Spec artifact containing an embedded Azure Resource Manager template. - - All required parameters must be populated in order to send to Azure. - - :param path: Required. A filesystem safe relative path of the artifact. - :type path: str - :param kind: Required. The kind of artifact.Constant filled by server. - :type kind: str - :param template: Required. The Azure Resource Manager template. - :type template: object - """ - - _validation = { - 'path': {'required': True}, - 'kind': {'required': True}, - 'template': {'required': True}, - } - - _attribute_map = { - 'path': {'key': 'path', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'template': {'key': 'template', 'type': 'object'}, - } - - def __init__( - self, - *, - path: str, - template: object, - **kwargs - ): - super(TemplateSpecTemplateArtifact, self).__init__(path=path, **kwargs) - self.kind: str = 'template' - self.template = template - - -class TemplateSpecUpdateModel(AzureResourceBase): - """Template Spec properties to be updated (only tags are currently supported). - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: String Id used to locate any resource on Azure. - :vartype id: str - :ivar name: Name of this resource. - :vartype name: str - :ivar type: Type of this resource. - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.SystemData - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - super(TemplateSpecUpdateModel, self).__init__(**kwargs) - self.tags = tags - - -class TemplateSpecVersion(AzureResourceBase): - """Template Spec Version object. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: String Id used to locate any resource on Azure. - :vartype id: str - :ivar name: Name of this resource. - :vartype name: str - :ivar type: Type of this resource. - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.SystemData - :param location: Required. The location of the Template Spec Version. It must match the - location of the parent Template Spec. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param artifacts: An array of Template Spec artifacts. - :type artifacts: - list[~azure.mgmt.resource.templatespecs.v2019_06_preview.models.TemplateSpecArtifact] - :param description: Template Spec version description. - :type description: str - :param template: The Azure Resource Manager template content. - :type template: object - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'location': {'required': True}, - 'description': {'max_length': 4096, 'min_length': 0}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'artifacts': {'key': 'properties.artifacts', 'type': '[TemplateSpecArtifact]'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'template': {'key': 'properties.template', 'type': 'object'}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - artifacts: Optional[List["TemplateSpecArtifact"]] = None, - description: Optional[str] = None, - template: Optional[object] = None, - **kwargs - ): - super(TemplateSpecVersion, self).__init__(**kwargs) - self.location = location - self.tags = tags - self.artifacts = artifacts - self.description = description - self.template = template - - -class TemplateSpecVersionsListResult(msrest.serialization.Model): - """List of Template Specs versions. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: An array of Template Spec versions. - :type value: - list[~azure.mgmt.resource.templatespecs.v2019_06_preview.models.TemplateSpecVersion] - :ivar next_link: The URL to use for getting the next set of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[TemplateSpecVersion]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["TemplateSpecVersion"]] = None, - **kwargs - ): - super(TemplateSpecVersionsListResult, self).__init__(**kwargs) - self.value = value - self.next_link = None - - -class TemplateSpecVersionUpdateModel(AzureResourceBase): - """Template Spec Version properties to be updated (only tags are currently supported). - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: String Id used to locate any resource on Azure. - :vartype id: str - :ivar name: Name of this resource. - :vartype name: str - :ivar type: Type of this resource. - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.SystemData - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - super(TemplateSpecVersionUpdateModel, self).__init__(**kwargs) - self.tags = tags diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/models/_template_specs_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/models/_template_specs_client_enums.py deleted file mode 100644 index b580550469d8..000000000000 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/models/_template_specs_client_enums.py +++ /dev/null @@ -1,18 +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 - -class CreatedByType(str, Enum): - """The type of identity that created the resource. - """ - - user = "User" - application = "Application" - managed_identity = "ManagedIdentity" - key = "Key" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/operations/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/operations/__init__.py deleted file mode 100644 index 6b00f8eb43d5..000000000000 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/operations/__init__.py +++ /dev/null @@ -1,15 +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 ._template_specs_operations import TemplateSpecsOperations -from ._template_spec_versions_operations import TemplateSpecVersionsOperations - -__all__ = [ - 'TemplateSpecsOperations', - 'TemplateSpecVersionsOperations', -] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/operations/_template_spec_versions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/operations/_template_spec_versions_operations.py deleted file mode 100644 index 0cd8bc0cd90a..000000000000 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/operations/_template_spec_versions_operations.py +++ /dev/null @@ -1,386 +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 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, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class TemplateSpecVersionsOperations(object): - """TemplateSpecVersionsOperations 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.templatespecs.v2019_06_preview.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 create_or_update( - self, - resource_group_name, # type: str - template_spec_name, # type: str - template_spec_version, # type: str - template_spec_version_model, # type: "models.TemplateSpecVersion" - **kwargs # type: Any - ): - # type: (...) -> "models.TemplateSpecVersion" - """Creates or updates a Template Spec version. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param template_spec_name: Name of the Template Spec. - :type template_spec_name: str - :param template_spec_version: The version of the Template Spec. - :type template_spec_version: str - :param template_spec_version_model: Template Spec Version supplied to the operation. - :type template_spec_version_model: ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.TemplateSpecVersion - :keyword callable cls: A custom type or function that will be passed the direct response - :return: TemplateSpecVersion, or the result of cls(response) - :rtype: ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.TemplateSpecVersion - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpecVersion"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'templateSpecName': self._serialize.url("template_spec_name", template_spec_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'templateSpecVersion': self._serialize.url("template_spec_version", template_spec_version, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - 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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(template_spec_version_model, 'TemplateSpecVersion') - body_content_kwargs['content'] = body_content - request = self._client.put(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, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.TemplateSpecsError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('TemplateSpecVersion', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('TemplateSpecVersion', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName}/versions/{templateSpecVersion}'} # type: ignore - - def update( - self, - resource_group_name, # type: str - template_spec_name, # type: str - template_spec_version, # type: str - template_spec_version_update_model=None, # type: Optional["models.TemplateSpecVersionUpdateModel"] - **kwargs # type: Any - ): - # type: (...) -> "models.TemplateSpecVersion" - """Updates Template Spec Version tags with specified values. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param template_spec_name: Name of the Template Spec. - :type template_spec_name: str - :param template_spec_version: The version of the Template Spec. - :type template_spec_version: str - :param template_spec_version_update_model: Template Spec Version resource with the tags to be - updated. - :type template_spec_version_update_model: ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.TemplateSpecVersionUpdateModel - :keyword callable cls: A custom type or function that will be passed the direct response - :return: TemplateSpecVersion, or the result of cls(response) - :rtype: ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.TemplateSpecVersion - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpecVersion"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'templateSpecName': self._serialize.url("template_spec_name", template_spec_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'templateSpecVersion': self._serialize.url("template_spec_version", template_spec_version, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - 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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - body_content_kwargs = {} # type: Dict[str, Any] - if template_spec_version_update_model is not None: - body_content = self._serialize.body(template_spec_version_update_model, 'TemplateSpecVersionUpdateModel') - else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(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.TemplateSpecsError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('TemplateSpecVersion', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName}/versions/{templateSpecVersion}'} # type: ignore - - def get( - self, - resource_group_name, # type: str - template_spec_name, # type: str - template_spec_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "models.TemplateSpecVersion" - """Gets a Template Spec version from a specific Template Spec. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param template_spec_name: Name of the Template Spec. - :type template_spec_name: str - :param template_spec_version: The version of the Template Spec. - :type template_spec_version: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: TemplateSpecVersion, or the result of cls(response) - :rtype: ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.TemplateSpecVersion - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpecVersion"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'templateSpecName': self._serialize.url("template_spec_name", template_spec_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'templateSpecVersion': self._serialize.url("template_spec_version", template_spec_version, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - 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'] = 'application/json' - - 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) - error = self._deserialize(models.TemplateSpecsError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('TemplateSpecVersion', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName}/versions/{templateSpecVersion}'} # type: ignore - - def delete( - self, - resource_group_name, # type: str - template_spec_name, # type: str - template_spec_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - """Deletes a specific version from a Template Spec. When operation completes, status code 200 - returned without content. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param template_spec_name: Name of the Template Spec. - :type template_spec_name: str - :param template_spec_version: The version of the Template Spec. - :type template_spec_version: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'templateSpecName': self._serialize.url("template_spec_name", template_spec_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'templateSpecVersion': self._serialize.url("template_spec_version", template_spec_version, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - 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] - - request = self._client.delete(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, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.TemplateSpecsError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName}/versions/{templateSpecVersion}'} # type: ignore - - def list( - self, - resource_group_name, # type: str - template_spec_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.TemplateSpecVersionsListResult"] - """Lists all the Template Spec versions in the specified Template Spec. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param template_spec_name: Name of the Template Spec. - :type template_spec_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TemplateSpecVersionsListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.templatespecs.v2019_06_preview.models.TemplateSpecVersionsListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpecVersionsListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'templateSpecName': self._serialize.url("template_spec_name", template_spec_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - 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('TemplateSpecVersionsListResult', 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]: - error = self._deserialize(models.TemplateSpecsError, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName}/versions'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/operations/_template_specs_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/operations/_template_specs_operations.py deleted file mode 100644 index b6b97f2e0365..000000000000 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/operations/_template_specs_operations.py +++ /dev/null @@ -1,430 +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 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, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class TemplateSpecsOperations(object): - """TemplateSpecsOperations 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.templatespecs.v2019_06_preview.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 create_or_update( - self, - resource_group_name, # type: str - template_spec_name, # type: str - template_spec, # type: "models.TemplateSpec" - **kwargs # type: Any - ): - # type: (...) -> "models.TemplateSpec" - """Creates or updates a Template Spec. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param template_spec_name: Name of the Template Spec. - :type template_spec_name: str - :param template_spec: Template Spec supplied to the operation. - :type template_spec: ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.TemplateSpec - :keyword callable cls: A custom type or function that will be passed the direct response - :return: TemplateSpec, or the result of cls(response) - :rtype: ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.TemplateSpec - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpec"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'templateSpecName': self._serialize.url("template_spec_name", template_spec_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - 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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(template_spec, 'TemplateSpec') - body_content_kwargs['content'] = body_content - request = self._client.put(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, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.TemplateSpecsError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('TemplateSpec', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('TemplateSpec', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName}'} # type: ignore - - def update( - self, - resource_group_name, # type: str - template_spec_name, # type: str - template_spec=None, # type: Optional["models.TemplateSpecUpdateModel"] - **kwargs # type: Any - ): - # type: (...) -> "models.TemplateSpec" - """Updates Template Spec tags with specified values. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param template_spec_name: Name of the Template Spec. - :type template_spec_name: str - :param template_spec: Template Spec resource with the tags to be updated. - :type template_spec: ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.TemplateSpecUpdateModel - :keyword callable cls: A custom type or function that will be passed the direct response - :return: TemplateSpec, or the result of cls(response) - :rtype: ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.TemplateSpec - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpec"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'templateSpecName': self._serialize.url("template_spec_name", template_spec_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - 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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - body_content_kwargs = {} # type: Dict[str, Any] - if template_spec is not None: - body_content = self._serialize.body(template_spec, 'TemplateSpecUpdateModel') - else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(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.TemplateSpecsError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('TemplateSpec', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName}'} # type: ignore - - def get( - self, - resource_group_name, # type: str - template_spec_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "models.TemplateSpec" - """Gets a Template Spec with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param template_spec_name: Name of the Template Spec. - :type template_spec_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: TemplateSpec, or the result of cls(response) - :rtype: ~azure.mgmt.resource.templatespecs.v2019_06_preview.models.TemplateSpec - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpec"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'templateSpecName': self._serialize.url("template_spec_name", template_spec_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - 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'] = 'application/json' - - 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) - error = self._deserialize(models.TemplateSpecsError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('TemplateSpec', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName}'} # type: ignore - - def delete( - self, - resource_group_name, # type: str - template_spec_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - """Deletes a Template Spec by name. When operation completes, status code 200 returned without - content. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param template_spec_name: Name of the Template Spec. - :type template_spec_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'templateSpecName': self._serialize.url("template_spec_name", template_spec_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - 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] - - request = self._client.delete(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, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.TemplateSpecsError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName}'} # type: ignore - - def list_by_subscription( - self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.TemplateSpecsListResult"] - """Lists all the Template Specs within the specified subscriptions. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TemplateSpecsListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.templatespecs.v2019_06_preview.models.TemplateSpecsListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpecsListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.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('TemplateSpecsListResult', 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]: - error = self._deserialize(models.TemplateSpecsError, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/templateSpecs/'} # type: ignore - - def list_by_resource_group( - self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.TemplateSpecsListResult"] - """Lists all the Template Specs within the specified resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TemplateSpecsListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.resource.templatespecs.v2019_06_preview.models.TemplateSpecsListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.TemplateSpecsListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-06-01-preview" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - 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('TemplateSpecsListResult', 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]: - error = self._deserialize(models.TemplateSpecsError, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/'} # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/py.typed b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file