diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/_resource_management_client.py index baff478d1a90..96394ddeff1b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/_resource_management_client.py @@ -46,7 +46,7 @@ class ResourceManagementClient(MultiApiClientMixin, SDKClient): :type profile: azure.profiles.KnownProfiles """ - DEFAULT_API_VERSION = '2019-05-10' + DEFAULT_API_VERSION = '2019-07-01' _PROFILE_TAG = "azure.mgmt.resource.resources.ResourceManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { @@ -79,6 +79,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2018-05-01: :mod:`v2018_05_01.models` * 2019-05-01: :mod:`v2019_05_01.models` * 2019-05-10: :mod:`v2019_05_10.models` + * 2019-07-01: :mod:`v2019_07_01.models` """ if api_version == '2016-02-01': from .v2016_02_01 import models @@ -101,6 +102,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2019-05-10': from .v2019_05_10 import models return models + elif api_version == '2019-07-01': + from .v2019_07_01 import models + return models raise NotImplementedError("APIVersion {} is not available".format(api_version)) @property @@ -114,6 +118,7 @@ def deployment_operations(self): * 2018-05-01: :class:`DeploymentOperations` * 2019-05-01: :class:`DeploymentOperations` * 2019-05-10: :class:`DeploymentOperations` + * 2019-07-01: :class:`DeploymentOperations` """ api_version = self._get_api_version('deployment_operations') if api_version == '2016-02-01': @@ -130,6 +135,8 @@ def deployment_operations(self): from .v2019_05_01.operations import DeploymentOperations as OperationClass elif api_version == '2019-05-10': from .v2019_05_10.operations import DeploymentOperations as OperationClass + elif api_version == '2019-07-01': + from .v2019_07_01.operations import DeploymentOperations 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))) @@ -145,6 +152,7 @@ def deployments(self): * 2018-05-01: :class:`DeploymentsOperations` * 2019-05-01: :class:`DeploymentsOperations` * 2019-05-10: :class:`DeploymentsOperations` + * 2019-07-01: :class:`DeploymentsOperations` """ api_version = self._get_api_version('deployments') if api_version == '2016-02-01': @@ -161,6 +169,8 @@ def deployments(self): from .v2019_05_01.operations import DeploymentsOperations as OperationClass elif api_version == '2019-05-10': from .v2019_05_10.operations import DeploymentsOperations as OperationClass + elif api_version == '2019-07-01': + from .v2019_07_01.operations import DeploymentsOperations 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))) @@ -172,6 +182,7 @@ def operations(self): * 2018-05-01: :class:`Operations` * 2019-05-01: :class:`Operations` * 2019-05-10: :class:`Operations` + * 2019-07-01: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2018-05-01': @@ -180,6 +191,8 @@ def operations(self): from .v2019_05_01.operations import Operations as OperationClass elif api_version == '2019-05-10': from .v2019_05_10.operations import Operations as OperationClass + elif api_version == '2019-07-01': + from .v2019_07_01.operations import Operations 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))) @@ -195,6 +208,7 @@ def providers(self): * 2018-05-01: :class:`ProvidersOperations` * 2019-05-01: :class:`ProvidersOperations` * 2019-05-10: :class:`ProvidersOperations` + * 2019-07-01: :class:`ProvidersOperations` """ api_version = self._get_api_version('providers') if api_version == '2016-02-01': @@ -211,6 +225,8 @@ def providers(self): from .v2019_05_01.operations import ProvidersOperations as OperationClass elif api_version == '2019-05-10': from .v2019_05_10.operations import ProvidersOperations as OperationClass + elif api_version == '2019-07-01': + from .v2019_07_01.operations import ProvidersOperations 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))) @@ -226,6 +242,7 @@ def resource_groups(self): * 2018-05-01: :class:`ResourceGroupsOperations` * 2019-05-01: :class:`ResourceGroupsOperations` * 2019-05-10: :class:`ResourceGroupsOperations` + * 2019-07-01: :class:`ResourceGroupsOperations` """ api_version = self._get_api_version('resource_groups') if api_version == '2016-02-01': @@ -242,6 +259,8 @@ def resource_groups(self): from .v2019_05_01.operations import ResourceGroupsOperations as OperationClass elif api_version == '2019-05-10': from .v2019_05_10.operations import ResourceGroupsOperations as OperationClass + elif api_version == '2019-07-01': + from .v2019_07_01.operations import ResourceGroupsOperations 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))) @@ -257,6 +276,7 @@ def resources(self): * 2018-05-01: :class:`ResourcesOperations` * 2019-05-01: :class:`ResourcesOperations` * 2019-05-10: :class:`ResourcesOperations` + * 2019-07-01: :class:`ResourcesOperations` """ api_version = self._get_api_version('resources') if api_version == '2016-02-01': @@ -273,6 +293,8 @@ def resources(self): from .v2019_05_01.operations import ResourcesOperations as OperationClass elif api_version == '2019-05-10': from .v2019_05_10.operations import ResourcesOperations as OperationClass + elif api_version == '2019-07-01': + from .v2019_07_01.operations import ResourcesOperations 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))) @@ -288,6 +310,7 @@ def tags(self): * 2018-05-01: :class:`TagsOperations` * 2019-05-01: :class:`TagsOperations` * 2019-05-10: :class:`TagsOperations` + * 2019-07-01: :class:`TagsOperations` """ api_version = self._get_api_version('tags') if api_version == '2016-02-01': @@ -304,6 +327,8 @@ def tags(self): from .v2019_05_01.operations import TagsOperations as OperationClass elif api_version == '2019-05-10': from .v2019_05_10.operations import TagsOperations as OperationClass + elif api_version == '2019-07-01': + from .v2019_07_01.operations import TagsOperations 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))) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/models.py index 77113947f5b4..973a5db063c1 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/models.py @@ -4,4 +4,4 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -from .v2019_05_10.models import * +from .v2019_07_01.models import * diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_providers_operations.py index f16a9f43f378..a6dc8fde1b2c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_providers_operations.py @@ -235,6 +235,80 @@ def internal_paging(next_link=None): return deserialized list.metadata = {'url': '/subscriptions/{subscriptionId}/providers'} + def list_at_tenant_scope( + self, top=None, expand=None, custom_headers=None, raw=False, **operation_config): + """Gets all resource providers for the tenant. + + :param top: The number of results to return. If null is passed returns + all providers. + :type top: int + :param expand: The properties to include in the results. For example, + use &$expand=metadata in the query string to retrieve resource + provider metadata. To include property aliases in response, use + $expand=resourceTypes/aliases. + :type expand: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Provider + :rtype: + ~azure.mgmt.resource.resources.v2019_05_10.models.ProviderPaged[~azure.mgmt.resource.resources.v2019_05_10.models.Provider] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_at_tenant_scope.metadata['url'] + + # Construct parameters + query_parameters = {} + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ProviderPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_at_tenant_scope.metadata = {'url': '/providers'} + def get( self, resource_provider_namespace, expand=None, custom_headers=None, raw=False, **operation_config): """Gets the specified resource provider. @@ -298,3 +372,66 @@ def get( return deserialized get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}'} + + def get_at_tenant_scope( + self, resource_provider_namespace, expand=None, custom_headers=None, raw=False, **operation_config): + """Gets the specified resource provider at the tenant level. + + :param resource_provider_namespace: The namespace of the resource + provider. + :type resource_provider_namespace: str + :param expand: The $expand query parameter. For example, to include + property aliases in response, use $expand=resourceTypes/aliases. + :type expand: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Provider or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.resource.resources.v2019_05_10.models.Provider or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_at_tenant_scope.metadata['url'] + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Provider', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_at_tenant_scope.metadata = {'url': '/providers/{resourceProviderNamespace}'} diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/__init__.py new file mode 100644 index 000000000000..68bc897193ac --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._configuration import ResourceManagementClientConfiguration +from ._resource_management_client import ResourceManagementClient +__all__ = ['ResourceManagementClient', 'ResourceManagementClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_configuration.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_configuration.py new file mode 100644 index 000000000000..3b326f792363 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_configuration.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +from msrestazure import AzureConfiguration + +from .version import VERSION + + +class ResourceManagementClientConfiguration(AzureConfiguration): + """Configuration for ResourceManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(ResourceManagementClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-resource/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_resource_management_client.py new file mode 100644 index 000000000000..f0cd1c10bfe0 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_resource_management_client.py @@ -0,0 +1,79 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import ResourceManagementClientConfiguration +from .operations import Operations +from .operations import DeploymentsOperations +from .operations import ProvidersOperations +from .operations import ResourcesOperations +from .operations import ResourceGroupsOperations +from .operations import TagsOperations +from .operations import DeploymentOperations +from . import models + + +class ResourceManagementClient(SDKClient): + """Provides operations for working with resources and resource groups. + + :ivar config: Configuration for client. + :vartype config: ResourceManagementClientConfiguration + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.resource.resources.v2019_07_01.operations.Operations + :ivar deployments: Deployments operations + :vartype deployments: azure.mgmt.resource.resources.v2019_07_01.operations.DeploymentsOperations + :ivar providers: Providers operations + :vartype providers: azure.mgmt.resource.resources.v2019_07_01.operations.ProvidersOperations + :ivar resources: Resources operations + :vartype resources: azure.mgmt.resource.resources.v2019_07_01.operations.ResourcesOperations + :ivar resource_groups: ResourceGroups operations + :vartype resource_groups: azure.mgmt.resource.resources.v2019_07_01.operations.ResourceGroupsOperations + :ivar tags: Tags operations + :vartype tags: azure.mgmt.resource.resources.v2019_07_01.operations.TagsOperations + :ivar deployment_operations: DeploymentOperations operations + :vartype deployment_operations: azure.mgmt.resource.resources.v2019_07_01.operations.DeploymentOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = ResourceManagementClientConfiguration(credentials, subscription_id, base_url) + super(ResourceManagementClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2019-07-01' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.providers = ProvidersOperations( + self._client, self.config, self._serialize, self._deserialize) + self.resources = ResourcesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.resource_groups = ResourceGroupsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.tags = TagsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.deployment_operations = DeploymentOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/__init__.py new file mode 100644 index 000000000000..b6c6e7b02ad0 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/__init__.py @@ -0,0 +1,173 @@ +# 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 AliasPathType + from ._models_py3 import AliasType + from ._models_py3 import BasicDependency + from ._models_py3 import DebugSetting + from ._models_py3 import Dependency + from ._models_py3 import Deployment + from ._models_py3 import DeploymentExportResult + from ._models_py3 import DeploymentExtended + from ._models_py3 import DeploymentExtendedFilter + from ._models_py3 import DeploymentOperation + from ._models_py3 import DeploymentOperationProperties + from ._models_py3 import DeploymentProperties + from ._models_py3 import DeploymentPropertiesExtended + from ._models_py3 import DeploymentValidateResult + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorResponse + from ._models_py3 import ExportTemplateRequest + from ._models_py3 import GenericResource + from ._models_py3 import GenericResourceFilter + from ._models_py3 import HttpMessage + from ._models_py3 import Identity + from ._models_py3 import IdentityUserAssignedIdentitiesValue + from ._models_py3 import OnErrorDeployment + from ._models_py3 import OnErrorDeploymentExtended + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import ParametersLink + from ._models_py3 import Plan + from ._models_py3 import Provider + from ._models_py3 import ProviderResourceType + from ._models_py3 import Resource + from ._models_py3 import ResourceGroup + from ._models_py3 import ResourceGroupExportResult + from ._models_py3 import ResourceGroupFilter + from ._models_py3 import ResourceGroupPatchable + from ._models_py3 import ResourceGroupProperties + from ._models_py3 import ResourceProviderOperationDisplayProperties + from ._models_py3 import ResourcesMoveInfo + from ._models_py3 import Sku + from ._models_py3 import SubResource + from ._models_py3 import TagCount + from ._models_py3 import TagDetails + from ._models_py3 import TagValue + from ._models_py3 import TargetResource + from ._models_py3 import TemplateLink +except (SyntaxError, ImportError): + from ._models import AliasPathType + from ._models import AliasType + from ._models import BasicDependency + from ._models import DebugSetting + from ._models import Dependency + from ._models import Deployment + from ._models import DeploymentExportResult + from ._models import DeploymentExtended + from ._models import DeploymentExtendedFilter + from ._models import DeploymentOperation + from ._models import DeploymentOperationProperties + from ._models import DeploymentProperties + from ._models import DeploymentPropertiesExtended + from ._models import DeploymentValidateResult + from ._models import ErrorAdditionalInfo + from ._models import ErrorResponse + from ._models import ExportTemplateRequest + from ._models import GenericResource + from ._models import GenericResourceFilter + from ._models import HttpMessage + from ._models import Identity + from ._models import IdentityUserAssignedIdentitiesValue + from ._models import OnErrorDeployment + from ._models import OnErrorDeploymentExtended + from ._models import Operation + from ._models import OperationDisplay + from ._models import ParametersLink + from ._models import Plan + from ._models import Provider + from ._models import ProviderResourceType + from ._models import Resource + from ._models import ResourceGroup + from ._models import ResourceGroupExportResult + from ._models import ResourceGroupFilter + from ._models import ResourceGroupPatchable + from ._models import ResourceGroupProperties + from ._models import ResourceProviderOperationDisplayProperties + from ._models import ResourcesMoveInfo + from ._models import Sku + from ._models import SubResource + from ._models import TagCount + from ._models import TagDetails + from ._models import TagValue + from ._models import TargetResource + from ._models import TemplateLink +from ._paged_models import DeploymentExtendedPaged +from ._paged_models import DeploymentOperationPaged +from ._paged_models import GenericResourcePaged +from ._paged_models import OperationPaged +from ._paged_models import ProviderPaged +from ._paged_models import ResourceGroupPaged +from ._paged_models import TagDetailsPaged +from ._resource_management_client_enums import ( + DeploymentMode, + OnErrorDeploymentType, + ResourceIdentityType, +) + +__all__ = [ + 'AliasPathType', + 'AliasType', + 'BasicDependency', + 'DebugSetting', + 'Dependency', + 'Deployment', + 'DeploymentExportResult', + 'DeploymentExtended', + 'DeploymentExtendedFilter', + 'DeploymentOperation', + 'DeploymentOperationProperties', + 'DeploymentProperties', + 'DeploymentPropertiesExtended', + 'DeploymentValidateResult', + 'ErrorAdditionalInfo', + 'ErrorResponse', + 'ExportTemplateRequest', + 'GenericResource', + 'GenericResourceFilter', + 'HttpMessage', + 'Identity', + 'IdentityUserAssignedIdentitiesValue', + 'OnErrorDeployment', + 'OnErrorDeploymentExtended', + 'Operation', + 'OperationDisplay', + 'ParametersLink', + 'Plan', + 'Provider', + 'ProviderResourceType', + 'Resource', + 'ResourceGroup', + 'ResourceGroupExportResult', + 'ResourceGroupFilter', + 'ResourceGroupPatchable', + 'ResourceGroupProperties', + 'ResourceProviderOperationDisplayProperties', + 'ResourcesMoveInfo', + 'Sku', + 'SubResource', + 'TagCount', + 'TagDetails', + 'TagValue', + 'TargetResource', + 'TemplateLink', + 'OperationPaged', + 'DeploymentExtendedPaged', + 'ProviderPaged', + 'GenericResourcePaged', + 'ResourceGroupPaged', + 'TagDetailsPaged', + 'DeploymentOperationPaged', + 'DeploymentMode', + 'OnErrorDeploymentType', + 'ResourceIdentityType', +] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_models.py new file mode 100644 index 000000000000..56521549ac6b --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_models.py @@ -0,0 +1,1488 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class AliasPathType(Model): + """The type of the paths for alias. . + + :param path: The path of an alias. + :type path: str + :param api_versions: The API versions. + :type api_versions: list[str] + """ + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'api_versions': {'key': 'apiVersions', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(AliasPathType, self).__init__(**kwargs) + self.path = kwargs.get('path', None) + self.api_versions = kwargs.get('api_versions', None) + + +class AliasType(Model): + """The alias type. . + + :param name: The alias name. + :type name: str + :param paths: The paths for an alias. + :type paths: + list[~azure.mgmt.resource.resources.v2019_07_01.models.AliasPathType] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'paths': {'key': 'paths', 'type': '[AliasPathType]'}, + } + + def __init__(self, **kwargs): + super(AliasType, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.paths = kwargs.get('paths', None) + + +class BasicDependency(Model): + """Deployment dependency information. + + :param id: The ID of the dependency. + :type id: str + :param resource_type: The dependency resource type. + :type resource_type: str + :param resource_name: The dependency resource name. + :type resource_name: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'resource_name': {'key': 'resourceName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(BasicDependency, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.resource_type = kwargs.get('resource_type', None) + self.resource_name = kwargs.get('resource_name', None) + + +class CloudError(Model): + """An error response for a resource management request. + + :param error: + :type error: + ~azure.mgmt.resource.resources.v2019_07_01.models.ErrorResponse + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__(self, **kwargs): + super(CloudError, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class CloudErrorException(HttpOperationError): + """Server responsed with exception of type: 'CloudError'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(CloudErrorException, self).__init__(deserialize, response, 'CloudError', *args) + + +class DebugSetting(Model): + """The debug setting. + + :param detail_level: Specifies the type of information to log for + debugging. The permitted values are none, requestContent, responseContent, + or both requestContent and responseContent separated by a comma. The + default is none. When setting this value, carefully consider the type of + information you are passing in during deployment. By logging information + about the request or response, you could potentially expose sensitive data + that is retrieved through the deployment operations. + :type detail_level: str + """ + + _attribute_map = { + 'detail_level': {'key': 'detailLevel', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DebugSetting, self).__init__(**kwargs) + self.detail_level = kwargs.get('detail_level', None) + + +class Dependency(Model): + """Deployment dependency information. + + :param depends_on: The list of dependencies. + :type depends_on: + list[~azure.mgmt.resource.resources.v2019_07_01.models.BasicDependency] + :param id: The ID of the dependency. + :type id: str + :param resource_type: The dependency resource type. + :type resource_type: str + :param resource_name: The dependency resource name. + :type resource_name: str + """ + + _attribute_map = { + 'depends_on': {'key': 'dependsOn', 'type': '[BasicDependency]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'resource_name': {'key': 'resourceName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Dependency, self).__init__(**kwargs) + self.depends_on = kwargs.get('depends_on', None) + self.id = kwargs.get('id', None) + self.resource_type = kwargs.get('resource_type', None) + self.resource_name = kwargs.get('resource_name', None) + + +class Deployment(Model): + """Deployment operation parameters. + + All required parameters must be populated in order to send to Azure. + + :param location: The location to store the deployment data. + :type location: str + :param properties: Required. The deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentProperties + """ + + _validation = { + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentProperties'}, + } + + def __init__(self, **kwargs): + super(Deployment, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.properties = kwargs.get('properties', None) + + +class DeploymentExportResult(Model): + """The deployment export result. . + + :param template: The template content. + :type template: object + """ + + _attribute_map = { + 'template': {'key': 'template', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(DeploymentExportResult, self).__init__(**kwargs) + self.template = kwargs.get('template', None) + + +class DeploymentExtended(Model): + """Deployment information. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The ID of the deployment. + :vartype id: str + :ivar name: The name of the deployment. + :vartype name: str + :ivar type: The type of the deployment. + :vartype type: str + :param location: the location of the deployment. + :type location: str + :param properties: Deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentPropertiesExtended + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentPropertiesExtended'}, + } + + def __init__(self, **kwargs): + super(DeploymentExtended, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.properties = kwargs.get('properties', None) + + +class DeploymentExtendedFilter(Model): + """Deployment filter. + + :param provisioning_state: The provisioning state. + :type provisioning_state: str + """ + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DeploymentExtendedFilter, self).__init__(**kwargs) + self.provisioning_state = kwargs.get('provisioning_state', None) + + +class DeploymentOperation(Model): + """Deployment operation information. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Full deployment operation ID. + :vartype id: str + :ivar operation_id: Deployment operation ID. + :vartype operation_id: str + :param properties: Deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperationProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'operation_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'operation_id': {'key': 'operationId', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentOperationProperties'}, + } + + def __init__(self, **kwargs): + super(DeploymentOperation, self).__init__(**kwargs) + self.id = None + self.operation_id = None + self.properties = kwargs.get('properties', None) + + +class DeploymentOperationProperties(Model): + """Deployment operation properties. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar provisioning_state: The state of the provisioning. + :vartype provisioning_state: str + :ivar timestamp: The date and time of the operation. + :vartype timestamp: datetime + :ivar duration: The duration of the operation. + :vartype duration: str + :ivar service_request_id: Deployment operation service request id. + :vartype service_request_id: str + :ivar status_code: Operation status code. + :vartype status_code: str + :ivar status_message: Operation status message. + :vartype status_message: object + :ivar target_resource: The target resource. + :vartype target_resource: + ~azure.mgmt.resource.resources.v2019_07_01.models.TargetResource + :ivar request: The HTTP request message. + :vartype request: + ~azure.mgmt.resource.resources.v2019_07_01.models.HttpMessage + :ivar response: The HTTP response message. + :vartype response: + ~azure.mgmt.resource.resources.v2019_07_01.models.HttpMessage + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'timestamp': {'readonly': True}, + 'duration': {'readonly': True}, + 'service_request_id': {'readonly': True}, + 'status_code': {'readonly': True}, + 'status_message': {'readonly': True}, + 'target_resource': {'readonly': True}, + 'request': {'readonly': True}, + 'response': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'duration': {'key': 'duration', 'type': 'str'}, + 'service_request_id': {'key': 'serviceRequestId', 'type': 'str'}, + 'status_code': {'key': 'statusCode', 'type': 'str'}, + 'status_message': {'key': 'statusMessage', 'type': 'object'}, + 'target_resource': {'key': 'targetResource', 'type': 'TargetResource'}, + 'request': {'key': 'request', 'type': 'HttpMessage'}, + 'response': {'key': 'response', 'type': 'HttpMessage'}, + } + + def __init__(self, **kwargs): + super(DeploymentOperationProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.timestamp = None + self.duration = None + self.service_request_id = None + self.status_code = None + self.status_message = None + self.target_resource = None + self.request = None + self.response = None + + +class DeploymentProperties(Model): + """Deployment properties. + + All required parameters must be populated in order to send to Azure. + + :param template: The template content. You use this element when you want + to pass the template syntax directly in the request rather than link to an + existing template. It can be a JObject or well-formed JSON string. Use + either the templateLink property or the template property, but not both. + :type template: object + :param template_link: The URI of the template. Use either the templateLink + property or the template property, but not both. + :type template_link: + ~azure.mgmt.resource.resources.v2019_07_01.models.TemplateLink + :param parameters: Name and value pairs that define the deployment + parameters for the template. You use this element when you want to provide + the parameter values directly in the request rather than link to an + existing parameter file. Use either the parametersLink property or the + parameters property, but not both. It can be a JObject or a well formed + JSON string. + :type parameters: object + :param parameters_link: The URI of parameters file. You use this element + to link to an existing parameters file. Use either the parametersLink + property or the parameters property, but not both. + :type parameters_link: + ~azure.mgmt.resource.resources.v2019_07_01.models.ParametersLink + :param mode: Required. The mode that is used to deploy resources. This + value can be either Incremental or Complete. In Incremental mode, + resources are deployed without deleting existing resources that are not + included in the template. In Complete mode, resources are deployed and + existing resources in the resource group that are not included in the + template are deleted. Be careful when using Complete mode as you may + unintentionally delete resources. Possible values include: 'Incremental', + 'Complete' + :type mode: str or + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentMode + :param debug_setting: The debug setting of the deployment. + :type debug_setting: + ~azure.mgmt.resource.resources.v2019_07_01.models.DebugSetting + :param on_error_deployment: The deployment on error behavior. + :type on_error_deployment: + ~azure.mgmt.resource.resources.v2019_07_01.models.OnErrorDeployment + """ + + _validation = { + 'mode': {'required': True}, + } + + _attribute_map = { + 'template': {'key': 'template', 'type': 'object'}, + 'template_link': {'key': 'templateLink', 'type': 'TemplateLink'}, + 'parameters': {'key': 'parameters', 'type': 'object'}, + 'parameters_link': {'key': 'parametersLink', 'type': 'ParametersLink'}, + 'mode': {'key': 'mode', 'type': 'DeploymentMode'}, + 'debug_setting': {'key': 'debugSetting', 'type': 'DebugSetting'}, + 'on_error_deployment': {'key': 'onErrorDeployment', 'type': 'OnErrorDeployment'}, + } + + def __init__(self, **kwargs): + super(DeploymentProperties, self).__init__(**kwargs) + self.template = kwargs.get('template', None) + self.template_link = kwargs.get('template_link', None) + self.parameters = kwargs.get('parameters', None) + self.parameters_link = kwargs.get('parameters_link', None) + self.mode = kwargs.get('mode', None) + self.debug_setting = kwargs.get('debug_setting', None) + self.on_error_deployment = kwargs.get('on_error_deployment', None) + + +class DeploymentPropertiesExtended(Model): + """Deployment properties with additional details. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar provisioning_state: The state of the provisioning. + :vartype provisioning_state: str + :ivar correlation_id: The correlation ID of the deployment. + :vartype correlation_id: str + :ivar timestamp: The timestamp of the template deployment. + :vartype timestamp: datetime + :ivar duration: The duration of the template deployment. + :vartype duration: str + :param outputs: Key/value pairs that represent deployment output. + :type outputs: object + :param providers: The list of resource providers needed for the + deployment. + :type providers: + list[~azure.mgmt.resource.resources.v2019_07_01.models.Provider] + :param dependencies: The list of deployment dependencies. + :type dependencies: + list[~azure.mgmt.resource.resources.v2019_07_01.models.Dependency] + :param template: The template content. Use only one of Template or + TemplateLink. + :type template: object + :param template_link: The URI referencing the template. Use only one of + Template or TemplateLink. + :type template_link: + ~azure.mgmt.resource.resources.v2019_07_01.models.TemplateLink + :param parameters: Deployment parameters. Use only one of Parameters or + ParametersLink. + :type parameters: object + :param parameters_link: The URI referencing the parameters. Use only one + of Parameters or ParametersLink. + :type parameters_link: + ~azure.mgmt.resource.resources.v2019_07_01.models.ParametersLink + :param mode: The deployment mode. Possible values are Incremental and + Complete. Possible values include: 'Incremental', 'Complete' + :type mode: str or + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentMode + :param debug_setting: The debug setting of the deployment. + :type debug_setting: + ~azure.mgmt.resource.resources.v2019_07_01.models.DebugSetting + :param on_error_deployment: The deployment on error behavior. + :type on_error_deployment: + ~azure.mgmt.resource.resources.v2019_07_01.models.OnErrorDeploymentExtended + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'correlation_id': {'readonly': True}, + 'timestamp': {'readonly': True}, + 'duration': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'correlation_id': {'key': 'correlationId', 'type': 'str'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'duration': {'key': 'duration', 'type': 'str'}, + 'outputs': {'key': 'outputs', 'type': 'object'}, + 'providers': {'key': 'providers', 'type': '[Provider]'}, + 'dependencies': {'key': 'dependencies', 'type': '[Dependency]'}, + 'template': {'key': 'template', 'type': 'object'}, + 'template_link': {'key': 'templateLink', 'type': 'TemplateLink'}, + 'parameters': {'key': 'parameters', 'type': 'object'}, + 'parameters_link': {'key': 'parametersLink', 'type': 'ParametersLink'}, + 'mode': {'key': 'mode', 'type': 'DeploymentMode'}, + 'debug_setting': {'key': 'debugSetting', 'type': 'DebugSetting'}, + 'on_error_deployment': {'key': 'onErrorDeployment', 'type': 'OnErrorDeploymentExtended'}, + } + + def __init__(self, **kwargs): + super(DeploymentPropertiesExtended, self).__init__(**kwargs) + self.provisioning_state = None + self.correlation_id = None + self.timestamp = None + self.duration = None + self.outputs = kwargs.get('outputs', None) + self.providers = kwargs.get('providers', None) + self.dependencies = kwargs.get('dependencies', None) + self.template = kwargs.get('template', None) + self.template_link = kwargs.get('template_link', None) + self.parameters = kwargs.get('parameters', None) + self.parameters_link = kwargs.get('parameters_link', None) + self.mode = kwargs.get('mode', None) + self.debug_setting = kwargs.get('debug_setting', None) + self.on_error_deployment = kwargs.get('on_error_deployment', None) + + +class DeploymentValidateResult(Model): + """Information from validate template deployment response. + + :param properties: The template deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentPropertiesExtended + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'DeploymentPropertiesExtended'}, + } + + def __init__(self, **kwargs): + super(DeploymentValidateResult, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class ErrorAdditionalInfo(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(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.resources.v2019_07_01.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.resource.resources.v2019_07_01.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 ExportTemplateRequest(Model): + """Export resource group template request parameters. + + :param resources: The IDs of the resources to filter the export by. To + export all resources, supply an array with single entry '*'. + :type resources: list[str] + :param options: The export template options. A CSV-formatted list + containing zero or more of the following: 'IncludeParameterDefaultValue', + 'IncludeComments', 'SkipResourceNameParameterization', + 'SkipAllParameterization' + :type options: str + """ + + _attribute_map = { + 'resources': {'key': 'resources', 'type': '[str]'}, + 'options': {'key': 'options', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ExportTemplateRequest, self).__init__(**kwargs) + self.resources = kwargs.get('resources', None) + self.options = kwargs.get('options', None) + + +class Resource(Model): + """Specified resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + + +class GenericResource(Resource): + """Resource information. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param plan: The plan of the resource. + :type plan: ~azure.mgmt.resource.resources.v2019_07_01.models.Plan + :param properties: The resource properties. + :type properties: object + :param kind: The kind of the resource. + :type kind: str + :param managed_by: ID of the resource that manages this resource. + :type managed_by: str + :param sku: The SKU of the resource. + :type sku: ~azure.mgmt.resource.resources.v2019_07_01.models.Sku + :param identity: The identity of the resource. + :type identity: ~azure.mgmt.resource.resources.v2019_07_01.models.Identity + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'pattern': r'^[-\w\._,\(\)]+$'}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'plan': {'key': 'plan', 'type': 'Plan'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + } + + def __init__(self, **kwargs): + super(GenericResource, self).__init__(**kwargs) + self.plan = kwargs.get('plan', None) + self.properties = kwargs.get('properties', None) + self.kind = kwargs.get('kind', None) + self.managed_by = kwargs.get('managed_by', None) + self.sku = kwargs.get('sku', None) + self.identity = kwargs.get('identity', None) + + +class GenericResourceFilter(Model): + """Resource filter. + + :param resource_type: The resource type. + :type resource_type: str + :param tagname: The tag name. + :type tagname: str + :param tagvalue: The tag value. + :type tagvalue: str + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'tagname': {'key': 'tagname', 'type': 'str'}, + 'tagvalue': {'key': 'tagvalue', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(GenericResourceFilter, self).__init__(**kwargs) + self.resource_type = kwargs.get('resource_type', None) + self.tagname = kwargs.get('tagname', None) + self.tagvalue = kwargs.get('tagvalue', None) + + +class HttpMessage(Model): + """HTTP message. + + :param content: HTTP message content. + :type content: object + """ + + _attribute_map = { + 'content': {'key': 'content', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(HttpMessage, self).__init__(**kwargs) + self.content = kwargs.get('content', None) + + +class Identity(Model): + """Identity for the resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :param type: The identity type. Possible values include: 'SystemAssigned', + 'UserAssigned', 'SystemAssigned, UserAssigned', 'None' + :type type: str or + ~azure.mgmt.resource.resources.v2019_07_01.models.ResourceIdentityType + :param user_assigned_identities: The list of user identities associated + with the resource. The user identity dictionary key references will be ARM + resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :type user_assigned_identities: dict[str, + ~azure.mgmt.resource.resources.v2019_07_01.models.IdentityUserAssignedIdentitiesValue] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'ResourceIdentityType'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{IdentityUserAssignedIdentitiesValue}'}, + } + + def __init__(self, **kwargs): + super(Identity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = kwargs.get('type', None) + self.user_assigned_identities = kwargs.get('user_assigned_identities', None) + + +class IdentityUserAssignedIdentitiesValue(Model): + """IdentityUserAssignedIdentitiesValue. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(IdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class OnErrorDeployment(Model): + """Deployment on error behavior. + + :param type: The deployment on error behavior type. Possible values are + LastSuccessful and SpecificDeployment. Possible values include: + 'LastSuccessful', 'SpecificDeployment' + :type type: str or + ~azure.mgmt.resource.resources.v2019_07_01.models.OnErrorDeploymentType + :param deployment_name: The deployment to be used on error case. + :type deployment_name: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'OnErrorDeploymentType'}, + 'deployment_name': {'key': 'deploymentName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(OnErrorDeployment, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.deployment_name = kwargs.get('deployment_name', None) + + +class OnErrorDeploymentExtended(Model): + """Deployment on error behavior with additional details. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar provisioning_state: The state of the provisioning for the on error + deployment. + :vartype provisioning_state: str + :param type: The deployment on error behavior type. Possible values are + LastSuccessful and SpecificDeployment. Possible values include: + 'LastSuccessful', 'SpecificDeployment' + :type type: str or + ~azure.mgmt.resource.resources.v2019_07_01.models.OnErrorDeploymentType + :param deployment_name: The deployment to be used on error case. + :type deployment_name: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'OnErrorDeploymentType'}, + 'deployment_name': {'key': 'deploymentName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(OnErrorDeploymentExtended, self).__init__(**kwargs) + self.provisioning_state = None + self.type = kwargs.get('type', None) + self.deployment_name = kwargs.get('deployment_name', None) + + +class Operation(Model): + """Microsoft.Resources operation. + + :param name: Operation name: {provider}/{resource}/{operation} + :type name: str + :param display: The object that represents the operation. + :type display: + ~azure.mgmt.resource.resources.v2019_07_01.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__(self, **kwargs): + super(Operation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) + + +class OperationDisplay(Model): + """The object that represents the operation. + + :param provider: Service provider: Microsoft.Resources + :type provider: str + :param resource: Resource on which the operation is performed: Profile, + endpoint, etc. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + :param description: Description of the operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) + + +class ParametersLink(Model): + """Entity representing the reference to the deployment parameters. + + All required parameters must be populated in order to send to Azure. + + :param uri: Required. The URI of the parameters file. + :type uri: str + :param content_version: If included, must match the ContentVersion in the + template. + :type content_version: str + """ + + _validation = { + 'uri': {'required': True}, + } + + _attribute_map = { + 'uri': {'key': 'uri', 'type': 'str'}, + 'content_version': {'key': 'contentVersion', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ParametersLink, self).__init__(**kwargs) + self.uri = kwargs.get('uri', None) + self.content_version = kwargs.get('content_version', None) + + +class Plan(Model): + """Plan for the resource. + + :param name: The plan ID. + :type name: str + :param publisher: The publisher ID. + :type publisher: str + :param product: The offer ID. + :type product: str + :param promotion_code: The promotion code. + :type promotion_code: str + :param version: The plan's version. + :type version: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + 'promotion_code': {'key': 'promotionCode', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Plan, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.publisher = kwargs.get('publisher', None) + self.product = kwargs.get('product', None) + self.promotion_code = kwargs.get('promotion_code', None) + self.version = kwargs.get('version', None) + + +class Provider(Model): + """Resource provider information. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The provider ID. + :vartype id: str + :param namespace: The namespace of the resource provider. + :type namespace: str + :ivar registration_state: The registration state of the resource provider. + :vartype registration_state: str + :ivar registration_policy: The registration policy of the resource + provider. + :vartype registration_policy: str + :ivar resource_types: The collection of provider resource types. + :vartype resource_types: + list[~azure.mgmt.resource.resources.v2019_07_01.models.ProviderResourceType] + """ + + _validation = { + 'id': {'readonly': True}, + 'registration_state': {'readonly': True}, + 'registration_policy': {'readonly': True}, + 'resource_types': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'namespace': {'key': 'namespace', 'type': 'str'}, + 'registration_state': {'key': 'registrationState', 'type': 'str'}, + 'registration_policy': {'key': 'registrationPolicy', 'type': 'str'}, + 'resource_types': {'key': 'resourceTypes', 'type': '[ProviderResourceType]'}, + } + + def __init__(self, **kwargs): + super(Provider, self).__init__(**kwargs) + self.id = None + self.namespace = kwargs.get('namespace', None) + self.registration_state = None + self.registration_policy = None + self.resource_types = None + + +class ProviderResourceType(Model): + """Resource type managed by the resource provider. + + :param resource_type: The resource type. + :type resource_type: str + :param locations: The collection of locations where this resource type can + be created. + :type locations: list[str] + :param aliases: The aliases that are supported by this resource type. + :type aliases: + list[~azure.mgmt.resource.resources.v2019_07_01.models.AliasType] + :param api_versions: The API version. + :type api_versions: list[str] + :param capabilities: The additional capabilities offered by this resource + type. + :type capabilities: str + :param properties: The properties. + :type properties: dict[str, str] + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'locations': {'key': 'locations', 'type': '[str]'}, + 'aliases': {'key': 'aliases', 'type': '[AliasType]'}, + 'api_versions': {'key': 'apiVersions', 'type': '[str]'}, + 'capabilities': {'key': 'capabilities', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(ProviderResourceType, self).__init__(**kwargs) + self.resource_type = kwargs.get('resource_type', None) + self.locations = kwargs.get('locations', None) + self.aliases = kwargs.get('aliases', None) + self.api_versions = kwargs.get('api_versions', None) + self.capabilities = kwargs.get('capabilities', None) + self.properties = kwargs.get('properties', None) + + +class ResourceGroup(Model): + """Resource group information. + + 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: The ID of the resource group. + :vartype id: str + :ivar name: The name of the resource group. + :vartype name: str + :ivar type: The type of the resource group. + :vartype type: str + :param properties: The resource group properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_07_01.models.ResourceGroupProperties + :param location: Required. The location of the resource group. It cannot + be changed after the resource group has been created. It must be one of + the supported Azure locations. + :type location: str + :param managed_by: The ID of the resource that manages this resource + group. + :type managed_by: str + :param tags: The tags attached to the resource group. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ResourceGroupProperties'}, + 'location': {'key': 'location', 'type': 'str'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(ResourceGroup, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = kwargs.get('properties', None) + self.location = kwargs.get('location', None) + self.managed_by = kwargs.get('managed_by', None) + self.tags = kwargs.get('tags', None) + + +class ResourceGroupExportResult(Model): + """Resource group export result. + + :param template: The template content. + :type template: object + :param error: The template export error. + :type error: + ~azure.mgmt.resource.resources.v2019_07_01.models.ErrorResponse + """ + + _attribute_map = { + 'template': {'key': 'template', 'type': 'object'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__(self, **kwargs): + super(ResourceGroupExportResult, self).__init__(**kwargs) + self.template = kwargs.get('template', None) + self.error = kwargs.get('error', None) + + +class ResourceGroupFilter(Model): + """Resource group filter. + + :param tag_name: The tag name. + :type tag_name: str + :param tag_value: The tag value. + :type tag_value: str + """ + + _attribute_map = { + 'tag_name': {'key': 'tagName', 'type': 'str'}, + 'tag_value': {'key': 'tagValue', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ResourceGroupFilter, self).__init__(**kwargs) + self.tag_name = kwargs.get('tag_name', None) + self.tag_value = kwargs.get('tag_value', None) + + +class ResourceGroupPatchable(Model): + """Resource group information. + + :param name: The name of the resource group. + :type name: str + :param properties: The resource group properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_07_01.models.ResourceGroupProperties + :param managed_by: The ID of the resource that manages this resource + group. + :type managed_by: str + :param tags: The tags attached to the resource group. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ResourceGroupProperties'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(ResourceGroupPatchable, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.properties = kwargs.get('properties', None) + self.managed_by = kwargs.get('managed_by', None) + self.tags = kwargs.get('tags', None) + + +class ResourceGroupProperties(Model): + """The resource group properties. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar provisioning_state: The provisioning state. + :vartype provisioning_state: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ResourceGroupProperties, self).__init__(**kwargs) + self.provisioning_state = None + + +class ResourceProviderOperationDisplayProperties(Model): + """Resource provider operation's display properties. + + :param publisher: Operation description. + :type publisher: str + :param provider: Operation provider. + :type provider: str + :param resource: Operation resource. + :type resource: str + :param operation: Resource provider operation. + :type operation: str + :param description: Operation description. + :type description: str + """ + + _attribute_map = { + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ResourceProviderOperationDisplayProperties, self).__init__(**kwargs) + self.publisher = kwargs.get('publisher', None) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) + + +class ResourcesMoveInfo(Model): + """Parameters of move resources. + + :param resources: The IDs of the resources. + :type resources: list[str] + :param target_resource_group: The target resource group. + :type target_resource_group: str + """ + + _attribute_map = { + 'resources': {'key': 'resources', 'type': '[str]'}, + 'target_resource_group': {'key': 'targetResourceGroup', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ResourcesMoveInfo, self).__init__(**kwargs) + self.resources = kwargs.get('resources', None) + self.target_resource_group = kwargs.get('target_resource_group', None) + + +class Sku(Model): + """SKU for the resource. + + :param name: The SKU name. + :type name: str + :param tier: The SKU tier. + :type tier: str + :param size: The SKU size. + :type size: str + :param family: The SKU family. + :type family: str + :param model: The SKU model. + :type model: str + :param capacity: The SKU capacity. + :type capacity: int + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'family': {'key': 'family', 'type': 'str'}, + 'model': {'key': 'model', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(Sku, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.tier = kwargs.get('tier', None) + self.size = kwargs.get('size', None) + self.family = kwargs.get('family', None) + self.model = kwargs.get('model', None) + self.capacity = kwargs.get('capacity', None) + + +class SubResource(Model): + """Sub-resource. + + :param id: Resource ID + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SubResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class TagCount(Model): + """Tag count. + + :param type: Type of count. + :type type: str + :param value: Value of count. + :type value: int + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(TagCount, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.value = kwargs.get('value', None) + + +class TagDetails(Model): + """Tag details. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The tag ID. + :vartype id: str + :param tag_name: The tag name. + :type tag_name: str + :param count: The total number of resources that use the resource tag. + When a tag is initially created and has no associated resources, the value + is 0. + :type count: ~azure.mgmt.resource.resources.v2019_07_01.models.TagCount + :param values: The list of tag values. + :type values: + list[~azure.mgmt.resource.resources.v2019_07_01.models.TagValue] + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'tag_name': {'key': 'tagName', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'TagCount'}, + 'values': {'key': 'values', 'type': '[TagValue]'}, + } + + def __init__(self, **kwargs): + super(TagDetails, self).__init__(**kwargs) + self.id = None + self.tag_name = kwargs.get('tag_name', None) + self.count = kwargs.get('count', None) + self.values = kwargs.get('values', None) + + +class TagValue(Model): + """Tag information. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The tag ID. + :vartype id: str + :param tag_value: The tag value. + :type tag_value: str + :param count: The tag value count. + :type count: ~azure.mgmt.resource.resources.v2019_07_01.models.TagCount + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'tag_value': {'key': 'tagValue', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'TagCount'}, + } + + def __init__(self, **kwargs): + super(TagValue, self).__init__(**kwargs) + self.id = None + self.tag_value = kwargs.get('tag_value', None) + self.count = kwargs.get('count', None) + + +class TargetResource(Model): + """Target resource. + + :param id: The ID of the resource. + :type id: str + :param resource_name: The name of the resource. + :type resource_name: str + :param resource_type: The type of the resource. + :type resource_type: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'resource_name': {'key': 'resourceName', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(TargetResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.resource_name = kwargs.get('resource_name', None) + self.resource_type = kwargs.get('resource_type', None) + + +class TemplateLink(Model): + """Entity representing the reference to the template. + + All required parameters must be populated in order to send to Azure. + + :param uri: Required. The URI of the template to deploy. + :type uri: str + :param content_version: If included, must match the ContentVersion in the + template. + :type content_version: str + """ + + _validation = { + 'uri': {'required': True}, + } + + _attribute_map = { + 'uri': {'key': 'uri', 'type': 'str'}, + 'content_version': {'key': 'contentVersion', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(TemplateLink, self).__init__(**kwargs) + self.uri = kwargs.get('uri', None) + self.content_version = kwargs.get('content_version', None) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_models_py3.py new file mode 100644 index 000000000000..076d670f81a1 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_models_py3.py @@ -0,0 +1,1488 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class AliasPathType(Model): + """The type of the paths for alias. . + + :param path: The path of an alias. + :type path: str + :param api_versions: The API versions. + :type api_versions: list[str] + """ + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'api_versions': {'key': 'apiVersions', 'type': '[str]'}, + } + + def __init__(self, *, path: str=None, api_versions=None, **kwargs) -> None: + super(AliasPathType, self).__init__(**kwargs) + self.path = path + self.api_versions = api_versions + + +class AliasType(Model): + """The alias type. . + + :param name: The alias name. + :type name: str + :param paths: The paths for an alias. + :type paths: + list[~azure.mgmt.resource.resources.v2019_07_01.models.AliasPathType] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'paths': {'key': 'paths', 'type': '[AliasPathType]'}, + } + + def __init__(self, *, name: str=None, paths=None, **kwargs) -> None: + super(AliasType, self).__init__(**kwargs) + self.name = name + self.paths = paths + + +class BasicDependency(Model): + """Deployment dependency information. + + :param id: The ID of the dependency. + :type id: str + :param resource_type: The dependency resource type. + :type resource_type: str + :param resource_name: The dependency resource name. + :type resource_name: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'resource_name': {'key': 'resourceName', 'type': 'str'}, + } + + def __init__(self, *, id: str=None, resource_type: str=None, resource_name: str=None, **kwargs) -> None: + super(BasicDependency, self).__init__(**kwargs) + self.id = id + self.resource_type = resource_type + self.resource_name = resource_name + + +class CloudError(Model): + """An error response for a resource management request. + + :param error: + :type error: + ~azure.mgmt.resource.resources.v2019_07_01.models.ErrorResponse + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(CloudError, self).__init__(**kwargs) + self.error = error + + +class CloudErrorException(HttpOperationError): + """Server responsed with exception of type: 'CloudError'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(CloudErrorException, self).__init__(deserialize, response, 'CloudError', *args) + + +class DebugSetting(Model): + """The debug setting. + + :param detail_level: Specifies the type of information to log for + debugging. The permitted values are none, requestContent, responseContent, + or both requestContent and responseContent separated by a comma. The + default is none. When setting this value, carefully consider the type of + information you are passing in during deployment. By logging information + about the request or response, you could potentially expose sensitive data + that is retrieved through the deployment operations. + :type detail_level: str + """ + + _attribute_map = { + 'detail_level': {'key': 'detailLevel', 'type': 'str'}, + } + + def __init__(self, *, detail_level: str=None, **kwargs) -> None: + super(DebugSetting, self).__init__(**kwargs) + self.detail_level = detail_level + + +class Dependency(Model): + """Deployment dependency information. + + :param depends_on: The list of dependencies. + :type depends_on: + list[~azure.mgmt.resource.resources.v2019_07_01.models.BasicDependency] + :param id: The ID of the dependency. + :type id: str + :param resource_type: The dependency resource type. + :type resource_type: str + :param resource_name: The dependency resource name. + :type resource_name: str + """ + + _attribute_map = { + 'depends_on': {'key': 'dependsOn', 'type': '[BasicDependency]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'resource_name': {'key': 'resourceName', 'type': 'str'}, + } + + def __init__(self, *, depends_on=None, id: str=None, resource_type: str=None, resource_name: str=None, **kwargs) -> None: + super(Dependency, self).__init__(**kwargs) + self.depends_on = depends_on + self.id = id + self.resource_type = resource_type + self.resource_name = resource_name + + +class Deployment(Model): + """Deployment operation parameters. + + All required parameters must be populated in order to send to Azure. + + :param location: The location to store the deployment data. + :type location: str + :param properties: Required. The deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentProperties + """ + + _validation = { + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentProperties'}, + } + + def __init__(self, *, properties, location: str=None, **kwargs) -> None: + super(Deployment, self).__init__(**kwargs) + self.location = location + self.properties = properties + + +class DeploymentExportResult(Model): + """The deployment export result. . + + :param template: The template content. + :type template: object + """ + + _attribute_map = { + 'template': {'key': 'template', 'type': 'object'}, + } + + def __init__(self, *, template=None, **kwargs) -> None: + super(DeploymentExportResult, self).__init__(**kwargs) + self.template = template + + +class DeploymentExtended(Model): + """Deployment information. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The ID of the deployment. + :vartype id: str + :ivar name: The name of the deployment. + :vartype name: str + :ivar type: The type of the deployment. + :vartype type: str + :param location: the location of the deployment. + :type location: str + :param properties: Deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentPropertiesExtended + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentPropertiesExtended'}, + } + + def __init__(self, *, location: str=None, properties=None, **kwargs) -> None: + super(DeploymentExtended, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.properties = properties + + +class DeploymentExtendedFilter(Model): + """Deployment filter. + + :param provisioning_state: The provisioning state. + :type provisioning_state: str + """ + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__(self, *, provisioning_state: str=None, **kwargs) -> None: + super(DeploymentExtendedFilter, self).__init__(**kwargs) + self.provisioning_state = provisioning_state + + +class DeploymentOperation(Model): + """Deployment operation information. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Full deployment operation ID. + :vartype id: str + :ivar operation_id: Deployment operation ID. + :vartype operation_id: str + :param properties: Deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperationProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'operation_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'operation_id': {'key': 'operationId', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentOperationProperties'}, + } + + def __init__(self, *, properties=None, **kwargs) -> None: + super(DeploymentOperation, self).__init__(**kwargs) + self.id = None + self.operation_id = None + self.properties = properties + + +class DeploymentOperationProperties(Model): + """Deployment operation properties. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar provisioning_state: The state of the provisioning. + :vartype provisioning_state: str + :ivar timestamp: The date and time of the operation. + :vartype timestamp: datetime + :ivar duration: The duration of the operation. + :vartype duration: str + :ivar service_request_id: Deployment operation service request id. + :vartype service_request_id: str + :ivar status_code: Operation status code. + :vartype status_code: str + :ivar status_message: Operation status message. + :vartype status_message: object + :ivar target_resource: The target resource. + :vartype target_resource: + ~azure.mgmt.resource.resources.v2019_07_01.models.TargetResource + :ivar request: The HTTP request message. + :vartype request: + ~azure.mgmt.resource.resources.v2019_07_01.models.HttpMessage + :ivar response: The HTTP response message. + :vartype response: + ~azure.mgmt.resource.resources.v2019_07_01.models.HttpMessage + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'timestamp': {'readonly': True}, + 'duration': {'readonly': True}, + 'service_request_id': {'readonly': True}, + 'status_code': {'readonly': True}, + 'status_message': {'readonly': True}, + 'target_resource': {'readonly': True}, + 'request': {'readonly': True}, + 'response': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'duration': {'key': 'duration', 'type': 'str'}, + 'service_request_id': {'key': 'serviceRequestId', 'type': 'str'}, + 'status_code': {'key': 'statusCode', 'type': 'str'}, + 'status_message': {'key': 'statusMessage', 'type': 'object'}, + 'target_resource': {'key': 'targetResource', 'type': 'TargetResource'}, + 'request': {'key': 'request', 'type': 'HttpMessage'}, + 'response': {'key': 'response', 'type': 'HttpMessage'}, + } + + def __init__(self, **kwargs) -> None: + super(DeploymentOperationProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.timestamp = None + self.duration = None + self.service_request_id = None + self.status_code = None + self.status_message = None + self.target_resource = None + self.request = None + self.response = None + + +class DeploymentProperties(Model): + """Deployment properties. + + All required parameters must be populated in order to send to Azure. + + :param template: The template content. You use this element when you want + to pass the template syntax directly in the request rather than link to an + existing template. It can be a JObject or well-formed JSON string. Use + either the templateLink property or the template property, but not both. + :type template: object + :param template_link: The URI of the template. Use either the templateLink + property or the template property, but not both. + :type template_link: + ~azure.mgmt.resource.resources.v2019_07_01.models.TemplateLink + :param parameters: Name and value pairs that define the deployment + parameters for the template. You use this element when you want to provide + the parameter values directly in the request rather than link to an + existing parameter file. Use either the parametersLink property or the + parameters property, but not both. It can be a JObject or a well formed + JSON string. + :type parameters: object + :param parameters_link: The URI of parameters file. You use this element + to link to an existing parameters file. Use either the parametersLink + property or the parameters property, but not both. + :type parameters_link: + ~azure.mgmt.resource.resources.v2019_07_01.models.ParametersLink + :param mode: Required. The mode that is used to deploy resources. This + value can be either Incremental or Complete. In Incremental mode, + resources are deployed without deleting existing resources that are not + included in the template. In Complete mode, resources are deployed and + existing resources in the resource group that are not included in the + template are deleted. Be careful when using Complete mode as you may + unintentionally delete resources. Possible values include: 'Incremental', + 'Complete' + :type mode: str or + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentMode + :param debug_setting: The debug setting of the deployment. + :type debug_setting: + ~azure.mgmt.resource.resources.v2019_07_01.models.DebugSetting + :param on_error_deployment: The deployment on error behavior. + :type on_error_deployment: + ~azure.mgmt.resource.resources.v2019_07_01.models.OnErrorDeployment + """ + + _validation = { + 'mode': {'required': True}, + } + + _attribute_map = { + 'template': {'key': 'template', 'type': 'object'}, + 'template_link': {'key': 'templateLink', 'type': 'TemplateLink'}, + 'parameters': {'key': 'parameters', 'type': 'object'}, + 'parameters_link': {'key': 'parametersLink', 'type': 'ParametersLink'}, + 'mode': {'key': 'mode', 'type': 'DeploymentMode'}, + 'debug_setting': {'key': 'debugSetting', 'type': 'DebugSetting'}, + 'on_error_deployment': {'key': 'onErrorDeployment', 'type': 'OnErrorDeployment'}, + } + + def __init__(self, *, mode, template=None, template_link=None, parameters=None, parameters_link=None, debug_setting=None, on_error_deployment=None, **kwargs) -> None: + super(DeploymentProperties, self).__init__(**kwargs) + self.template = template + self.template_link = template_link + self.parameters = parameters + self.parameters_link = parameters_link + self.mode = mode + self.debug_setting = debug_setting + self.on_error_deployment = on_error_deployment + + +class DeploymentPropertiesExtended(Model): + """Deployment properties with additional details. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar provisioning_state: The state of the provisioning. + :vartype provisioning_state: str + :ivar correlation_id: The correlation ID of the deployment. + :vartype correlation_id: str + :ivar timestamp: The timestamp of the template deployment. + :vartype timestamp: datetime + :ivar duration: The duration of the template deployment. + :vartype duration: str + :param outputs: Key/value pairs that represent deployment output. + :type outputs: object + :param providers: The list of resource providers needed for the + deployment. + :type providers: + list[~azure.mgmt.resource.resources.v2019_07_01.models.Provider] + :param dependencies: The list of deployment dependencies. + :type dependencies: + list[~azure.mgmt.resource.resources.v2019_07_01.models.Dependency] + :param template: The template content. Use only one of Template or + TemplateLink. + :type template: object + :param template_link: The URI referencing the template. Use only one of + Template or TemplateLink. + :type template_link: + ~azure.mgmt.resource.resources.v2019_07_01.models.TemplateLink + :param parameters: Deployment parameters. Use only one of Parameters or + ParametersLink. + :type parameters: object + :param parameters_link: The URI referencing the parameters. Use only one + of Parameters or ParametersLink. + :type parameters_link: + ~azure.mgmt.resource.resources.v2019_07_01.models.ParametersLink + :param mode: The deployment mode. Possible values are Incremental and + Complete. Possible values include: 'Incremental', 'Complete' + :type mode: str or + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentMode + :param debug_setting: The debug setting of the deployment. + :type debug_setting: + ~azure.mgmt.resource.resources.v2019_07_01.models.DebugSetting + :param on_error_deployment: The deployment on error behavior. + :type on_error_deployment: + ~azure.mgmt.resource.resources.v2019_07_01.models.OnErrorDeploymentExtended + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'correlation_id': {'readonly': True}, + 'timestamp': {'readonly': True}, + 'duration': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'correlation_id': {'key': 'correlationId', 'type': 'str'}, + 'timestamp': {'key': 'timestamp', 'type': 'iso-8601'}, + 'duration': {'key': 'duration', 'type': 'str'}, + 'outputs': {'key': 'outputs', 'type': 'object'}, + 'providers': {'key': 'providers', 'type': '[Provider]'}, + 'dependencies': {'key': 'dependencies', 'type': '[Dependency]'}, + 'template': {'key': 'template', 'type': 'object'}, + 'template_link': {'key': 'templateLink', 'type': 'TemplateLink'}, + 'parameters': {'key': 'parameters', 'type': 'object'}, + 'parameters_link': {'key': 'parametersLink', 'type': 'ParametersLink'}, + 'mode': {'key': 'mode', 'type': 'DeploymentMode'}, + 'debug_setting': {'key': 'debugSetting', 'type': 'DebugSetting'}, + 'on_error_deployment': {'key': 'onErrorDeployment', 'type': 'OnErrorDeploymentExtended'}, + } + + def __init__(self, *, outputs=None, providers=None, dependencies=None, template=None, template_link=None, parameters=None, parameters_link=None, mode=None, debug_setting=None, on_error_deployment=None, **kwargs) -> None: + super(DeploymentPropertiesExtended, self).__init__(**kwargs) + self.provisioning_state = None + self.correlation_id = None + self.timestamp = None + self.duration = None + self.outputs = outputs + self.providers = providers + self.dependencies = dependencies + self.template = template + self.template_link = template_link + self.parameters = parameters + self.parameters_link = parameters_link + self.mode = mode + self.debug_setting = debug_setting + self.on_error_deployment = on_error_deployment + + +class DeploymentValidateResult(Model): + """Information from validate template deployment response. + + :param properties: The template deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentPropertiesExtended + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'DeploymentPropertiesExtended'}, + } + + def __init__(self, *, properties=None, **kwargs) -> None: + super(DeploymentValidateResult, self).__init__(**kwargs) + self.properties = properties + + +class ErrorAdditionalInfo(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) -> None: + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorResponse(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.resources.v2019_07_01.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.resource.resources.v2019_07_01.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) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ExportTemplateRequest(Model): + """Export resource group template request parameters. + + :param resources: The IDs of the resources to filter the export by. To + export all resources, supply an array with single entry '*'. + :type resources: list[str] + :param options: The export template options. A CSV-formatted list + containing zero or more of the following: 'IncludeParameterDefaultValue', + 'IncludeComments', 'SkipResourceNameParameterization', + 'SkipAllParameterization' + :type options: str + """ + + _attribute_map = { + 'resources': {'key': 'resources', 'type': '[str]'}, + 'options': {'key': 'options', 'type': 'str'}, + } + + def __init__(self, *, resources=None, options: str=None, **kwargs) -> None: + super(ExportTemplateRequest, self).__init__(**kwargs) + self.resources = resources + self.options = options + + +class Resource(Model): + """Specified resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, location: str=None, tags=None, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class GenericResource(Resource): + """Resource information. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param plan: The plan of the resource. + :type plan: ~azure.mgmt.resource.resources.v2019_07_01.models.Plan + :param properties: The resource properties. + :type properties: object + :param kind: The kind of the resource. + :type kind: str + :param managed_by: ID of the resource that manages this resource. + :type managed_by: str + :param sku: The SKU of the resource. + :type sku: ~azure.mgmt.resource.resources.v2019_07_01.models.Sku + :param identity: The identity of the resource. + :type identity: ~azure.mgmt.resource.resources.v2019_07_01.models.Identity + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'pattern': r'^[-\w\._,\(\)]+$'}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'plan': {'key': 'plan', 'type': 'Plan'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'identity': {'key': 'identity', 'type': 'Identity'}, + } + + def __init__(self, *, location: str=None, tags=None, plan=None, properties=None, kind: str=None, managed_by: str=None, sku=None, identity=None, **kwargs) -> None: + super(GenericResource, self).__init__(location=location, tags=tags, **kwargs) + self.plan = plan + self.properties = properties + self.kind = kind + self.managed_by = managed_by + self.sku = sku + self.identity = identity + + +class GenericResourceFilter(Model): + """Resource filter. + + :param resource_type: The resource type. + :type resource_type: str + :param tagname: The tag name. + :type tagname: str + :param tagvalue: The tag value. + :type tagvalue: str + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'tagname': {'key': 'tagname', 'type': 'str'}, + 'tagvalue': {'key': 'tagvalue', 'type': 'str'}, + } + + def __init__(self, *, resource_type: str=None, tagname: str=None, tagvalue: str=None, **kwargs) -> None: + super(GenericResourceFilter, self).__init__(**kwargs) + self.resource_type = resource_type + self.tagname = tagname + self.tagvalue = tagvalue + + +class HttpMessage(Model): + """HTTP message. + + :param content: HTTP message content. + :type content: object + """ + + _attribute_map = { + 'content': {'key': 'content', 'type': 'object'}, + } + + def __init__(self, *, content=None, **kwargs) -> None: + super(HttpMessage, self).__init__(**kwargs) + self.content = content + + +class Identity(Model): + """Identity for the resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :param type: The identity type. Possible values include: 'SystemAssigned', + 'UserAssigned', 'SystemAssigned, UserAssigned', 'None' + :type type: str or + ~azure.mgmt.resource.resources.v2019_07_01.models.ResourceIdentityType + :param user_assigned_identities: The list of user identities associated + with the resource. The user identity dictionary key references will be ARM + resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :type user_assigned_identities: dict[str, + ~azure.mgmt.resource.resources.v2019_07_01.models.IdentityUserAssignedIdentitiesValue] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'ResourceIdentityType'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{IdentityUserAssignedIdentitiesValue}'}, + } + + def __init__(self, *, type=None, user_assigned_identities=None, **kwargs) -> None: + super(Identity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class IdentityUserAssignedIdentitiesValue(Model): + """IdentityUserAssignedIdentitiesValue. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(IdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class OnErrorDeployment(Model): + """Deployment on error behavior. + + :param type: The deployment on error behavior type. Possible values are + LastSuccessful and SpecificDeployment. Possible values include: + 'LastSuccessful', 'SpecificDeployment' + :type type: str or + ~azure.mgmt.resource.resources.v2019_07_01.models.OnErrorDeploymentType + :param deployment_name: The deployment to be used on error case. + :type deployment_name: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'OnErrorDeploymentType'}, + 'deployment_name': {'key': 'deploymentName', 'type': 'str'}, + } + + def __init__(self, *, type=None, deployment_name: str=None, **kwargs) -> None: + super(OnErrorDeployment, self).__init__(**kwargs) + self.type = type + self.deployment_name = deployment_name + + +class OnErrorDeploymentExtended(Model): + """Deployment on error behavior with additional details. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar provisioning_state: The state of the provisioning for the on error + deployment. + :vartype provisioning_state: str + :param type: The deployment on error behavior type. Possible values are + LastSuccessful and SpecificDeployment. Possible values include: + 'LastSuccessful', 'SpecificDeployment' + :type type: str or + ~azure.mgmt.resource.resources.v2019_07_01.models.OnErrorDeploymentType + :param deployment_name: The deployment to be used on error case. + :type deployment_name: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'OnErrorDeploymentType'}, + 'deployment_name': {'key': 'deploymentName', 'type': 'str'}, + } + + def __init__(self, *, type=None, deployment_name: str=None, **kwargs) -> None: + super(OnErrorDeploymentExtended, self).__init__(**kwargs) + self.provisioning_state = None + self.type = type + self.deployment_name = deployment_name + + +class Operation(Model): + """Microsoft.Resources operation. + + :param name: Operation name: {provider}/{resource}/{operation} + :type name: str + :param display: The object that represents the operation. + :type display: + ~azure.mgmt.resource.resources.v2019_07_01.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__(self, *, name: str=None, display=None, **kwargs) -> None: + super(Operation, self).__init__(**kwargs) + self.name = name + self.display = display + + +class OperationDisplay(Model): + """The object that represents the operation. + + :param provider: Service provider: Microsoft.Resources + :type provider: str + :param resource: Resource on which the operation is performed: Profile, + endpoint, etc. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + :param description: Description of the operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, description: str=None, **kwargs) -> None: + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class ParametersLink(Model): + """Entity representing the reference to the deployment parameters. + + All required parameters must be populated in order to send to Azure. + + :param uri: Required. The URI of the parameters file. + :type uri: str + :param content_version: If included, must match the ContentVersion in the + template. + :type content_version: str + """ + + _validation = { + 'uri': {'required': True}, + } + + _attribute_map = { + 'uri': {'key': 'uri', 'type': 'str'}, + 'content_version': {'key': 'contentVersion', 'type': 'str'}, + } + + def __init__(self, *, uri: str, content_version: str=None, **kwargs) -> None: + super(ParametersLink, self).__init__(**kwargs) + self.uri = uri + self.content_version = content_version + + +class Plan(Model): + """Plan for the resource. + + :param name: The plan ID. + :type name: str + :param publisher: The publisher ID. + :type publisher: str + :param product: The offer ID. + :type product: str + :param promotion_code: The promotion code. + :type promotion_code: str + :param version: The plan's version. + :type version: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + 'promotion_code': {'key': 'promotionCode', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, publisher: str=None, product: str=None, promotion_code: str=None, version: str=None, **kwargs) -> None: + super(Plan, self).__init__(**kwargs) + self.name = name + self.publisher = publisher + self.product = product + self.promotion_code = promotion_code + self.version = version + + +class Provider(Model): + """Resource provider information. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The provider ID. + :vartype id: str + :param namespace: The namespace of the resource provider. + :type namespace: str + :ivar registration_state: The registration state of the resource provider. + :vartype registration_state: str + :ivar registration_policy: The registration policy of the resource + provider. + :vartype registration_policy: str + :ivar resource_types: The collection of provider resource types. + :vartype resource_types: + list[~azure.mgmt.resource.resources.v2019_07_01.models.ProviderResourceType] + """ + + _validation = { + 'id': {'readonly': True}, + 'registration_state': {'readonly': True}, + 'registration_policy': {'readonly': True}, + 'resource_types': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'namespace': {'key': 'namespace', 'type': 'str'}, + 'registration_state': {'key': 'registrationState', 'type': 'str'}, + 'registration_policy': {'key': 'registrationPolicy', 'type': 'str'}, + 'resource_types': {'key': 'resourceTypes', 'type': '[ProviderResourceType]'}, + } + + def __init__(self, *, namespace: str=None, **kwargs) -> None: + super(Provider, self).__init__(**kwargs) + self.id = None + self.namespace = namespace + self.registration_state = None + self.registration_policy = None + self.resource_types = None + + +class ProviderResourceType(Model): + """Resource type managed by the resource provider. + + :param resource_type: The resource type. + :type resource_type: str + :param locations: The collection of locations where this resource type can + be created. + :type locations: list[str] + :param aliases: The aliases that are supported by this resource type. + :type aliases: + list[~azure.mgmt.resource.resources.v2019_07_01.models.AliasType] + :param api_versions: The API version. + :type api_versions: list[str] + :param capabilities: The additional capabilities offered by this resource + type. + :type capabilities: str + :param properties: The properties. + :type properties: dict[str, str] + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'locations': {'key': 'locations', 'type': '[str]'}, + 'aliases': {'key': 'aliases', 'type': '[AliasType]'}, + 'api_versions': {'key': 'apiVersions', 'type': '[str]'}, + 'capabilities': {'key': 'capabilities', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + } + + def __init__(self, *, resource_type: str=None, locations=None, aliases=None, api_versions=None, capabilities: str=None, properties=None, **kwargs) -> None: + super(ProviderResourceType, self).__init__(**kwargs) + self.resource_type = resource_type + self.locations = locations + self.aliases = aliases + self.api_versions = api_versions + self.capabilities = capabilities + self.properties = properties + + +class ResourceGroup(Model): + """Resource group information. + + 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: The ID of the resource group. + :vartype id: str + :ivar name: The name of the resource group. + :vartype name: str + :ivar type: The type of the resource group. + :vartype type: str + :param properties: The resource group properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_07_01.models.ResourceGroupProperties + :param location: Required. The location of the resource group. It cannot + be changed after the resource group has been created. It must be one of + the supported Azure locations. + :type location: str + :param managed_by: The ID of the resource that manages this resource + group. + :type managed_by: str + :param tags: The tags attached to the resource group. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ResourceGroupProperties'}, + 'location': {'key': 'location', 'type': 'str'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, location: str, properties=None, managed_by: str=None, tags=None, **kwargs) -> None: + super(ResourceGroup, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = properties + self.location = location + self.managed_by = managed_by + self.tags = tags + + +class ResourceGroupExportResult(Model): + """Resource group export result. + + :param template: The template content. + :type template: object + :param error: The template export error. + :type error: + ~azure.mgmt.resource.resources.v2019_07_01.models.ErrorResponse + """ + + _attribute_map = { + 'template': {'key': 'template', 'type': 'object'}, + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__(self, *, template=None, error=None, **kwargs) -> None: + super(ResourceGroupExportResult, self).__init__(**kwargs) + self.template = template + self.error = error + + +class ResourceGroupFilter(Model): + """Resource group filter. + + :param tag_name: The tag name. + :type tag_name: str + :param tag_value: The tag value. + :type tag_value: str + """ + + _attribute_map = { + 'tag_name': {'key': 'tagName', 'type': 'str'}, + 'tag_value': {'key': 'tagValue', 'type': 'str'}, + } + + def __init__(self, *, tag_name: str=None, tag_value: str=None, **kwargs) -> None: + super(ResourceGroupFilter, self).__init__(**kwargs) + self.tag_name = tag_name + self.tag_value = tag_value + + +class ResourceGroupPatchable(Model): + """Resource group information. + + :param name: The name of the resource group. + :type name: str + :param properties: The resource group properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_07_01.models.ResourceGroupProperties + :param managed_by: The ID of the resource that manages this resource + group. + :type managed_by: str + :param tags: The tags attached to the resource group. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ResourceGroupProperties'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, name: str=None, properties=None, managed_by: str=None, tags=None, **kwargs) -> None: + super(ResourceGroupPatchable, self).__init__(**kwargs) + self.name = name + self.properties = properties + self.managed_by = managed_by + self.tags = tags + + +class ResourceGroupProperties(Model): + """The resource group properties. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar provisioning_state: The provisioning state. + :vartype provisioning_state: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(ResourceGroupProperties, self).__init__(**kwargs) + self.provisioning_state = None + + +class ResourceProviderOperationDisplayProperties(Model): + """Resource provider operation's display properties. + + :param publisher: Operation description. + :type publisher: str + :param provider: Operation provider. + :type provider: str + :param resource: Operation resource. + :type resource: str + :param operation: Resource provider operation. + :type operation: str + :param description: Operation description. + :type description: str + """ + + _attribute_map = { + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, *, publisher: str=None, provider: str=None, resource: str=None, operation: str=None, description: str=None, **kwargs) -> None: + super(ResourceProviderOperationDisplayProperties, self).__init__(**kwargs) + self.publisher = publisher + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class ResourcesMoveInfo(Model): + """Parameters of move resources. + + :param resources: The IDs of the resources. + :type resources: list[str] + :param target_resource_group: The target resource group. + :type target_resource_group: str + """ + + _attribute_map = { + 'resources': {'key': 'resources', 'type': '[str]'}, + 'target_resource_group': {'key': 'targetResourceGroup', 'type': 'str'}, + } + + def __init__(self, *, resources=None, target_resource_group: str=None, **kwargs) -> None: + super(ResourcesMoveInfo, self).__init__(**kwargs) + self.resources = resources + self.target_resource_group = target_resource_group + + +class Sku(Model): + """SKU for the resource. + + :param name: The SKU name. + :type name: str + :param tier: The SKU tier. + :type tier: str + :param size: The SKU size. + :type size: str + :param family: The SKU family. + :type family: str + :param model: The SKU model. + :type model: str + :param capacity: The SKU capacity. + :type capacity: int + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'family': {'key': 'family', 'type': 'str'}, + 'model': {'key': 'model', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__(self, *, name: str=None, tier: str=None, size: str=None, family: str=None, model: str=None, capacity: int=None, **kwargs) -> None: + super(Sku, self).__init__(**kwargs) + self.name = name + self.tier = tier + self.size = size + self.family = family + self.model = model + self.capacity = capacity + + +class SubResource(Model): + """Sub-resource. + + :param id: Resource ID + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str=None, **kwargs) -> None: + super(SubResource, self).__init__(**kwargs) + self.id = id + + +class TagCount(Model): + """Tag count. + + :param type: Type of count. + :type type: str + :param value: Value of count. + :type value: int + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'int'}, + } + + def __init__(self, *, type: str=None, value: int=None, **kwargs) -> None: + super(TagCount, self).__init__(**kwargs) + self.type = type + self.value = value + + +class TagDetails(Model): + """Tag details. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The tag ID. + :vartype id: str + :param tag_name: The tag name. + :type tag_name: str + :param count: The total number of resources that use the resource tag. + When a tag is initially created and has no associated resources, the value + is 0. + :type count: ~azure.mgmt.resource.resources.v2019_07_01.models.TagCount + :param values: The list of tag values. + :type values: + list[~azure.mgmt.resource.resources.v2019_07_01.models.TagValue] + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'tag_name': {'key': 'tagName', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'TagCount'}, + 'values': {'key': 'values', 'type': '[TagValue]'}, + } + + def __init__(self, *, tag_name: str=None, count=None, values=None, **kwargs) -> None: + super(TagDetails, self).__init__(**kwargs) + self.id = None + self.tag_name = tag_name + self.count = count + self.values = values + + +class TagValue(Model): + """Tag information. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The tag ID. + :vartype id: str + :param tag_value: The tag value. + :type tag_value: str + :param count: The tag value count. + :type count: ~azure.mgmt.resource.resources.v2019_07_01.models.TagCount + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'tag_value': {'key': 'tagValue', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'TagCount'}, + } + + def __init__(self, *, tag_value: str=None, count=None, **kwargs) -> None: + super(TagValue, self).__init__(**kwargs) + self.id = None + self.tag_value = tag_value + self.count = count + + +class TargetResource(Model): + """Target resource. + + :param id: The ID of the resource. + :type id: str + :param resource_name: The name of the resource. + :type resource_name: str + :param resource_type: The type of the resource. + :type resource_type: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'resource_name': {'key': 'resourceName', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + } + + def __init__(self, *, id: str=None, resource_name: str=None, resource_type: str=None, **kwargs) -> None: + super(TargetResource, self).__init__(**kwargs) + self.id = id + self.resource_name = resource_name + self.resource_type = resource_type + + +class TemplateLink(Model): + """Entity representing the reference to the template. + + All required parameters must be populated in order to send to Azure. + + :param uri: Required. The URI of the template to deploy. + :type uri: str + :param content_version: If included, must match the ContentVersion in the + template. + :type content_version: str + """ + + _validation = { + 'uri': {'required': True}, + } + + _attribute_map = { + 'uri': {'key': 'uri', 'type': 'str'}, + 'content_version': {'key': 'contentVersion', 'type': 'str'}, + } + + def __init__(self, *, uri: str, content_version: str=None, **kwargs) -> None: + super(TemplateLink, self).__init__(**kwargs) + self.uri = uri + self.content_version = content_version diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_paged_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_paged_models.py new file mode 100644 index 000000000000..98abbb83e22a --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_paged_models.py @@ -0,0 +1,105 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class OperationPaged(Paged): + """ + A paging container for iterating over a list of :class:`Operation ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Operation]'} + } + + def __init__(self, *args, **kwargs): + + super(OperationPaged, self).__init__(*args, **kwargs) +class DeploymentExtendedPaged(Paged): + """ + A paging container for iterating over a list of :class:`DeploymentExtended ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[DeploymentExtended]'} + } + + def __init__(self, *args, **kwargs): + + super(DeploymentExtendedPaged, self).__init__(*args, **kwargs) +class ProviderPaged(Paged): + """ + A paging container for iterating over a list of :class:`Provider ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Provider]'} + } + + def __init__(self, *args, **kwargs): + + super(ProviderPaged, self).__init__(*args, **kwargs) +class GenericResourcePaged(Paged): + """ + A paging container for iterating over a list of :class:`GenericResource ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[GenericResource]'} + } + + def __init__(self, *args, **kwargs): + + super(GenericResourcePaged, self).__init__(*args, **kwargs) +class ResourceGroupPaged(Paged): + """ + A paging container for iterating over a list of :class:`ResourceGroup ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ResourceGroup]'} + } + + def __init__(self, *args, **kwargs): + + super(ResourceGroupPaged, self).__init__(*args, **kwargs) +class TagDetailsPaged(Paged): + """ + A paging container for iterating over a list of :class:`TagDetails ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[TagDetails]'} + } + + def __init__(self, *args, **kwargs): + + super(TagDetailsPaged, self).__init__(*args, **kwargs) +class DeploymentOperationPaged(Paged): + """ + A paging container for iterating over a list of :class:`DeploymentOperation ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[DeploymentOperation]'} + } + + def __init__(self, *args, **kwargs): + + super(DeploymentOperationPaged, self).__init__(*args, **kwargs) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_resource_management_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_resource_management_client_enums.py new file mode 100644 index 000000000000..9fd73ca1de47 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_resource_management_client_enums.py @@ -0,0 +1,32 @@ +# 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 DeploymentMode(str, Enum): + + incremental = "Incremental" + complete = "Complete" + + +class OnErrorDeploymentType(str, Enum): + + last_successful = "LastSuccessful" + specific_deployment = "SpecificDeployment" + + +class ResourceIdentityType(str, Enum): + + system_assigned = "SystemAssigned" + user_assigned = "UserAssigned" + system_assigned_user_assigned = "SystemAssigned, UserAssigned" + none = "None" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/__init__.py new file mode 100644 index 000000000000..41027cf11028 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/__init__.py @@ -0,0 +1,28 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._deployments_operations import DeploymentsOperations +from ._providers_operations import ProvidersOperations +from ._resources_operations import ResourcesOperations +from ._resource_groups_operations import ResourceGroupsOperations +from ._tags_operations import TagsOperations +from ._deployment_operations import DeploymentOperations + +__all__ = [ + 'Operations', + 'DeploymentsOperations', + 'ProvidersOperations', + 'ResourcesOperations', + 'ResourceGroupsOperations', + 'TagsOperations', + 'DeploymentOperations', +] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_deployment_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_deployment_operations.py new file mode 100644 index 000000000000..8ed2970a1da3 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_deployment_operations.py @@ -0,0 +1,729 @@ +# 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 uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class DeploymentOperations(object): + """DeploymentOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for this operation. Constant value: "2019-07-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-07-01" + + self.config = config + + def get_at_scope( + self, scope, deployment_name, operation_id, custom_headers=None, raw=False, **operation_config): + """Gets a deployments operation. + + :param scope: The scope of a deployment. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param operation_id: The ID of the operation to get. + :type operation_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DeploymentOperation or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperation + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_at_scope.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentOperation', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}'} + + def list_at_scope( + self, scope, deployment_name, top=None, custom_headers=None, raw=False, **operation_config): + """Gets all deployments operations for a deployment. + + :param scope: The scope of a deployment. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param top: The number of results to return. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of DeploymentOperation + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperationPaged[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperation] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_at_scope.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.DeploymentOperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations'} + + def get_at_tenant_scope( + self, deployment_name, operation_id, custom_headers=None, raw=False, **operation_config): + """Gets a deployments operation. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param operation_id: The ID of the operation to get. + :type operation_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DeploymentOperation or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperation + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_at_tenant_scope.metadata['url'] + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentOperation', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}'} + + def list_at_tenant_scope( + self, deployment_name, top=None, custom_headers=None, raw=False, **operation_config): + """Gets all deployments operations for a deployment. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param top: The number of results to return. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of DeploymentOperation + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperationPaged[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperation] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_at_tenant_scope.metadata['url'] + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.DeploymentOperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/operations'} + + def get_at_management_group_scope( + self, group_id, deployment_name, operation_id, custom_headers=None, raw=False, **operation_config): + """Gets a deployments operation. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param operation_id: The ID of the operation to get. + :type operation_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DeploymentOperation or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperation + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_at_management_group_scope.metadata['url'] + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentOperation', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}'} + + def list_at_management_group_scope( + self, group_id, deployment_name, top=None, custom_headers=None, raw=False, **operation_config): + """Gets all deployments operations for a deployment. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param top: The number of results to return. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of DeploymentOperation + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperationPaged[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperation] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_at_management_group_scope.metadata['url'] + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.DeploymentOperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations'} + + def get_at_subscription_scope( + self, deployment_name, operation_id, custom_headers=None, raw=False, **operation_config): + """Gets a deployments operation. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param operation_id: The ID of the operation to get. + :type operation_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DeploymentOperation or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperation + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_at_subscription_scope.metadata['url'] + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentOperation', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}'} + + def list_at_subscription_scope( + self, deployment_name, top=None, custom_headers=None, raw=False, **operation_config): + """Gets all deployments operations for a deployment. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param top: The number of results to return. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of DeploymentOperation + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperationPaged[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperation] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_at_subscription_scope.metadata['url'] + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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 = {} + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.DeploymentOperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations'} + + def get( + self, resource_group_name, deployment_name, operation_id, custom_headers=None, raw=False, **operation_config): + """Gets a deployments operation. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param operation_id: The ID of the operation to get. + :type operation_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DeploymentOperation or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperation + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentOperation', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}'} + + def list( + self, resource_group_name, deployment_name, top=None, custom_headers=None, raw=False, **operation_config): + """Gets all deployments operations for a deployment. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param top: The number of results to return. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of DeploymentOperation + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperationPaged[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperation] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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 = {} + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.DeploymentOperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations'} diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_deployments_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_deployments_operations.py new file mode 100644 index 000000000000..12fd66d58794 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_deployments_operations.py @@ -0,0 +1,2923 @@ +# 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 uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class DeploymentsOperations(object): + """DeploymentsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for this operation. Constant value: "2019-07-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-07-01" + + self.config = config + + + def _delete_at_scope_initial( + self, scope, deployment_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_at_scope.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_at_scope( + self, scope, deployment_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. + Deleting a template deployment removes the associated deployment + operations. This is an asynchronous operation that returns a status of + 202 until the template deployment is successfully deleted. The Location + response header contains the URI that is used to obtain the status of + the process. While the process is running, a call to the URI in the + Location header returns a status of 202. When the process finishes, the + URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an + error-level status code. + + :param scope: The scope of a deployment. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_at_scope_initial( + scope=scope, + deployment_name=deployment_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}'} + + def check_existence_at_scope( + self, scope, deployment_name, custom_headers=None, raw=False, **operation_config): + """Checks whether the deployment exists. + + :param scope: The scope of a deployment. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.check_existence_at_scope.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.head(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + check_existence_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}'} + + + def _create_or_update_at_scope_initial( + self, scope, deployment_name, properties, location=None, custom_headers=None, raw=False, **operation_config): + parameters = models.Deployment(location=location, properties=properties) + + # Construct URL + url = self.create_or_update_at_scope.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'Deployment') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', response) + if response.status_code == 201: + deserialized = self._deserialize('DeploymentExtended', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update_at_scope( + self, scope, deployment_name, properties, location=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Deploys resources at a given scope. + + You can provide the template and parameters directly in the request or + link to JSON files. + + :param scope: The scope of a deployment. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param properties: The deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentProperties + :param location: The location to store the deployment data. + :type location: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns DeploymentExtended or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_at_scope_initial( + scope=scope, + deployment_name=deployment_name, + properties=properties, + location=location, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('DeploymentExtended', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}'} + + def get_at_scope( + self, scope, deployment_name, custom_headers=None, raw=False, **operation_config): + """Gets a deployment. + + :param scope: The scope of a deployment. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DeploymentExtended or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_at_scope.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}'} + + def cancel_at_scope( + self, scope, deployment_name, custom_headers=None, raw=False, **operation_config): + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted + or Running. After the deployment is canceled, the provisioningState is + set to Canceled. Canceling a template deployment stops the currently + running template deployment and leaves the resources partially + deployed. + + :param scope: The scope of a deployment. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.cancel_at_scope.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + cancel_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'} + + def validate_at_scope( + self, scope, deployment_name, properties, location=None, custom_headers=None, raw=False, **operation_config): + """Validates whether the specified template is syntactically correct and + will be accepted by Azure Resource Manager.. + + :param scope: The scope of a deployment. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param properties: The deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentProperties + :param location: The location to store the deployment data. + :type location: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DeploymentValidateResult or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentValidateResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + parameters = models.Deployment(location=location, properties=properties) + + # Construct URL + url = self.validate_at_scope.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'Deployment') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentValidateResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + validate_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} + + def export_template_at_scope( + self, scope, deployment_name, custom_headers=None, raw=False, **operation_config): + """Exports the template used for specified deployment. + + :param scope: The scope of a deployment. + :type scope: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DeploymentExportResult or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExportResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.export_template_at_scope.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExportResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + export_template_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'} + + def list_at_scope( + self, scope, filter=None, top=None, custom_headers=None, raw=False, **operation_config): + """Get all the deployments at the given scope. + + :param scope: The scope of a deployment. + :type scope: str + :param filter: The filter to apply on the operation. For example, you + can use $filter=provisioningState eq '{state}'. + :type filter: str + :param top: The number of results to get. If null is passed, returns + all deployments. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of DeploymentExtended + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtendedPaged[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_at_scope.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.DeploymentExtendedPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_at_scope.metadata = {'url': '/{scope}/providers/Microsoft.Resources/deployments/'} + + + def _delete_at_tenant_scope_initial( + self, deployment_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_at_tenant_scope.metadata['url'] + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_at_tenant_scope( + self, deployment_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. + Deleting a template deployment removes the associated deployment + operations. This is an asynchronous operation that returns a status of + 202 until the template deployment is successfully deleted. The Location + response header contains the URI that is used to obtain the status of + the process. While the process is running, a call to the URI in the + Location header returns a status of 202. When the process finishes, the + URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an + error-level status code. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_at_tenant_scope_initial( + deployment_name=deployment_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}'} + + def check_existence_at_tenant_scope( + self, deployment_name, custom_headers=None, raw=False, **operation_config): + """Checks whether the deployment exists. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.check_existence_at_tenant_scope.metadata['url'] + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.head(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + check_existence_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}'} + + + def _create_or_update_at_tenant_scope_initial( + self, deployment_name, properties, location=None, custom_headers=None, raw=False, **operation_config): + parameters = models.Deployment(location=location, properties=properties) + + # Construct URL + url = self.create_or_update_at_tenant_scope.metadata['url'] + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'Deployment') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', response) + if response.status_code == 201: + deserialized = self._deserialize('DeploymentExtended', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update_at_tenant_scope( + self, deployment_name, properties, location=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Deploys resources at tenant scope. + + You can provide the template and parameters directly in the request or + link to JSON files. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param properties: The deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentProperties + :param location: The location to store the deployment data. + :type location: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns DeploymentExtended or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_at_tenant_scope_initial( + deployment_name=deployment_name, + properties=properties, + location=location, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('DeploymentExtended', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}'} + + def get_at_tenant_scope( + self, deployment_name, custom_headers=None, raw=False, **operation_config): + """Gets a deployment. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DeploymentExtended or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_at_tenant_scope.metadata['url'] + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}'} + + def cancel_at_tenant_scope( + self, deployment_name, custom_headers=None, raw=False, **operation_config): + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted + or Running. After the deployment is canceled, the provisioningState is + set to Canceled. Canceling a template deployment stops the currently + running template deployment and leaves the resources partially + deployed. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.cancel_at_tenant_scope.metadata['url'] + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + cancel_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'} + + def validate_at_tenant_scope( + self, deployment_name, properties, location=None, custom_headers=None, raw=False, **operation_config): + """Validates whether the specified template is syntactically correct and + will be accepted by Azure Resource Manager.. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param properties: The deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentProperties + :param location: The location to store the deployment data. + :type location: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DeploymentValidateResult or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentValidateResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + parameters = models.Deployment(location=location, properties=properties) + + # Construct URL + url = self.validate_at_tenant_scope.metadata['url'] + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'Deployment') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentValidateResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + validate_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} + + def export_template_at_tenant_scope( + self, deployment_name, custom_headers=None, raw=False, **operation_config): + """Exports the template used for specified deployment. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DeploymentExportResult or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExportResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.export_template_at_tenant_scope.metadata['url'] + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExportResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + export_template_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'} + + def list_at_tenant_scope( + self, filter=None, top=None, custom_headers=None, raw=False, **operation_config): + """Get all the deployments at the tenant scope. + + :param filter: The filter to apply on the operation. For example, you + can use $filter=provisioningState eq '{state}'. + :type filter: str + :param top: The number of results to get. If null is passed, returns + all deployments. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of DeploymentExtended + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtendedPaged[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_at_tenant_scope.metadata['url'] + + # Construct parameters + query_parameters = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.DeploymentExtendedPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_at_tenant_scope.metadata = {'url': '/providers/Microsoft.Resources/deployments/'} + + + def _delete_at_management_group_scope_initial( + self, group_id, deployment_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_at_management_group_scope.metadata['url'] + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_at_management_group_scope( + self, group_id, deployment_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. + Deleting a template deployment removes the associated deployment + operations. This is an asynchronous operation that returns a status of + 202 until the template deployment is successfully deleted. The Location + response header contains the URI that is used to obtain the status of + the process. While the process is running, a call to the URI in the + Location header returns a status of 202. When the process finishes, the + URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an + error-level status code. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_at_management_group_scope_initial( + group_id=group_id, + deployment_name=deployment_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}'} + + def check_existence_at_management_group_scope( + self, group_id, deployment_name, custom_headers=None, raw=False, **operation_config): + """Checks whether the deployment exists. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.check_existence_at_management_group_scope.metadata['url'] + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.head(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + check_existence_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}'} + + + def _create_or_update_at_management_group_scope_initial( + self, group_id, deployment_name, properties, location=None, custom_headers=None, raw=False, **operation_config): + parameters = models.Deployment(location=location, properties=properties) + + # Construct URL + url = self.create_or_update_at_management_group_scope.metadata['url'] + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'Deployment') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', response) + if response.status_code == 201: + deserialized = self._deserialize('DeploymentExtended', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update_at_management_group_scope( + self, group_id, deployment_name, properties, location=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Deploys resources at management group scope. + + You can provide the template and parameters directly in the request or + link to JSON files. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param properties: The deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentProperties + :param location: The location to store the deployment data. + :type location: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns DeploymentExtended or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_at_management_group_scope_initial( + group_id=group_id, + deployment_name=deployment_name, + properties=properties, + location=location, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('DeploymentExtended', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}'} + + def get_at_management_group_scope( + self, group_id, deployment_name, custom_headers=None, raw=False, **operation_config): + """Gets a deployment. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DeploymentExtended or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_at_management_group_scope.metadata['url'] + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}'} + + def cancel_at_management_group_scope( + self, group_id, deployment_name, custom_headers=None, raw=False, **operation_config): + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted + or Running. After the deployment is canceled, the provisioningState is + set to Canceled. Canceling a template deployment stops the currently + running template deployment and leaves the resources partially + deployed. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.cancel_at_management_group_scope.metadata['url'] + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + cancel_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'} + + def validate_at_management_group_scope( + self, group_id, deployment_name, properties, location=None, custom_headers=None, raw=False, **operation_config): + """Validates whether the specified template is syntactically correct and + will be accepted by Azure Resource Manager.. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param properties: The deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentProperties + :param location: The location to store the deployment data. + :type location: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DeploymentValidateResult or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentValidateResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + parameters = models.Deployment(location=location, properties=properties) + + # Construct URL + url = self.validate_at_management_group_scope.metadata['url'] + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'Deployment') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentValidateResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + validate_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} + + def export_template_at_management_group_scope( + self, group_id, deployment_name, custom_headers=None, raw=False, **operation_config): + """Exports the template used for specified deployment. + + :param group_id: The management group ID. + :type group_id: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DeploymentExportResult or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExportResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.export_template_at_management_group_scope.metadata['url'] + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExportResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + export_template_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'} + + def list_at_management_group_scope( + self, group_id, filter=None, top=None, custom_headers=None, raw=False, **operation_config): + """Get all the deployments for a management group. + + :param group_id: The management group ID. + :type group_id: str + :param filter: The filter to apply on the operation. For example, you + can use $filter=provisioningState eq '{state}'. + :type filter: str + :param top: The number of results to get. If null is passed, returns + all deployments. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of DeploymentExtended + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtendedPaged[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_at_management_group_scope.metadata['url'] + path_format_arguments = { + 'groupId': self._serialize.url("group_id", group_id, 'str', max_length=90, min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.DeploymentExtendedPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_at_management_group_scope.metadata = {'url': '/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/'} + + + def _delete_at_subscription_scope_initial( + self, deployment_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_at_subscription_scope.metadata['url'] + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_at_subscription_scope( + self, deployment_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. + Deleting a template deployment removes the associated deployment + operations. This is an asynchronous operation that returns a status of + 202 until the template deployment is successfully deleted. The Location + response header contains the URI that is used to obtain the status of + the process. While the process is running, a call to the URI in the + Location header returns a status of 202. When the process finishes, the + URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an + error-level status code. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_at_subscription_scope_initial( + deployment_name=deployment_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} + + def check_existence_at_subscription_scope( + self, deployment_name, custom_headers=None, raw=False, **operation_config): + """Checks whether the deployment exists. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.check_existence_at_subscription_scope.metadata['url'] + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.head(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + check_existence_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} + + + def _create_or_update_at_subscription_scope_initial( + self, deployment_name, properties, location=None, custom_headers=None, raw=False, **operation_config): + parameters = models.Deployment(location=location, properties=properties) + + # Construct URL + url = self.create_or_update_at_subscription_scope.metadata['url'] + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'Deployment') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', response) + if response.status_code == 201: + deserialized = self._deserialize('DeploymentExtended', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update_at_subscription_scope( + self, deployment_name, properties, location=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Deploys resources at subscription scope. + + You can provide the template and parameters directly in the request or + link to JSON files. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param properties: The deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentProperties + :param location: The location to store the deployment data. + :type location: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns DeploymentExtended or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_at_subscription_scope_initial( + deployment_name=deployment_name, + properties=properties, + location=location, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('DeploymentExtended', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} + + def get_at_subscription_scope( + self, deployment_name, custom_headers=None, raw=False, **operation_config): + """Gets a deployment. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DeploymentExtended or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_at_subscription_scope.metadata['url'] + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'} + + def cancel_at_subscription_scope( + self, deployment_name, custom_headers=None, raw=False, **operation_config): + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted + or Running. After the deployment is canceled, the provisioningState is + set to Canceled. Canceling a template deployment stops the currently + running template deployment and leaves the resources partially + deployed. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.cancel_at_subscription_scope.metadata['url'] + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + cancel_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'} + + def validate_at_subscription_scope( + self, deployment_name, properties, location=None, custom_headers=None, raw=False, **operation_config): + """Validates whether the specified template is syntactically correct and + will be accepted by Azure Resource Manager.. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param properties: The deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentProperties + :param location: The location to store the deployment data. + :type location: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DeploymentValidateResult or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentValidateResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + parameters = models.Deployment(location=location, properties=properties) + + # Construct URL + url = self.validate_at_subscription_scope.metadata['url'] + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'Deployment') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentValidateResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + validate_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} + + def export_template_at_subscription_scope( + self, deployment_name, custom_headers=None, raw=False, **operation_config): + """Exports the template used for specified deployment. + + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DeploymentExportResult or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExportResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.export_template_at_subscription_scope.metadata['url'] + path_format_arguments = { + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExportResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + export_template_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'} + + def list_at_subscription_scope( + self, filter=None, top=None, custom_headers=None, raw=False, **operation_config): + """Get all the deployments for a subscription. + + :param filter: The filter to apply on the operation. For example, you + can use $filter=provisioningState eq '{state}'. + :type filter: str + :param top: The number of results to get. If null is passed, returns + all deployments. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of DeploymentExtended + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtendedPaged[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_at_subscription_scope.metadata['url'] + 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 = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.DeploymentExtendedPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_at_subscription_scope.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/'} + + + def _delete_initial( + self, resource_group_name, deployment_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, deployment_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. + Deleting a template deployment removes the associated deployment + operations. Deleting a template deployment does not affect the state of + the resource group. This is an asynchronous operation that returns a + status of 202 until the template deployment is successfully deleted. + The Location response header contains the URI that is used to obtain + the status of the process. While the process is running, a call to the + URI in the Location header returns a status of 202. When the process + finishes, the URI in the Location header returns a status of 204 on + success. If the asynchronous request failed, the URI in the Location + header returns an error-level status code. + + :param resource_group_name: The name of the resource group with the + deployment to delete. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} + + def check_existence( + self, resource_group_name, deployment_name, custom_headers=None, raw=False, **operation_config): + """Checks whether the deployment exists. + + :param resource_group_name: The name of the resource group with the + deployment to check. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.check_existence.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.head(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + check_existence.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} + + + def _create_or_update_initial( + self, resource_group_name, deployment_name, properties, location=None, custom_headers=None, raw=False, **operation_config): + parameters = models.Deployment(location=location, properties=properties) + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'Deployment') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', response) + if response.status_code == 201: + deserialized = self._deserialize('DeploymentExtended', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, deployment_name, properties, location=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Deploys resources to a resource group. + + You can provide the template and parameters directly in the request or + link to JSON files. + + :param resource_group_name: The name of the resource group to deploy + the resources to. The name is case insensitive. The resource group + must already exist. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param properties: The deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentProperties + :param location: The location to store the deployment data. + :type location: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns DeploymentExtended or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + properties=properties, + location=location, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('DeploymentExtended', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} + + def get( + self, resource_group_name, deployment_name, custom_headers=None, raw=False, **operation_config): + """Gets a deployment. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DeploymentExtended or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExtended', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'} + + def cancel( + self, resource_group_name, deployment_name, custom_headers=None, raw=False, **operation_config): + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted + or Running. After the deployment is canceled, the provisioningState is + set to Canceled. Canceling a template deployment stops the currently + running template deployment and leaves the resource group partially + deployed. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.cancel.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'} + + def validate( + self, resource_group_name, deployment_name, properties, location=None, custom_headers=None, raw=False, **operation_config): + """Validates whether the specified template is syntactically correct and + will be accepted by Azure Resource Manager.. + + :param resource_group_name: The name of the resource group the + template will be deployed to. The name is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param properties: The deployment properties. + :type properties: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentProperties + :param location: The location to store the deployment data. + :type location: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DeploymentValidateResult or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentValidateResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + parameters = models.Deployment(location=location, properties=properties) + + # Construct URL + url = self.validate.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'Deployment') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentValidateResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'} + + def export_template( + self, resource_group_name, deployment_name, custom_headers=None, raw=False, **operation_config): + """Exports the template used for specified deployment. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param deployment_name: The name of the deployment. + :type deployment_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DeploymentExportResult or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExportResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.export_template.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str', max_length=64, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeploymentExportResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + export_template.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'} + + def list_by_resource_group( + self, resource_group_name, filter=None, top=None, custom_headers=None, raw=False, **operation_config): + """Get all the deployments for a resource group. + + :param resource_group_name: The name of the resource group with the + deployments to get. The name is case insensitive. + :type resource_group_name: str + :param filter: The filter to apply on the operation. For example, you + can use $filter=provisioningState eq '{state}'. + :type filter: str + :param top: The number of results to get. If null is passed, returns + all deployments. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of DeploymentExtended + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtendedPaged[~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentExtended] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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 = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.DeploymentExtendedPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/'} diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_operations.py new file mode 100644 index 000000000000..9a0432e93554 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_operations.py @@ -0,0 +1,102 @@ +# 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 uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class Operations(object): + """Operations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for this operation. Constant value: "2019-07-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-07-01" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all of the available Microsoft.Resources REST API operations. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Operation + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.OperationPaged[~azure.mgmt.resource.resources.v2019_07_01.models.Operation] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Resources/operations'} diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_providers_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_providers_operations.py new file mode 100644 index 000000000000..17f960977e88 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_providers_operations.py @@ -0,0 +1,437 @@ +# 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 uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class ProvidersOperations(object): + """ProvidersOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for this operation. Constant value: "2019-07-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-07-01" + + self.config = config + + def unregister( + self, resource_provider_namespace, custom_headers=None, raw=False, **operation_config): + """Unregisters a subscription from a resource provider. + + :param resource_provider_namespace: The namespace of the resource + provider to unregister. + :type resource_provider_namespace: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Provider or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.Provider or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.unregister.metadata['url'] + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Provider', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + unregister.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/unregister'} + + def register( + self, resource_provider_namespace, custom_headers=None, raw=False, **operation_config): + """Registers a subscription with a resource provider. + + :param resource_provider_namespace: The namespace of the resource + provider to register. + :type resource_provider_namespace: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Provider or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.Provider or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.register.metadata['url'] + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Provider', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + register.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/register'} + + def list( + self, top=None, expand=None, custom_headers=None, raw=False, **operation_config): + """Gets all resource providers for a subscription. + + :param top: The number of results to return. If null is passed returns + all deployments. + :type top: int + :param expand: The properties to include in the results. For example, + use &$expand=metadata in the query string to retrieve resource + provider metadata. To include property aliases in response, use + $expand=resourceTypes/aliases. + :type expand: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Provider + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.ProviderPaged[~azure.mgmt.resource.resources.v2019_07_01.models.Provider] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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 = {} + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ProviderPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers'} + + def list_at_tenant_scope( + self, top=None, expand=None, custom_headers=None, raw=False, **operation_config): + """Gets all resource providers for the tenant. + + :param top: The number of results to return. If null is passed returns + all providers. + :type top: int + :param expand: The properties to include in the results. For example, + use &$expand=metadata in the query string to retrieve resource + provider metadata. To include property aliases in response, use + $expand=resourceTypes/aliases. + :type expand: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Provider + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.ProviderPaged[~azure.mgmt.resource.resources.v2019_07_01.models.Provider] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_at_tenant_scope.metadata['url'] + + # Construct parameters + query_parameters = {} + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ProviderPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_at_tenant_scope.metadata = {'url': '/providers'} + + def get( + self, resource_provider_namespace, expand=None, custom_headers=None, raw=False, **operation_config): + """Gets the specified resource provider. + + :param resource_provider_namespace: The namespace of the resource + provider. + :type resource_provider_namespace: str + :param expand: The $expand query parameter. For example, to include + property aliases in response, use $expand=resourceTypes/aliases. + :type expand: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Provider or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.Provider or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + '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 = {} + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Provider', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}'} + + def get_at_tenant_scope( + self, resource_provider_namespace, expand=None, custom_headers=None, raw=False, **operation_config): + """Gets the specified resource provider at the tenant level. + + :param resource_provider_namespace: The namespace of the resource + provider. + :type resource_provider_namespace: str + :param expand: The $expand query parameter. For example, to include + property aliases in response, use $expand=resourceTypes/aliases. + :type expand: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Provider or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.Provider or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_at_tenant_scope.metadata['url'] + path_format_arguments = { + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Provider', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_at_tenant_scope.metadata = {'url': '/providers/{resourceProviderNamespace}'} diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_resource_groups_operations.py new file mode 100644 index 000000000000..e4901fa94e8a --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_resource_groups_operations.py @@ -0,0 +1,528 @@ +# 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 uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class ResourceGroupsOperations(object): + """ResourceGroupsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for this operation. Constant value: "2019-07-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-07-01" + + self.config = config + + def check_existence( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Checks whether a resource group exists. + + :param resource_group_name: The name of the resource group to check. + The name is case insensitive. + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.check_existence.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.head(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + check_existence.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} + + def create_or_update( + self, resource_group_name, parameters, custom_headers=None, raw=False, **operation_config): + """Creates or updates a resource group. + + :param resource_group_name: The name of the resource group to create + or update. Can include alphanumeric, underscore, parentheses, hyphen, + period (except at end), and Unicode characters that match the allowed + characters. + :type resource_group_name: str + :param parameters: Parameters supplied to the create or update a + resource group. + :type parameters: + ~azure.mgmt.resource.resources.v2019_07_01.models.ResourceGroup + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ResourceGroup or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.ResourceGroup or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'ResourceGroup') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ResourceGroup', response) + if response.status_code == 201: + deserialized = self._deserialize('ResourceGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} + + + def _delete_initial( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes a resource group. + + When you delete a resource group, all of its resources are also + deleted. Deleting a resource group deletes all of its template + deployments and currently stored operations. + + :param resource_group_name: The name of the resource group to delete. + The name is case insensitive. + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} + + def get( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Gets a resource group. + + :param resource_group_name: The name of the resource group to get. The + name is case insensitive. + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ResourceGroup or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.ResourceGroup or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ResourceGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} + + def update( + self, resource_group_name, parameters, custom_headers=None, raw=False, **operation_config): + """Updates a resource group. + + Resource groups can be updated through a simple PATCH operation to a + group address. The format of the request is the same as that for + creating a resource group. If a field is unspecified, the current value + is retained. + + :param resource_group_name: The name of the resource group to update. + The name is case insensitive. + :type resource_group_name: str + :param parameters: Parameters supplied to update a resource group. + :type parameters: + ~azure.mgmt.resource.resources.v2019_07_01.models.ResourceGroupPatchable + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ResourceGroup or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.ResourceGroup or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'ResourceGroupPatchable') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ResourceGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'} + + def export_template( + self, resource_group_name, resources=None, options=None, custom_headers=None, raw=False, **operation_config): + """Captures the specified resource group as a template. + + :param resource_group_name: The name of the resource group to export + as a template. + :type resource_group_name: str + :param resources: The IDs of the resources to filter the export by. To + export all resources, supply an array with single entry '*'. + :type resources: list[str] + :param options: The export template options. A CSV-formatted list + containing zero or more of the following: + 'IncludeParameterDefaultValue', 'IncludeComments', + 'SkipResourceNameParameterization', 'SkipAllParameterization' + :type options: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ResourceGroupExportResult or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.ResourceGroupExportResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + parameters = models.ExportTemplateRequest(resources=resources, options=options) + + # Construct URL + url = self.export_template.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'ExportTemplateRequest') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ResourceGroupExportResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + export_template.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate'} + + def list( + self, filter=None, top=None, custom_headers=None, raw=False, **operation_config): + """Gets all the resource groups for a subscription. + + :param filter: The filter to apply on the operation.

You can + filter by tag names and values. For example, to filter for a tag name + and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1' + :type filter: str + :param top: The number of results to return. If null is passed, + returns all resource groups. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ResourceGroup + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.ResourceGroupPaged[~azure.mgmt.resource.resources.v2019_07_01.models.ResourceGroup] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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 = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ResourceGroupPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups'} diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_resources_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_resources_operations.py new file mode 100644 index 000000000000..608c53086032 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_resources_operations.py @@ -0,0 +1,1307 @@ +# 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 uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class ResourcesOperations(object): + """ResourcesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for this operation. Constant value: "2019-07-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-07-01" + + self.config = config + + def list_by_resource_group( + self, resource_group_name, filter=None, expand=None, top=None, custom_headers=None, raw=False, **operation_config): + """Get all the resources for a resource group. + + :param resource_group_name: The resource group with the resources to + get. + :type resource_group_name: str + :param filter: The filter to apply on the operation.

The + properties you can use for eq (equals) or ne (not equals) are: + location, resourceType, name, resourceGroup, identity, + identity/principalId, plan, plan/publisher, plan/product, plan/name, + plan/version, and plan/promotionCode.

For example, to filter by + a resource type, use: $filter=resourceType eq + 'Microsoft.Network/virtualNetworks'

You can use + substringof(value, property) in the filter. The properties you can use + for substring are: name and resourceGroup.

For example, to get + all resources with 'demo' anywhere in the name, use: + $filter=substringof('demo', name)

You can link more than one + substringof together by adding and/or operators.

You can filter + by tag names and values. For example, to filter for a tag name and + value, use $filter=tagName eq 'tag1' and tagValue eq + 'Value1'

You can use some properties together when filtering. + The combinations you can use are: substringof and/or resourceType, + plan and plan/publisher and plan/name, identity and + identity/principalId. + :type filter: str + :param expand: The $expand query parameter. You can expand createdTime + and changedTime. For example, to expand both properties, use + $expand=changedTime,createdTime + :type expand: str + :param top: The number of results to return. If null is passed, + returns all resources. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of GenericResource + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.GenericResourcePaged[~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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 = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.GenericResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/resources'} + + + def _move_resources_initial( + self, source_resource_group_name, resources=None, target_resource_group=None, custom_headers=None, raw=False, **operation_config): + parameters = models.ResourcesMoveInfo(resources=resources, target_resource_group=target_resource_group) + + # Construct URL + url = self.move_resources.metadata['url'] + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def move_resources( + self, source_resource_group_name, resources=None, target_resource_group=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Moves resources from one resource group to another resource group. + + The resources to move must be in the same source resource group. The + target resource group may be in a different subscription. When moving + resources, both the source group and the target group are locked for + the duration of the operation. Write and delete operations are blocked + on the groups until the move completes. . + + :param source_resource_group_name: The name of the resource group + containing the resources to move. + :type source_resource_group_name: str + :param resources: The IDs of the resources. + :type resources: list[str] + :param target_resource_group: The target resource group. + :type target_resource_group: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._move_resources_initial( + source_resource_group_name=source_resource_group_name, + resources=resources, + target_resource_group=target_resource_group, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + move_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources'} + + + def _validate_move_resources_initial( + self, source_resource_group_name, resources=None, target_resource_group=None, custom_headers=None, raw=False, **operation_config): + parameters = models.ResourcesMoveInfo(resources=resources, target_resource_group=target_resource_group) + + # Construct URL + url = self.validate_move_resources.metadata['url'] + path_format_arguments = { + 'sourceResourceGroupName': self._serialize.url("source_resource_group_name", source_resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'ResourcesMoveInfo') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def validate_move_resources( + self, source_resource_group_name, resources=None, target_resource_group=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Validates whether resources can be moved from one resource group to + another resource group. + + This operation checks whether the specified resources can be moved to + the target. The resources to move must be in the same source resource + group. The target resource group may be in a different subscription. If + validation succeeds, it returns HTTP response code 204 (no content). If + validation fails, it returns HTTP response code 409 (Conflict) with an + error message. Retrieve the URL in the Location header value to check + the result of the long-running operation. + + :param source_resource_group_name: The name of the resource group + containing the resources to validate for move. + :type source_resource_group_name: str + :param resources: The IDs of the resources. + :type resources: list[str] + :param target_resource_group: The target resource group. + :type target_resource_group: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._validate_move_resources_initial( + source_resource_group_name=source_resource_group_name, + resources=resources, + target_resource_group=target_resource_group, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + validate_move_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources'} + + def list( + self, filter=None, expand=None, top=None, custom_headers=None, raw=False, **operation_config): + """Get all the resources in a subscription. + + :param filter: The filter to apply on the operation.

The + properties you can use for eq (equals) or ne (not equals) are: + location, resourceType, name, resourceGroup, identity, + identity/principalId, plan, plan/publisher, plan/product, plan/name, + plan/version, and plan/promotionCode.

For example, to filter by + a resource type, use: $filter=resourceType eq + 'Microsoft.Network/virtualNetworks'

You can use + substringof(value, property) in the filter. The properties you can use + for substring are: name and resourceGroup.

For example, to get + all resources with 'demo' anywhere in the name, use: + $filter=substringof('demo', name)

You can link more than one + substringof together by adding and/or operators.

You can filter + by tag names and values. For example, to filter for a tag name and + value, use $filter=tagName eq 'tag1' and tagValue eq + 'Value1'

You can use some properties together when filtering. + The combinations you can use are: substringof and/or resourceType, + plan and plan/publisher and plan/name, identity and + identity/principalId. + :type filter: str + :param expand: The $expand query parameter. You can expand createdTime + and changedTime. For example, to expand both properties, use + $expand=changedTime,createdTime + :type expand: str + :param top: The number of results to return. If null is passed, + returns all resource groups. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of GenericResource + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.GenericResourcePaged[~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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 = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.GenericResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} + + def check_existence( + self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers=None, raw=False, **operation_config): + """Checks whether a resource exists. + + :param resource_group_name: The name of the resource group containing + the resource to check. The name is case insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The resource provider of the + resource to check. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type. + :type resource_type: str + :param resource_name: The name of the resource to check whether it + exists. + :type resource_name: str + :param api_version: The API version to use for the operation. + :type api_version: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.check_existence.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.head(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + check_existence.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} + + + def _delete_initial( + self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes a resource. + + :param resource_group_name: The name of the resource group that + contains the resource to delete. The name is case insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource + provider. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type. + :type resource_type: str + :param resource_name: The name of the resource to delete. + :type resource_name: str + :param api_version: The API version to use for the operation. + :type api_version: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + api_version=api_version, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} + + + def _create_or_update_initial( + self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'GenericResource') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('GenericResource', response) + if response.status_code == 201: + deserialized = self._deserialize('GenericResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates a resource. + + :param resource_group_name: The name of the resource group for the + resource. The name is case insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource + provider. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type of the resource to create. + :type resource_type: str + :param resource_name: The name of the resource to create. + :type resource_name: str + :param api_version: The API version to use for the operation. + :type api_version: str + :param parameters: Parameters for creating or updating the resource. + :type parameters: + ~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns GenericResource or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + api_version=api_version, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('GenericResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} + + + def _update_initial( + self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'GenericResource') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('GenericResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Updates a resource. + + :param resource_group_name: The name of the resource group for the + resource. The name is case insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource + provider. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type of the resource to update. + :type resource_type: str + :param resource_name: The name of the resource to update. + :type resource_name: str + :param api_version: The API version to use for the operation. + :type api_version: str + :param parameters: Parameters for updating the resource. + :type parameters: + ~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns GenericResource or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource]] + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + api_version=api_version, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('GenericResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} + + def get( + self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers=None, raw=False, **operation_config): + """Gets a resource. + + :param resource_group_name: The name of the resource group containing + the resource to get. The name is case insensitive. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource + provider. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. + :type parent_resource_path: str + :param resource_type: The resource type of the resource. + :type resource_type: str + :param resource_name: The name of the resource to get. + :type resource_name: str + :param api_version: The API version to use for the operation. + :type api_version: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: GenericResource or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'), + 'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True), + 'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GenericResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}'} + + def check_existence_by_id( + self, resource_id, api_version, custom_headers=None, raw=False, **operation_config): + """Checks by ID whether a resource exists. + + :param resource_id: The fully qualified ID of the resource, including + the resource name and resource type. Use the format, + /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + :type resource_id: str + :param api_version: The API version to use for the operation. + :type api_version: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.check_existence_by_id.metadata['url'] + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.head(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + check_existence_by_id.metadata = {'url': '/{resourceId}'} + + + def _delete_by_id_initial( + self, resource_id, api_version, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_by_id.metadata['url'] + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_by_id( + self, resource_id, api_version, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including + the resource name and resource type. Use the format, + /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + :type resource_id: str + :param api_version: The API version to use for the operation. + :type api_version: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_by_id_initial( + resource_id=resource_id, + api_version=api_version, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_by_id.metadata = {'url': '/{resourceId}'} + + + def _create_or_update_by_id_initial( + self, resource_id, api_version, parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_or_update_by_id.metadata['url'] + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'GenericResource') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('GenericResource', response) + if response.status_code == 201: + deserialized = self._deserialize('GenericResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update_by_id( + self, resource_id, api_version, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Create a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including + the resource name and resource type. Use the format, + /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + :type resource_id: str + :param api_version: The API version to use for the operation. + :type api_version: str + :param parameters: Create or update resource parameters. + :type parameters: + ~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns GenericResource or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_by_id_initial( + resource_id=resource_id, + api_version=api_version, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('GenericResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update_by_id.metadata = {'url': '/{resourceId}'} + + + def _update_by_id_initial( + self, resource_id, api_version, parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update_by_id.metadata['url'] + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'GenericResource') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('GenericResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update_by_id( + self, resource_id, api_version, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Updates a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including + the resource name and resource type. Use the format, + /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + :type resource_id: str + :param api_version: The API version to use for the operation. + :type api_version: str + :param parameters: Update resource parameters. + :type parameters: + ~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns GenericResource or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource]] + :raises: :class:`CloudError` + """ + raw_result = self._update_by_id_initial( + resource_id=resource_id, + api_version=api_version, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('GenericResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update_by_id.metadata = {'url': '/{resourceId}'} + + def get_by_id( + self, resource_id, api_version, custom_headers=None, raw=False, **operation_config): + """Gets a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including + the resource name and resource type. Use the format, + /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + :type resource_id: str + :param api_version: The API version to use for the operation. + :type api_version: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: GenericResource or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.GenericResource or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_by_id.metadata['url'] + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('GenericResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_id.metadata = {'url': '/{resourceId}'} diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_tags_operations.py new file mode 100644 index 000000000000..9c01af7745f9 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_tags_operations.py @@ -0,0 +1,340 @@ +# 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 uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class TagsOperations(object): + """TagsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for this operation. Constant value: "2019-07-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-07-01" + + self.config = config + + def delete_value( + self, tag_name, tag_value, custom_headers=None, raw=False, **operation_config): + """Deletes a tag value. + + :param tag_name: The name of the tag. + :type tag_name: str + :param tag_value: The value of the tag to delete. + :type tag_value: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete_value.metadata['url'] + path_format_arguments = { + 'tagName': self._serialize.url("tag_name", tag_name, 'str'), + 'tagValue': self._serialize.url("tag_value", tag_value, 'str'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete_value.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}'} + + def create_or_update_value( + self, tag_name, tag_value, custom_headers=None, raw=False, **operation_config): + """Creates a tag value. The name of the tag must already exist. + + :param tag_name: The name of the tag. + :type tag_name: str + :param tag_value: The value of the tag to create. + :type tag_value: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: TagValue or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.TagValue or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.create_or_update_value.metadata['url'] + path_format_arguments = { + 'tagName': self._serialize.url("tag_name", tag_name, 'str'), + 'tagValue': self._serialize.url("tag_value", tag_value, 'str'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('TagValue', response) + if response.status_code == 201: + deserialized = self._deserialize('TagValue', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update_value.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}'} + + def create_or_update( + self, tag_name, custom_headers=None, raw=False, **operation_config): + """Creates a tag in the subscription. + + The tag name can have a maximum of 512 characters and is case + insensitive. Tag names created by Azure have prefixes of microsoft, + azure, or windows. You cannot create tags with one of these prefixes. + + :param tag_name: The name of the tag to create. + :type tag_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: TagDetails or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.resource.resources.v2019_07_01.models.TagDetails + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'tagName': self._serialize.url("tag_name", tag_name, 'str'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('TagDetails', response) + if response.status_code == 201: + deserialized = self._deserialize('TagDetails', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames/{tagName}'} + + def delete( + self, tag_name, custom_headers=None, raw=False, **operation_config): + """Deletes a tag from the subscription. + + You must remove all values from a resource tag before you can delete + it. + + :param tag_name: The name of the tag. + :type tag_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'tagName': self._serialize.url("tag_name", tag_name, 'str'), + '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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames/{tagName}'} + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Gets the names and values of all resource tags that are defined in a + subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of TagDetails + :rtype: + ~azure.mgmt.resource.resources.v2019_07_01.models.TagDetailsPaged[~azure.mgmt.resource.resources.v2019_07_01.models.TagDetails] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.TagDetailsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/tagNames'} diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/version.py new file mode 100644 index 000000000000..6723e4244a39 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/version.py @@ -0,0 +1,13 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "2019-07-01" +