diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/__init__.py index 0e6a32c31e64..91ff47171e65 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/__init__.py @@ -39,7 +39,7 @@ from ._models_py3 import IdentityUserAssignedIdentitiesValue from ._models_py3 import OnErrorDeployment from ._models_py3 import OnErrorDeploymentExtended - from ._models_py3 import Operation + from ._models_py3 import Operation1 from ._models_py3 import OperationDisplay from ._models_py3 import ParametersLink from ._models_py3 import Plan @@ -100,7 +100,7 @@ from ._models import IdentityUserAssignedIdentitiesValue from ._models import OnErrorDeployment from ._models import OnErrorDeploymentExtended - from ._models import Operation + from ._models import Operation1 from ._models import OperationDisplay from ._models import ParametersLink from ._models import Plan @@ -134,7 +134,7 @@ from ._paged_models import DeploymentExtendedPaged from ._paged_models import DeploymentOperationPaged from ._paged_models import GenericResourceExpandedPaged -from ._paged_models import OperationPaged +from ._paged_models import Operation1Paged from ._paged_models import ProviderPaged from ._paged_models import ResourceGroupPaged from ._paged_models import TagDetailsPaged @@ -148,6 +148,7 @@ ProvisioningOperation, PropertyChangeType, ChangeType, + Operation, ) __all__ = [ @@ -180,7 +181,7 @@ 'IdentityUserAssignedIdentitiesValue', 'OnErrorDeployment', 'OnErrorDeploymentExtended', - 'Operation', + 'Operation1', 'OperationDisplay', 'ParametersLink', 'Plan', @@ -211,7 +212,7 @@ 'WhatIfChange', 'WhatIfOperationResult', 'WhatIfPropertyChange', - 'OperationPaged', + 'Operation1Paged', 'DeploymentExtendedPaged', 'ProviderPaged', 'GenericResourceExpandedPaged', @@ -227,4 +228,5 @@ 'ProvisioningOperation', 'PropertyChangeType', 'ChangeType', + 'Operation', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_models.py index b7a38fcb8d03..19d4aa9a65e2 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_models.py @@ -1185,7 +1185,7 @@ def __init__(self, **kwargs): self.deployment_name = kwargs.get('deployment_name', None) -class Operation(Model): +class Operation1(Model): """Microsoft.Resources operation. :param name: Operation name: {provider}/{resource}/{operation} @@ -1201,7 +1201,7 @@ class Operation(Model): } def __init__(self, **kwargs): - super(Operation, self).__init__(**kwargs) + super(Operation1, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -1794,7 +1794,7 @@ class TagsPatchResource(Model): :param operation: The operation type for the patch API. Possible values include: 'Replace', 'Merge', 'Delete' :type operation: str or - ~azure.mgmt.resource.resources.v2019_10_01.models.enum + ~azure.mgmt.resource.resources.v2019_10_01.models.Operation :param properties: The set of tags. :type properties: ~azure.mgmt.resource.resources.v2019_10_01.models.Tags """ diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_models_py3.py index 0d69ea6c4acd..1542edec698a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_models_py3.py @@ -1185,7 +1185,7 @@ def __init__(self, *, type=None, deployment_name: str=None, **kwargs) -> None: self.deployment_name = deployment_name -class Operation(Model): +class Operation1(Model): """Microsoft.Resources operation. :param name: Operation name: {provider}/{resource}/{operation} @@ -1201,7 +1201,7 @@ class Operation(Model): } def __init__(self, *, name: str=None, display=None, **kwargs) -> None: - super(Operation, self).__init__(**kwargs) + super(Operation1, self).__init__(**kwargs) self.name = name self.display = display @@ -1794,7 +1794,7 @@ class TagsPatchResource(Model): :param operation: The operation type for the patch API. Possible values include: 'Replace', 'Merge', 'Delete' :type operation: str or - ~azure.mgmt.resource.resources.v2019_10_01.models.enum + ~azure.mgmt.resource.resources.v2019_10_01.models.Operation :param properties: The set of tags. :type properties: ~azure.mgmt.resource.resources.v2019_10_01.models.Tags """ diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_paged_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_paged_models.py index 8df0d703591e..8c5eee1498d5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_paged_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_paged_models.py @@ -12,19 +12,19 @@ from msrest.paging import Paged -class OperationPaged(Paged): +class Operation1Paged(Paged): """ - A paging container for iterating over a list of :class:`Operation ` object + A paging container for iterating over a list of :class:`Operation1 ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Operation]'} + 'current_page': {'key': 'value', 'type': '[Operation1]'} } def __init__(self, *args, **kwargs): - super(OperationPaged, self).__init__(*args, **kwargs) + super(Operation1Paged, self).__init__(*args, **kwargs) class DeploymentExtendedPaged(Paged): """ A paging container for iterating over a list of :class:`DeploymentExtended ` object diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_resource_management_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_resource_management_client_enums.py index 7acc830d93c3..c290d6fbb418 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_resource_management_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_resource_management_client_enums.py @@ -81,3 +81,10 @@ class ChangeType(str, Enum): deploy = "Deploy" #: The resource exists in the current state and the desired state and will be redeployed when the deployment is executed. The properties of the resource may or may not change. no_change = "NoChange" #: The resource exists in the current state and the desired state and will be redeployed when the deployment is executed. The properties of the resource will not change. modify = "Modify" #: The resource exists in the current state and the desired state and will be redeployed when the deployment is executed. The properties of the resource will change. + + +class Operation(str, Enum): + + replace = "Replace" #: The 'replace' option replaces the entire set of existing tags with a new set. + merge = "Merge" #: The 'merge' option allows adding tags with new names and updating the values of tags with existing names. + delete = "Delete" #: The 'delete' option allows selectively deleting tags based on given names or name/value pairs. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_operations.py index 08402ad733ee..fce26cc55d21 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_operations.py @@ -48,9 +48,9 @@ def list( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: An iterator like instance of Operation + :return: An iterator like instance of Operation1 :rtype: - ~azure.mgmt.resource.resources.v2019_10_01.models.OperationPaged[~azure.mgmt.resource.resources.v2019_10_01.models.Operation] + ~azure.mgmt.resource.resources.v2019_10_01.models.Operation1Paged[~azure.mgmt.resource.resources.v2019_10_01.models.Operation1] :raises: :class:`CloudError` """ def prepare_request(next_link=None): @@ -96,7 +96,7 @@ def internal_paging(next_link=None): header_dict = None if raw: header_dict = {} - deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + deserialized = models.Operation1Paged(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_10_01/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_tags_operations.py index f8a10b2de303..d09aba576b75 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_tags_operations.py @@ -445,7 +445,7 @@ def update_at_scope( :param operation: The operation type for the patch API. Possible values include: 'Replace', 'Merge', 'Delete' :type operation: str or - ~azure.mgmt.resource.resources.v2019_10_01.models.enum + ~azure.mgmt.resource.resources.v2019_10_01.models.Operation :param properties: The set of tags. :type properties: ~azure.mgmt.resource.resources.v2019_10_01.models.Tags diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/__init__.py index d1187a85d8a5..8bb0151420ad 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/__init__.py @@ -39,7 +39,7 @@ from ._models_py3 import IdentityUserAssignedIdentitiesValue from ._models_py3 import OnErrorDeployment from ._models_py3 import OnErrorDeploymentExtended - from ._models_py3 import Operation + from ._models_py3 import Operation1 from ._models_py3 import OperationDisplay from ._models_py3 import ParametersLink from ._models_py3 import Plan @@ -101,7 +101,7 @@ from ._models import IdentityUserAssignedIdentitiesValue from ._models import OnErrorDeployment from ._models import OnErrorDeploymentExtended - from ._models import Operation + from ._models import Operation1 from ._models import OperationDisplay from ._models import ParametersLink from ._models import Plan @@ -136,7 +136,7 @@ from ._paged_models import DeploymentExtendedPaged from ._paged_models import DeploymentOperationPaged from ._paged_models import GenericResourceExpandedPaged -from ._paged_models import OperationPaged +from ._paged_models import Operation1Paged from ._paged_models import ProviderPaged from ._paged_models import ResourceGroupPaged from ._paged_models import TagDetailsPaged @@ -151,6 +151,7 @@ ProvisioningOperation, PropertyChangeType, ChangeType, + Operation, ) __all__ = [ @@ -183,7 +184,7 @@ 'IdentityUserAssignedIdentitiesValue', 'OnErrorDeployment', 'OnErrorDeploymentExtended', - 'Operation', + 'Operation1', 'OperationDisplay', 'ParametersLink', 'Plan', @@ -215,7 +216,7 @@ 'WhatIfChange', 'WhatIfOperationResult', 'WhatIfPropertyChange', - 'OperationPaged', + 'Operation1Paged', 'DeploymentExtendedPaged', 'ProviderPaged', 'GenericResourceExpandedPaged', @@ -232,4 +233,5 @@ 'ProvisioningOperation', 'PropertyChangeType', 'ChangeType', + 'Operation', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_models.py index f5bc323500d3..68f8c4203a6f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_models.py @@ -1193,7 +1193,7 @@ def __init__(self, **kwargs): self.deployment_name = kwargs.get('deployment_name', None) -class Operation(Model): +class Operation1(Model): """Microsoft.Resources operation. :param name: Operation name: {provider}/{resource}/{operation} @@ -1209,7 +1209,7 @@ class Operation(Model): } def __init__(self, **kwargs): - super(Operation, self).__init__(**kwargs) + super(Operation1, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -1823,7 +1823,7 @@ class TagsPatchResource(Model): :param operation: The operation type for the patch API. Possible values include: 'Replace', 'Merge', 'Delete' :type operation: str or - ~azure.mgmt.resource.resources.v2020_06_01.models.enum + ~azure.mgmt.resource.resources.v2020_06_01.models.Operation :param properties: The set of tags. :type properties: ~azure.mgmt.resource.resources.v2020_06_01.models.Tags """ diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_models_py3.py index 4dadfbc98c57..4e74c05c4615 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_models_py3.py @@ -1193,7 +1193,7 @@ def __init__(self, *, type=None, deployment_name: str=None, **kwargs) -> None: self.deployment_name = deployment_name -class Operation(Model): +class Operation1(Model): """Microsoft.Resources operation. :param name: Operation name: {provider}/{resource}/{operation} @@ -1209,7 +1209,7 @@ class Operation(Model): } def __init__(self, *, name: str=None, display=None, **kwargs) -> None: - super(Operation, self).__init__(**kwargs) + super(Operation1, self).__init__(**kwargs) self.name = name self.display = display @@ -1823,7 +1823,7 @@ class TagsPatchResource(Model): :param operation: The operation type for the patch API. Possible values include: 'Replace', 'Merge', 'Delete' :type operation: str or - ~azure.mgmt.resource.resources.v2020_06_01.models.enum + ~azure.mgmt.resource.resources.v2020_06_01.models.Operation :param properties: The set of tags. :type properties: ~azure.mgmt.resource.resources.v2020_06_01.models.Tags """ diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_paged_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_paged_models.py index 118699c72d0c..4ee1f2ffe238 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_paged_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_paged_models.py @@ -12,19 +12,19 @@ from msrest.paging import Paged -class OperationPaged(Paged): +class Operation1Paged(Paged): """ - A paging container for iterating over a list of :class:`Operation ` object + A paging container for iterating over a list of :class:`Operation1 ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Operation]'} + 'current_page': {'key': 'value', 'type': '[Operation1]'} } def __init__(self, *args, **kwargs): - super(OperationPaged, self).__init__(*args, **kwargs) + super(Operation1Paged, self).__init__(*args, **kwargs) class DeploymentExtendedPaged(Paged): """ A paging container for iterating over a list of :class:`DeploymentExtended ` object diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_resource_management_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_resource_management_client_enums.py index 136405ee316e..c0672c77b597 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_resource_management_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_resource_management_client_enums.py @@ -97,3 +97,10 @@ class ChangeType(str, Enum): deploy = "Deploy" #: The resource exists in the current state and the desired state and will be redeployed when the deployment is executed. The properties of the resource may or may not change. no_change = "NoChange" #: The resource exists in the current state and the desired state and will be redeployed when the deployment is executed. The properties of the resource will not change. modify = "Modify" #: The resource exists in the current state and the desired state and will be redeployed when the deployment is executed. The properties of the resource will change. + + +class Operation(str, Enum): + + replace = "Replace" #: The 'replace' option replaces the entire set of existing tags with a new set. + merge = "Merge" #: The 'merge' option allows adding tags with new names and updating the values of tags with existing names. + delete = "Delete" #: The 'delete' option allows selectively deleting tags based on given names or name/value pairs. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_operations.py index 48f8d85c59e7..bd86cfa20abe 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_operations.py @@ -48,9 +48,9 @@ def list( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: An iterator like instance of Operation + :return: An iterator like instance of Operation1 :rtype: - ~azure.mgmt.resource.resources.v2020_06_01.models.OperationPaged[~azure.mgmt.resource.resources.v2020_06_01.models.Operation] + ~azure.mgmt.resource.resources.v2020_06_01.models.Operation1Paged[~azure.mgmt.resource.resources.v2020_06_01.models.Operation1] :raises: :class:`CloudError` """ def prepare_request(next_link=None): @@ -96,7 +96,7 @@ def internal_paging(next_link=None): header_dict = None if raw: header_dict = {} - deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + deserialized = models.Operation1Paged(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/v2020_06_01/operations/_tags_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_tags_operations.py index e9b76966d8a9..714f37e36204 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_tags_operations.py @@ -445,7 +445,7 @@ def update_at_scope( :param operation: The operation type for the patch API. Possible values include: 'Replace', 'Merge', 'Delete' :type operation: str or - ~azure.mgmt.resource.resources.v2020_06_01.models.enum + ~azure.mgmt.resource.resources.v2020_06_01.models.Operation :param properties: The set of tags. :type properties: ~azure.mgmt.resource.resources.v2020_06_01.models.Tags diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_operations_mixin.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_operations_mixin.py new file mode 100644 index 000000000000..99c8bc4f6cc6 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_operations_mixin.py @@ -0,0 +1,57 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +from msrest import Serializer, Deserializer + + +class SubscriptionClientOperationsMixin(object): + + + def check_resource_name(self, name, type, custom_headers=None, raw=False, **operation_config): + """Checks resource name validity. + + A resource name is valid if it is not a reserved word, does not + contains a reserved word and does not start with a reserved word. + + :param name: Name of the resource + :type name: str + :param type: The type of the resource + :type type: 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: CheckResourceNameResult or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.subscriptions.v2019_11_01.models.CheckResourceNameResult + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + + """ + api_version = self._get_api_version('check_resource_name') + if api_version == '2016-06-01': + from .v2016_06_01.operations import SubscriptionClientOperationsMixin as OperationClass + elif api_version == '2018-06-01': + from .v2018_06_01.operations import SubscriptionClientOperationsMixin as OperationClass + elif api_version == '2019-06-01': + from .v2019_06_01.operations import SubscriptionClientOperationsMixin as OperationClass + elif api_version == '2019-11-01': + from .v2019_11_01.operations import SubscriptionClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance.config = self.config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + mixin_instance.api_version = api_version + return mixin_instance.check_resource_name(name, type, custom_headers, raw, **operation_config) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_subscription_client.py index f90f6f82107d..8c7404a66862 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_subscription_client.py @@ -15,10 +15,10 @@ from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin from ._configuration import SubscriptionClientConfiguration +from ._operations_mixin import SubscriptionClientOperationsMixin - -class SubscriptionClient(MultiApiClientMixin, SDKClient): +class SubscriptionClient(SubscriptionClientOperationsMixin, MultiApiClientMixin, SDKClient): """All resource groups and resources exist within subscriptions. These operation enable you get information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your organization. This ready contains multiple API versions, to help you deal with all Azure clouds diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_subscription_client.py index bd145dc5256e..67b519cc451f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_subscription_client.py @@ -13,13 +13,14 @@ from msrest import Serializer, Deserializer from ._configuration import SubscriptionClientConfiguration +from .operations import SubscriptionClientOperationsMixin from .operations import Operations from .operations import SubscriptionsOperations from .operations import TenantsOperations from . import models -class SubscriptionClient(SDKClient): +class SubscriptionClient(SubscriptionClientOperationsMixin, SDKClient): """All resource groups and resources exist within subscriptions. These operation enable you get information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your organization. :ivar config: Configuration for client. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/__init__.py index cd1fb5a0855e..14f260fd7b2d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/__init__.py @@ -10,16 +10,24 @@ # -------------------------------------------------------------------------- try: + from ._models_py3 import CheckResourceNameResult + from ._models_py3 import ErrorDefinition + from ._models_py3 import ErrorResponse, ErrorResponseException from ._models_py3 import Location from ._models_py3 import Operation from ._models_py3 import OperationDisplay + from ._models_py3 import ResourceName from ._models_py3 import Subscription from ._models_py3 import SubscriptionPolicies from ._models_py3 import TenantIdDescription except (SyntaxError, ImportError): + from ._models import CheckResourceNameResult + from ._models import ErrorDefinition + from ._models import ErrorResponse, ErrorResponseException from ._models import Location from ._models import Operation from ._models import OperationDisplay + from ._models import ResourceName from ._models import Subscription from ._models import SubscriptionPolicies from ._models import TenantIdDescription @@ -30,12 +38,17 @@ from ._subscription_client_enums import ( SubscriptionState, SpendingLimit, + ResourceNameStatus, ) __all__ = [ + 'CheckResourceNameResult', + 'ErrorDefinition', + 'ErrorResponse', 'ErrorResponseException', 'Location', 'Operation', 'OperationDisplay', + 'ResourceName', 'Subscription', 'SubscriptionPolicies', 'TenantIdDescription', @@ -45,4 +58,5 @@ 'TenantIdDescriptionPaged', 'SubscriptionState', 'SpendingLimit', + 'ResourceNameStatus', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_models.py index 125586e447e0..b8d05ff6a6ae 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_models.py @@ -10,6 +10,34 @@ # -------------------------------------------------------------------------- from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class CheckResourceNameResult(Model): + """Resource Name valid if not a reserved word, does not contain a reserved + word and does not start with a reserved word. + + :param name: Name of Resource + :type name: str + :param type: Type of Resource + :type type: str + :param status: Is the resource name Allowed or Reserved. Possible values + include: 'Allowed', 'Reserved' + :type status: str or + ~azure.mgmt.resource.subscriptions.v2016_06_01.models.ResourceNameStatus + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CheckResourceNameResult, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + self.status = kwargs.get('status', None) class CloudError(Model): @@ -20,6 +48,55 @@ class CloudError(Model): } +class ErrorDefinition(Model): + """Error description and code explaining why resource name is invalid. + + :param message: Description of the error. + :type message: str + :param code: Code of the error. + :type code: str + """ + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorDefinition, self).__init__(**kwargs) + self.message = kwargs.get('message', None) + self.code = kwargs.get('code', None) + + +class ErrorResponse(Model): + """Error response. + + :param error: The error details. + :type error: + ~azure.mgmt.resource.subscriptions.v2016_06_01.models.ErrorDefinition + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + class Location(Model): """Location information. @@ -119,6 +196,33 @@ def __init__(self, **kwargs): self.description = kwargs.get('description', None) +class ResourceName(Model): + """Name and Type of the Resource. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the resource + :type name: str + :param type: Required. The type of the resource + :type type: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ResourceName, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + + class Subscription(Model): """Subscription information. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_models_py3.py index 43c5a4f3d4fc..95c22f043074 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_models_py3.py @@ -10,6 +10,34 @@ # -------------------------------------------------------------------------- from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class CheckResourceNameResult(Model): + """Resource Name valid if not a reserved word, does not contain a reserved + word and does not start with a reserved word. + + :param name: Name of Resource + :type name: str + :param type: Type of Resource + :type type: str + :param status: Is the resource name Allowed or Reserved. Possible values + include: 'Allowed', 'Reserved' + :type status: str or + ~azure.mgmt.resource.subscriptions.v2016_06_01.models.ResourceNameStatus + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, type: str=None, status=None, **kwargs) -> None: + super(CheckResourceNameResult, self).__init__(**kwargs) + self.name = name + self.type = type + self.status = status class CloudError(Model): @@ -20,6 +48,55 @@ class CloudError(Model): } +class ErrorDefinition(Model): + """Error description and code explaining why resource name is invalid. + + :param message: Description of the error. + :type message: str + :param code: Code of the error. + :type code: str + """ + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + } + + def __init__(self, *, message: str=None, code: str=None, **kwargs) -> None: + super(ErrorDefinition, self).__init__(**kwargs) + self.message = message + self.code = code + + +class ErrorResponse(Model): + """Error response. + + :param error: The error details. + :type error: + ~azure.mgmt.resource.subscriptions.v2016_06_01.models.ErrorDefinition + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + class Location(Model): """Location information. @@ -119,6 +196,33 @@ def __init__(self, *, provider: str=None, resource: str=None, operation: str=Non self.description = description +class ResourceName(Model): + """Name and Type of the Resource. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the resource + :type name: str + :param type: Required. The type of the resource + :type type: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, *, name: str, type: str, **kwargs) -> None: + super(ResourceName, self).__init__(**kwargs) + self.name = name + self.type = type + + class Subscription(Model): """Subscription information. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_subscription_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_subscription_client_enums.py index bc846c09187b..ea538e008654 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_subscription_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_subscription_client_enums.py @@ -26,3 +26,9 @@ class SpendingLimit(str, Enum): on = "On" off = "Off" current_period_off = "CurrentPeriodOff" + + +class ResourceNameStatus(str, Enum): + + allowed = "Allowed" + reserved = "Reserved" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/__init__.py index 5b07794f3097..8234fde67600 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/__init__.py @@ -12,9 +12,11 @@ from ._operations import Operations from ._subscriptions_operations import SubscriptionsOperations from ._tenants_operations import TenantsOperations +from ._subscription_client_operations import SubscriptionClientOperationsMixin __all__ = [ 'Operations', 'SubscriptionsOperations', 'TenantsOperations', + 'SubscriptionClientOperationsMixin', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_subscription_client_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_subscription_client_operations.py new file mode 100644 index 000000000000..ad18c4ae12e9 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_subscription_client_operations.py @@ -0,0 +1,87 @@ +# 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.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from .. import models +import uuid + + +class SubscriptionClientOperationsMixin(object): + + def check_resource_name( + self, name, type, custom_headers=None, raw=False, **operation_config): + """Checks resource name validity. + + A resource name is valid if it is not a reserved word, does not + contains a reserved word and does not start with a reserved word. + + :param name: Name of the resource + :type name: str + :param type: The type of the resource + :type type: 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: CheckResourceNameResult or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.subscriptions.v2016_06_01.models.CheckResourceNameResult + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + resource_name_definition = None + if name is not None or type is not None: + resource_name_definition = models.ResourceName(name=name, type=type) + + # Construct URL + url = self.check_resource_name.metadata['url'] + + # 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 + if resource_name_definition is not None: + body_content = self._serialize.body(resource_name_definition, 'ResourceName') + else: + body_content = None + + # 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]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CheckResourceNameResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + check_resource_name.metadata = {'url': '/providers/Microsoft.Resources/checkResourceName'} diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_subscription_client.py index 056165548568..272c29685f46 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_subscription_client.py @@ -13,13 +13,14 @@ from msrest import Serializer, Deserializer from ._configuration import SubscriptionClientConfiguration +from .operations import SubscriptionClientOperationsMixin from .operations import Operations from .operations import SubscriptionsOperations from .operations import TenantsOperations from . import models -class SubscriptionClient(SDKClient): +class SubscriptionClient(SubscriptionClientOperationsMixin, SDKClient): """All resource groups and resources exist within subscriptions. These operation enable you get information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your organization. :ivar config: Configuration for client. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/__init__.py index cd1fb5a0855e..14f260fd7b2d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/__init__.py @@ -10,16 +10,24 @@ # -------------------------------------------------------------------------- try: + from ._models_py3 import CheckResourceNameResult + from ._models_py3 import ErrorDefinition + from ._models_py3 import ErrorResponse, ErrorResponseException from ._models_py3 import Location from ._models_py3 import Operation from ._models_py3 import OperationDisplay + from ._models_py3 import ResourceName from ._models_py3 import Subscription from ._models_py3 import SubscriptionPolicies from ._models_py3 import TenantIdDescription except (SyntaxError, ImportError): + from ._models import CheckResourceNameResult + from ._models import ErrorDefinition + from ._models import ErrorResponse, ErrorResponseException from ._models import Location from ._models import Operation from ._models import OperationDisplay + from ._models import ResourceName from ._models import Subscription from ._models import SubscriptionPolicies from ._models import TenantIdDescription @@ -30,12 +38,17 @@ from ._subscription_client_enums import ( SubscriptionState, SpendingLimit, + ResourceNameStatus, ) __all__ = [ + 'CheckResourceNameResult', + 'ErrorDefinition', + 'ErrorResponse', 'ErrorResponseException', 'Location', 'Operation', 'OperationDisplay', + 'ResourceName', 'Subscription', 'SubscriptionPolicies', 'TenantIdDescription', @@ -45,4 +58,5 @@ 'TenantIdDescriptionPaged', 'SubscriptionState', 'SpendingLimit', + 'ResourceNameStatus', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_models.py index 21ba7cc06de9..3102099ab413 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_models.py @@ -10,6 +10,34 @@ # -------------------------------------------------------------------------- from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class CheckResourceNameResult(Model): + """Resource Name valid if not a reserved word, does not contain a reserved + word and does not start with a reserved word. + + :param name: Name of Resource + :type name: str + :param type: Type of Resource + :type type: str + :param status: Is the resource name Allowed or Reserved. Possible values + include: 'Allowed', 'Reserved' + :type status: str or + ~azure.mgmt.resource.subscriptions.v2018_06_01.models.ResourceNameStatus + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CheckResourceNameResult, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + self.status = kwargs.get('status', None) class CloudError(Model): @@ -20,6 +48,55 @@ class CloudError(Model): } +class ErrorDefinition(Model): + """Error description and code explaining why resource name is invalid. + + :param message: Description of the error. + :type message: str + :param code: Code of the error. + :type code: str + """ + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorDefinition, self).__init__(**kwargs) + self.message = kwargs.get('message', None) + self.code = kwargs.get('code', None) + + +class ErrorResponse(Model): + """Error response. + + :param error: The error details. + :type error: + ~azure.mgmt.resource.subscriptions.v2018_06_01.models.ErrorDefinition + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + class Location(Model): """Location information. @@ -119,6 +196,33 @@ def __init__(self, **kwargs): self.description = kwargs.get('description', None) +class ResourceName(Model): + """Name and Type of the Resource. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the resource + :type name: str + :param type: Required. The type of the resource + :type type: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ResourceName, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + + class Subscription(Model): """Subscription information. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_models_py3.py index b18427d606cc..a08fa9a77cab 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_models_py3.py @@ -10,6 +10,34 @@ # -------------------------------------------------------------------------- from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class CheckResourceNameResult(Model): + """Resource Name valid if not a reserved word, does not contain a reserved + word and does not start with a reserved word. + + :param name: Name of Resource + :type name: str + :param type: Type of Resource + :type type: str + :param status: Is the resource name Allowed or Reserved. Possible values + include: 'Allowed', 'Reserved' + :type status: str or + ~azure.mgmt.resource.subscriptions.v2018_06_01.models.ResourceNameStatus + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, type: str=None, status=None, **kwargs) -> None: + super(CheckResourceNameResult, self).__init__(**kwargs) + self.name = name + self.type = type + self.status = status class CloudError(Model): @@ -20,6 +48,55 @@ class CloudError(Model): } +class ErrorDefinition(Model): + """Error description and code explaining why resource name is invalid. + + :param message: Description of the error. + :type message: str + :param code: Code of the error. + :type code: str + """ + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + } + + def __init__(self, *, message: str=None, code: str=None, **kwargs) -> None: + super(ErrorDefinition, self).__init__(**kwargs) + self.message = message + self.code = code + + +class ErrorResponse(Model): + """Error response. + + :param error: The error details. + :type error: + ~azure.mgmt.resource.subscriptions.v2018_06_01.models.ErrorDefinition + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + class Location(Model): """Location information. @@ -119,6 +196,33 @@ def __init__(self, *, provider: str=None, resource: str=None, operation: str=Non self.description = description +class ResourceName(Model): + """Name and Type of the Resource. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the resource + :type name: str + :param type: Required. The type of the resource + :type type: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, *, name: str, type: str, **kwargs) -> None: + super(ResourceName, self).__init__(**kwargs) + self.name = name + self.type = type + + class Subscription(Model): """Subscription information. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_subscription_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_subscription_client_enums.py index bc846c09187b..ea538e008654 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_subscription_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_subscription_client_enums.py @@ -26,3 +26,9 @@ class SpendingLimit(str, Enum): on = "On" off = "Off" current_period_off = "CurrentPeriodOff" + + +class ResourceNameStatus(str, Enum): + + allowed = "Allowed" + reserved = "Reserved" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/__init__.py index 5b07794f3097..8234fde67600 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/__init__.py @@ -12,9 +12,11 @@ from ._operations import Operations from ._subscriptions_operations import SubscriptionsOperations from ._tenants_operations import TenantsOperations +from ._subscription_client_operations import SubscriptionClientOperationsMixin __all__ = [ 'Operations', 'SubscriptionsOperations', 'TenantsOperations', + 'SubscriptionClientOperationsMixin', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_subscription_client_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_subscription_client_operations.py new file mode 100644 index 000000000000..eab11744c875 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_subscription_client_operations.py @@ -0,0 +1,87 @@ +# 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.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from .. import models +import uuid + + +class SubscriptionClientOperationsMixin(object): + + def check_resource_name( + self, name, type, custom_headers=None, raw=False, **operation_config): + """Checks resource name validity. + + A resource name is valid if it is not a reserved word, does not + contains a reserved word and does not start with a reserved word. + + :param name: Name of the resource + :type name: str + :param type: The type of the resource + :type type: 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: CheckResourceNameResult or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.subscriptions.v2018_06_01.models.CheckResourceNameResult + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + resource_name_definition = None + if name is not None or type is not None: + resource_name_definition = models.ResourceName(name=name, type=type) + + # Construct URL + url = self.check_resource_name.metadata['url'] + + # 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 + if resource_name_definition is not None: + body_content = self._serialize.body(resource_name_definition, 'ResourceName') + else: + body_content = None + + # 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]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CheckResourceNameResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + check_resource_name.metadata = {'url': '/providers/Microsoft.Resources/checkResourceName'} diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_subscription_client.py index 9bcc5e0e0053..3f38cd94824a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_subscription_client.py @@ -13,13 +13,14 @@ from msrest import Serializer, Deserializer from ._configuration import SubscriptionClientConfiguration +from .operations import SubscriptionClientOperationsMixin from .operations import Operations from .operations import SubscriptionsOperations from .operations import TenantsOperations from . import models -class SubscriptionClient(SDKClient): +class SubscriptionClient(SubscriptionClientOperationsMixin, SDKClient): """All resource groups and resources exist within subscriptions. These operation enable you get information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your organization. :ivar config: Configuration for client. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/__init__.py index d7233118a968..afcd020781ba 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/__init__.py @@ -10,18 +10,26 @@ # -------------------------------------------------------------------------- try: + from ._models_py3 import CheckResourceNameResult + from ._models_py3 import ErrorDefinition + from ._models_py3 import ErrorResponse, ErrorResponseException from ._models_py3 import Location from ._models_py3 import ManagedByTenant from ._models_py3 import Operation from ._models_py3 import OperationDisplay + from ._models_py3 import ResourceName from ._models_py3 import Subscription from ._models_py3 import SubscriptionPolicies from ._models_py3 import TenantIdDescription except (SyntaxError, ImportError): + from ._models import CheckResourceNameResult + from ._models import ErrorDefinition + from ._models import ErrorResponse, ErrorResponseException from ._models import Location from ._models import ManagedByTenant from ._models import Operation from ._models import OperationDisplay + from ._models import ResourceName from ._models import Subscription from ._models import SubscriptionPolicies from ._models import TenantIdDescription @@ -33,13 +41,18 @@ SubscriptionState, SpendingLimit, TenantCategory, + ResourceNameStatus, ) __all__ = [ + 'CheckResourceNameResult', + 'ErrorDefinition', + 'ErrorResponse', 'ErrorResponseException', 'Location', 'ManagedByTenant', 'Operation', 'OperationDisplay', + 'ResourceName', 'Subscription', 'SubscriptionPolicies', 'TenantIdDescription', @@ -50,4 +63,5 @@ 'SubscriptionState', 'SpendingLimit', 'TenantCategory', + 'ResourceNameStatus', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_models.py index 8d63331e9684..4ca19de3b0ad 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_models.py @@ -10,6 +10,34 @@ # -------------------------------------------------------------------------- from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class CheckResourceNameResult(Model): + """Resource Name valid if not a reserved word, does not contain a reserved + word and does not start with a reserved word. + + :param name: Name of Resource + :type name: str + :param type: Type of Resource + :type type: str + :param status: Is the resource name Allowed or Reserved. Possible values + include: 'Allowed', 'Reserved' + :type status: str or + ~azure.mgmt.resource.subscriptions.v2019_06_01.models.ResourceNameStatus + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CheckResourceNameResult, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + self.status = kwargs.get('status', None) class CloudError(Model): @@ -20,6 +48,55 @@ class CloudError(Model): } +class ErrorDefinition(Model): + """Error description and code explaining why resource name is invalid. + + :param message: Description of the error. + :type message: str + :param code: Code of the error. + :type code: str + """ + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorDefinition, self).__init__(**kwargs) + self.message = kwargs.get('message', None) + self.code = kwargs.get('code', None) + + +class ErrorResponse(Model): + """Error response. + + :param error: The error details. + :type error: + ~azure.mgmt.resource.subscriptions.v2019_06_01.models.ErrorDefinition + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + class Location(Model): """Location information. @@ -142,6 +219,33 @@ def __init__(self, **kwargs): self.description = kwargs.get('description', None) +class ResourceName(Model): + """Name and Type of the Resource. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the resource + :type name: str + :param type: Required. The type of the resource + :type type: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ResourceName, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + + class Subscription(Model): """Subscription information. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_models_py3.py index fa15df1e87e3..7538b90f316a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_models_py3.py @@ -10,6 +10,34 @@ # -------------------------------------------------------------------------- from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class CheckResourceNameResult(Model): + """Resource Name valid if not a reserved word, does not contain a reserved + word and does not start with a reserved word. + + :param name: Name of Resource + :type name: str + :param type: Type of Resource + :type type: str + :param status: Is the resource name Allowed or Reserved. Possible values + include: 'Allowed', 'Reserved' + :type status: str or + ~azure.mgmt.resource.subscriptions.v2019_06_01.models.ResourceNameStatus + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, type: str=None, status=None, **kwargs) -> None: + super(CheckResourceNameResult, self).__init__(**kwargs) + self.name = name + self.type = type + self.status = status class CloudError(Model): @@ -20,6 +48,55 @@ class CloudError(Model): } +class ErrorDefinition(Model): + """Error description and code explaining why resource name is invalid. + + :param message: Description of the error. + :type message: str + :param code: Code of the error. + :type code: str + """ + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + } + + def __init__(self, *, message: str=None, code: str=None, **kwargs) -> None: + super(ErrorDefinition, self).__init__(**kwargs) + self.message = message + self.code = code + + +class ErrorResponse(Model): + """Error response. + + :param error: The error details. + :type error: + ~azure.mgmt.resource.subscriptions.v2019_06_01.models.ErrorDefinition + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + class Location(Model): """Location information. @@ -142,6 +219,33 @@ def __init__(self, *, provider: str=None, resource: str=None, operation: str=Non self.description = description +class ResourceName(Model): + """Name and Type of the Resource. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the resource + :type name: str + :param type: Required. The type of the resource + :type type: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, *, name: str, type: str, **kwargs) -> None: + super(ResourceName, self).__init__(**kwargs) + self.name = name + self.type = type + + class Subscription(Model): """Subscription information. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_subscription_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_subscription_client_enums.py index 7def5956d33d..6ddda0c955cc 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_subscription_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_subscription_client_enums.py @@ -33,3 +33,9 @@ class TenantCategory(str, Enum): home = "Home" projected_by = "ProjectedBy" managed_by = "ManagedBy" + + +class ResourceNameStatus(str, Enum): + + allowed = "Allowed" + reserved = "Reserved" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/__init__.py index 5b07794f3097..8234fde67600 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/__init__.py @@ -12,9 +12,11 @@ from ._operations import Operations from ._subscriptions_operations import SubscriptionsOperations from ._tenants_operations import TenantsOperations +from ._subscription_client_operations import SubscriptionClientOperationsMixin __all__ = [ 'Operations', 'SubscriptionsOperations', 'TenantsOperations', + 'SubscriptionClientOperationsMixin', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_subscription_client_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_subscription_client_operations.py new file mode 100644 index 000000000000..8c49b5cfab42 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_subscription_client_operations.py @@ -0,0 +1,87 @@ +# 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.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from .. import models +import uuid + + +class SubscriptionClientOperationsMixin(object): + + def check_resource_name( + self, name, type, custom_headers=None, raw=False, **operation_config): + """Checks resource name validity. + + A resource name is valid if it is not a reserved word, does not + contains a reserved word and does not start with a reserved word. + + :param name: Name of the resource + :type name: str + :param type: The type of the resource + :type type: 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: CheckResourceNameResult or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.subscriptions.v2019_06_01.models.CheckResourceNameResult + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + resource_name_definition = None + if name is not None or type is not None: + resource_name_definition = models.ResourceName(name=name, type=type) + + # Construct URL + url = self.check_resource_name.metadata['url'] + + # 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 + if resource_name_definition is not None: + body_content = self._serialize.body(resource_name_definition, 'ResourceName') + else: + body_content = None + + # 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]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CheckResourceNameResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + check_resource_name.metadata = {'url': '/providers/Microsoft.Resources/checkResourceName'} diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_subscription_client.py index 7b2d8ff052cc..f87bedaed755 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_subscription_client.py @@ -13,13 +13,14 @@ from msrest import Serializer, Deserializer from ._configuration import SubscriptionClientConfiguration +from .operations import SubscriptionClientOperationsMixin from .operations import Operations from .operations import SubscriptionsOperations from .operations import TenantsOperations from . import models -class SubscriptionClient(SDKClient): +class SubscriptionClient(SubscriptionClientOperationsMixin, SDKClient): """All resource groups and resources exist within subscriptions. These operation enable you get information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your organization. :ivar config: Configuration for client. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/__init__.py index ccb68724c045..8beb258ce249 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/__init__.py @@ -10,22 +10,30 @@ # -------------------------------------------------------------------------- try: + from ._models_py3 import CheckResourceNameResult + from ._models_py3 import ErrorDefinition + from ._models_py3 import ErrorResponse, ErrorResponseException from ._models_py3 import Location from ._models_py3 import LocationMetadata from ._models_py3 import ManagedByTenant from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import PairedRegion + from ._models_py3 import ResourceName from ._models_py3 import Subscription from ._models_py3 import SubscriptionPolicies from ._models_py3 import TenantIdDescription except (SyntaxError, ImportError): + from ._models import CheckResourceNameResult + from ._models import ErrorDefinition + from ._models import ErrorResponse, ErrorResponseException from ._models import Location from ._models import LocationMetadata from ._models import ManagedByTenant from ._models import Operation from ._models import OperationDisplay from ._models import PairedRegion + from ._models import ResourceName from ._models import Subscription from ._models import SubscriptionPolicies from ._models import TenantIdDescription @@ -39,15 +47,20 @@ SubscriptionState, SpendingLimit, TenantCategory, + ResourceNameStatus, ) __all__ = [ + 'CheckResourceNameResult', + 'ErrorDefinition', + 'ErrorResponse', 'ErrorResponseException', 'Location', 'LocationMetadata', 'ManagedByTenant', 'Operation', 'OperationDisplay', 'PairedRegion', + 'ResourceName', 'Subscription', 'SubscriptionPolicies', 'TenantIdDescription', @@ -60,4 +73,5 @@ 'SubscriptionState', 'SpendingLimit', 'TenantCategory', + 'ResourceNameStatus', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models.py index ce8cef294927..e43bb64a8b02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models.py @@ -10,6 +10,34 @@ # -------------------------------------------------------------------------- from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class CheckResourceNameResult(Model): + """Resource Name valid if not a reserved word, does not contain a reserved + word and does not start with a reserved word. + + :param name: Name of Resource + :type name: str + :param type: Type of Resource + :type type: str + :param status: Is the resource name Allowed or Reserved. Possible values + include: 'Allowed', 'Reserved' + :type status: str or + ~azure.mgmt.resource.subscriptions.v2019_11_01.models.ResourceNameStatus + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CheckResourceNameResult, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + self.status = kwargs.get('status', None) class CloudError(Model): @@ -20,6 +48,55 @@ class CloudError(Model): } +class ErrorDefinition(Model): + """Error description and code explaining why resource name is invalid. + + :param message: Description of the error. + :type message: str + :param code: Code of the error. + :type code: str + """ + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ErrorDefinition, self).__init__(**kwargs) + self.message = kwargs.get('message', None) + self.code = kwargs.get('code', None) + + +class ErrorResponse(Model): + """Error response. + + :param error: The error details. + :type error: + ~azure.mgmt.resource.subscriptions.v2019_11_01.models.ErrorDefinition + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + class Location(Model): """Location information. @@ -235,6 +312,33 @@ def __init__(self, **kwargs): self.subscription_id = None +class ResourceName(Model): + """Name and Type of the Resource. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the resource + :type name: str + :param type: Required. The type of the resource + :type type: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ResourceName, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + + class Subscription(Model): """Subscription information. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models_py3.py index b8c47711b3b9..a346acdc33e5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models_py3.py @@ -10,6 +10,34 @@ # -------------------------------------------------------------------------- from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class CheckResourceNameResult(Model): + """Resource Name valid if not a reserved word, does not contain a reserved + word and does not start with a reserved word. + + :param name: Name of Resource + :type name: str + :param type: Type of Resource + :type type: str + :param status: Is the resource name Allowed or Reserved. Possible values + include: 'Allowed', 'Reserved' + :type status: str or + ~azure.mgmt.resource.subscriptions.v2019_11_01.models.ResourceNameStatus + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, type: str=None, status=None, **kwargs) -> None: + super(CheckResourceNameResult, self).__init__(**kwargs) + self.name = name + self.type = type + self.status = status class CloudError(Model): @@ -20,6 +48,55 @@ class CloudError(Model): } +class ErrorDefinition(Model): + """Error description and code explaining why resource name is invalid. + + :param message: Description of the error. + :type message: str + :param code: Code of the error. + :type code: str + """ + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + } + + def __init__(self, *, message: str=None, code: str=None, **kwargs) -> None: + super(ErrorDefinition, self).__init__(**kwargs) + self.message = message + self.code = code + + +class ErrorResponse(Model): + """Error response. + + :param error: The error details. + :type error: + ~azure.mgmt.resource.subscriptions.v2019_11_01.models.ErrorDefinition + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDefinition'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + class Location(Model): """Location information. @@ -235,6 +312,33 @@ def __init__(self, **kwargs) -> None: self.subscription_id = None +class ResourceName(Model): + """Name and Type of the Resource. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the resource + :type name: str + :param type: Required. The type of the resource + :type type: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, *, name: str, type: str, **kwargs) -> None: + super(ResourceName, self).__init__(**kwargs) + self.name = name + self.type = type + + class Subscription(Model): """Subscription information. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_subscription_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_subscription_client_enums.py index 3fee1db7fd51..5f3614211502 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_subscription_client_enums.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_subscription_client_enums.py @@ -45,3 +45,9 @@ class TenantCategory(str, Enum): home = "Home" projected_by = "ProjectedBy" managed_by = "ManagedBy" + + +class ResourceNameStatus(str, Enum): + + allowed = "Allowed" + reserved = "Reserved" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/__init__.py index 5b07794f3097..8234fde67600 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/__init__.py @@ -12,9 +12,11 @@ from ._operations import Operations from ._subscriptions_operations import SubscriptionsOperations from ._tenants_operations import TenantsOperations +from ._subscription_client_operations import SubscriptionClientOperationsMixin __all__ = [ 'Operations', 'SubscriptionsOperations', 'TenantsOperations', + 'SubscriptionClientOperationsMixin', ] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_subscription_client_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_subscription_client_operations.py new file mode 100644 index 000000000000..34c264b3d098 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_subscription_client_operations.py @@ -0,0 +1,87 @@ +# 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.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from .. import models +import uuid + + +class SubscriptionClientOperationsMixin(object): + + def check_resource_name( + self, name, type, custom_headers=None, raw=False, **operation_config): + """Checks resource name validity. + + A resource name is valid if it is not a reserved word, does not + contains a reserved word and does not start with a reserved word. + + :param name: Name of the resource + :type name: str + :param type: The type of the resource + :type type: 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: CheckResourceNameResult or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.subscriptions.v2019_11_01.models.CheckResourceNameResult + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + resource_name_definition = None + if name is not None or type is not None: + resource_name_definition = models.ResourceName(name=name, type=type) + + # Construct URL + url = self.check_resource_name.metadata['url'] + + # 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 + if resource_name_definition is not None: + body_content = self._serialize.body(resource_name_definition, 'ResourceName') + else: + body_content = None + + # 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]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CheckResourceNameResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + check_resource_name.metadata = {'url': '/providers/Microsoft.Resources/checkResourceName'} diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/_template_specs_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/_template_specs_client.py index f15f8582fb6f..2bda5d6e32ee 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/_template_specs_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/_template_specs_client.py @@ -72,9 +72,13 @@ def _models_dict(cls, api_version): def models(cls, api_version=DEFAULT_API_VERSION): """Module depends on the API version: + * 2019-06-01-preview: :mod:`v2019_06_01_preview.models` * 2019-06-01-preview: :mod:`v2019_06_preview.models` """ if api_version == '2019-06-01-preview': + from .v2019_06_01_preview import models + return models + elif api_version == '2019-06-01-preview': from .v2019_06_preview import models return models raise NotImplementedError("APIVersion {} is not available".format(api_version)) @@ -83,10 +87,13 @@ def models(cls, api_version=DEFAULT_API_VERSION): def template_spec_versions(self): """Instance depends on the API version: + * 2019-06-01-preview: :class:`TemplateSpecVersionsOperations` * 2019-06-01-preview: :class:`TemplateSpecVersionsOperations` """ api_version = self._get_api_version('template_spec_versions') if api_version == '2019-06-01-preview': + from .v2019_06_01_preview.operations import TemplateSpecVersionsOperations as OperationClass + elif api_version == '2019-06-01-preview': from .v2019_06_preview.operations import TemplateSpecVersionsOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) @@ -96,10 +103,13 @@ def template_spec_versions(self): def template_specs(self): """Instance depends on the API version: + * 2019-06-01-preview: :class:`TemplateSpecsOperations` * 2019-06-01-preview: :class:`TemplateSpecsOperations` """ api_version = self._get_api_version('template_specs') if api_version == '2019-06-01-preview': + from .v2019_06_01_preview.operations import TemplateSpecsOperations as OperationClass + elif api_version == '2019-06-01-preview': from .v2019_06_preview.operations import TemplateSpecsOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/__init__.py new file mode 100644 index 000000000000..d2ef69b9f8ab --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/__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 TemplateSpecsClientConfiguration +from ._template_specs_client import TemplateSpecsClient +__all__ = ['TemplateSpecsClient', 'TemplateSpecsClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_configuration.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_configuration.py new file mode 100644 index 000000000000..ef8679ee0fec --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_configuration.py @@ -0,0 +1,49 @@ +# 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 TemplateSpecsClientConfiguration(AzureConfiguration): + """Configuration for TemplateSpecsClient + 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: Subscription Id which forms part of the URI for + every service call. + :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(TemplateSpecsClientConfiguration, 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/templatespecs/v2019_06_01_preview/_template_specs_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_template_specs_client.py new file mode 100644 index 000000000000..a965aa37b02b --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_template_specs_client.py @@ -0,0 +1,55 @@ +# 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 TemplateSpecsClientConfiguration +from .operations import TemplateSpecsOperations +from .operations import TemplateSpecVersionsOperations +from . import models + + +class TemplateSpecsClient(SDKClient): + """The APIs listed in this specification can be used to manage Template Spec resources through the Azure Resource Manager. + + :ivar config: Configuration for client. + :vartype config: TemplateSpecsClientConfiguration + + :ivar template_specs: TemplateSpecs operations + :vartype template_specs: azure.mgmt.resource.templatespecs.v2019_06_01_preview.operations.TemplateSpecsOperations + :ivar template_spec_versions: TemplateSpecVersions operations + :vartype template_spec_versions: azure.mgmt.resource.templatespecs.v2019_06_01_preview.operations.TemplateSpecVersionsOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Subscription Id which forms part of the URI for + every service call. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = TemplateSpecsClientConfiguration(credentials, subscription_id, base_url) + super(TemplateSpecsClient, 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-06-01-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.template_specs = TemplateSpecsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.template_spec_versions = TemplateSpecVersionsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/__init__.py new file mode 100644 index 000000000000..75de92f1cbad --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/__init__.py @@ -0,0 +1,57 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import AzureResourceBase + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorResponse + from ._models_py3 import SystemData + from ._models_py3 import TemplateSpec + from ._models_py3 import TemplateSpecArtifact + from ._models_py3 import TemplateSpecsError, TemplateSpecsErrorException + from ._models_py3 import TemplateSpecTemplateArtifact + from ._models_py3 import TemplateSpecUpdateModel + from ._models_py3 import TemplateSpecVersion + from ._models_py3 import TemplateSpecVersionUpdateModel +except (SyntaxError, ImportError): + from ._models import AzureResourceBase + from ._models import ErrorAdditionalInfo + from ._models import ErrorResponse + from ._models import SystemData + from ._models import TemplateSpec + from ._models import TemplateSpecArtifact + from ._models import TemplateSpecsError, TemplateSpecsErrorException + from ._models import TemplateSpecTemplateArtifact + from ._models import TemplateSpecUpdateModel + from ._models import TemplateSpecVersion + from ._models import TemplateSpecVersionUpdateModel +from ._paged_models import TemplateSpecPaged +from ._paged_models import TemplateSpecVersionPaged +from ._template_specs_client_enums import ( + CreatedByType, +) + +__all__ = [ + 'AzureResourceBase', + 'ErrorAdditionalInfo', + 'ErrorResponse', + 'SystemData', + 'TemplateSpec', + 'TemplateSpecArtifact', + 'TemplateSpecsError', 'TemplateSpecsErrorException', + 'TemplateSpecTemplateArtifact', + 'TemplateSpecUpdateModel', + 'TemplateSpecVersion', + 'TemplateSpecVersionUpdateModel', + 'TemplateSpecPaged', + 'TemplateSpecVersionPaged', + 'CreatedByType', +] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_models.py new file mode 100644 index 000000000000..d6e1e5494000 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_models.py @@ -0,0 +1,473 @@ +# 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 AzureResourceBase(Model): + """Common properties for all Azure resources. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy + and modifiedBy information. + :vartype system_data: + ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__(self, **kwargs): + super(AzureResourceBase, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +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.templatespecs.v2019_06_01_preview.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class SystemData(Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. + Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + :type created_by_type: str or + ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the + resource. Possible values include: 'User', 'Application', + 'ManagedIdentity', 'Key' + :type last_modified_by_type: str or + ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.CreatedByType + :param last_modified_at: The type of identity that last modified the + resource. + :type last_modified_at: datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) + + +class TemplateSpec(AzureResourceBase): + """Template Spec object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy + and modifiedBy information. + :vartype system_data: + ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.SystemData + :param location: Required. The location of the Template Spec. It cannot be + changed after Template Spec creation. It must be one of the supported + Azure locations. + :type location: str + :param description: Template Spec description. + :type description: str + :param display_name: Template Spec display name. + :type display_name: str + :param tags: Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'description': {'max_length': 4096}, + 'display_name': {'max_length': 64}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'location': {'key': 'location', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(TemplateSpec, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.description = kwargs.get('description', None) + self.display_name = kwargs.get('display_name', None) + self.tags = kwargs.get('tags', None) + + +class TemplateSpecArtifact(Model): + """Represents a Template Spec artifact. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: TemplateSpecTemplateArtifact + + All required parameters must be populated in order to send to Azure. + + :param path: Required. A filesystem safe relative path of the artifact. + :type path: str + :param kind: Required. Constant filled by server. + :type kind: str + """ + + _validation = { + 'path': {'required': True}, + 'kind': {'required': True}, + } + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + _subtype_map = { + 'kind': {'template': 'TemplateSpecTemplateArtifact'} + } + + def __init__(self, **kwargs): + super(TemplateSpecArtifact, self).__init__(**kwargs) + self.path = kwargs.get('path', None) + self.kind = None + + +class TemplateSpecsError(Model): + """Template Specs error response. + + :param error: + :type error: + ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.ErrorResponse + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__(self, **kwargs): + super(TemplateSpecsError, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class TemplateSpecsErrorException(HttpOperationError): + """Server responsed with exception of type: 'TemplateSpecsError'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(TemplateSpecsErrorException, self).__init__(deserialize, response, 'TemplateSpecsError', *args) + + +class TemplateSpecTemplateArtifact(TemplateSpecArtifact): + """Represents a Template Spec artifact containing an embedded Azure Resource + Manager template. + + All required parameters must be populated in order to send to Azure. + + :param path: Required. A filesystem safe relative path of the artifact. + :type path: str + :param kind: Required. Constant filled by server. + :type kind: str + :param template: Required. The Azure Resource Manager template. + :type template: object + """ + + _validation = { + 'path': {'required': True}, + 'kind': {'required': True}, + 'template': {'required': True}, + } + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'template': {'key': 'template', 'type': 'object'}, + } + + def __init__(self, **kwargs): + super(TemplateSpecTemplateArtifact, self).__init__(**kwargs) + self.template = kwargs.get('template', None) + self.kind = 'template' + + +class TemplateSpecUpdateModel(AzureResourceBase): + """Template Spec properties to be updated (only tags are currently supported). + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy + and modifiedBy information. + :vartype system_data: + ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.SystemData + :param tags: Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(TemplateSpecUpdateModel, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class TemplateSpecVersion(AzureResourceBase): + """Template Spec Version object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy + and modifiedBy information. + :vartype system_data: + ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.SystemData + :param location: Required. The location of the Template Spec Version. It + must match the location of the parent Template Spec. + :type location: str + :param artifacts: An array of Template Spec artifacts. + :type artifacts: + list[~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecArtifact] + :param description: Template Spec version description. + :type description: str + :param template: The Azure Resource Manager template content. + :type template: object + :param tags: Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'description': {'max_length': 4096}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'location': {'key': 'location', 'type': 'str'}, + 'artifacts': {'key': 'properties.artifacts', 'type': '[TemplateSpecArtifact]'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'template': {'key': 'properties.template', 'type': 'object'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(TemplateSpecVersion, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.artifacts = kwargs.get('artifacts', None) + self.description = kwargs.get('description', None) + self.template = kwargs.get('template', None) + self.tags = kwargs.get('tags', None) + + +class TemplateSpecVersionUpdateModel(AzureResourceBase): + """Template Spec Version properties to be updated (only tags are currently + supported). + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy + and modifiedBy information. + :vartype system_data: + ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.SystemData + :param tags: Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(TemplateSpecVersionUpdateModel, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_models_py3.py new file mode 100644 index 000000000000..81d384b1c289 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_models_py3.py @@ -0,0 +1,473 @@ +# 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 AzureResourceBase(Model): + """Common properties for all Azure resources. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy + and modifiedBy information. + :vartype system_data: + ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__(self, **kwargs) -> None: + super(AzureResourceBase, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class CloudError(Model): + """CloudError. + """ + + _attribute_map = { + } + + +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.templatespecs.v2019_06_01_preview.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponse]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__(self, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class SystemData(Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. + Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + :type created_by_type: str or + ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the + resource. Possible values include: 'User', 'Application', + 'ManagedIdentity', 'Key' + :type last_modified_by_type: str or + ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.CreatedByType + :param last_modified_at: The type of identity that last modified the + resource. + :type last_modified_at: datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__(self, *, created_by: str=None, created_by_type=None, created_at=None, last_modified_by: str=None, last_modified_by_type=None, last_modified_at=None, **kwargs) -> None: + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class TemplateSpec(AzureResourceBase): + """Template Spec object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy + and modifiedBy information. + :vartype system_data: + ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.SystemData + :param location: Required. The location of the Template Spec. It cannot be + changed after Template Spec creation. It must be one of the supported + Azure locations. + :type location: str + :param description: Template Spec description. + :type description: str + :param display_name: Template Spec display name. + :type display_name: str + :param tags: Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'description': {'max_length': 4096}, + 'display_name': {'max_length': 64}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'location': {'key': 'location', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, location: str, description: str=None, display_name: str=None, tags=None, **kwargs) -> None: + super(TemplateSpec, self).__init__(**kwargs) + self.location = location + self.description = description + self.display_name = display_name + self.tags = tags + + +class TemplateSpecArtifact(Model): + """Represents a Template Spec artifact. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: TemplateSpecTemplateArtifact + + All required parameters must be populated in order to send to Azure. + + :param path: Required. A filesystem safe relative path of the artifact. + :type path: str + :param kind: Required. Constant filled by server. + :type kind: str + """ + + _validation = { + 'path': {'required': True}, + 'kind': {'required': True}, + } + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + _subtype_map = { + 'kind': {'template': 'TemplateSpecTemplateArtifact'} + } + + def __init__(self, *, path: str, **kwargs) -> None: + super(TemplateSpecArtifact, self).__init__(**kwargs) + self.path = path + self.kind = None + + +class TemplateSpecsError(Model): + """Template Specs error response. + + :param error: + :type error: + ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.ErrorResponse + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(TemplateSpecsError, self).__init__(**kwargs) + self.error = error + + +class TemplateSpecsErrorException(HttpOperationError): + """Server responsed with exception of type: 'TemplateSpecsError'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(TemplateSpecsErrorException, self).__init__(deserialize, response, 'TemplateSpecsError', *args) + + +class TemplateSpecTemplateArtifact(TemplateSpecArtifact): + """Represents a Template Spec artifact containing an embedded Azure Resource + Manager template. + + All required parameters must be populated in order to send to Azure. + + :param path: Required. A filesystem safe relative path of the artifact. + :type path: str + :param kind: Required. Constant filled by server. + :type kind: str + :param template: Required. The Azure Resource Manager template. + :type template: object + """ + + _validation = { + 'path': {'required': True}, + 'kind': {'required': True}, + 'template': {'required': True}, + } + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'template': {'key': 'template', 'type': 'object'}, + } + + def __init__(self, *, path: str, template, **kwargs) -> None: + super(TemplateSpecTemplateArtifact, self).__init__(path=path, **kwargs) + self.template = template + self.kind = 'template' + + +class TemplateSpecUpdateModel(AzureResourceBase): + """Template Spec properties to be updated (only tags are currently supported). + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy + and modifiedBy information. + :vartype system_data: + ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.SystemData + :param tags: Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, tags=None, **kwargs) -> None: + super(TemplateSpecUpdateModel, self).__init__(**kwargs) + self.tags = tags + + +class TemplateSpecVersion(AzureResourceBase): + """Template Spec Version object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy + and modifiedBy information. + :vartype system_data: + ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.SystemData + :param location: Required. The location of the Template Spec Version. It + must match the location of the parent Template Spec. + :type location: str + :param artifacts: An array of Template Spec artifacts. + :type artifacts: + list[~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecArtifact] + :param description: Template Spec version description. + :type description: str + :param template: The Azure Resource Manager template content. + :type template: object + :param tags: Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'description': {'max_length': 4096}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'location': {'key': 'location', 'type': 'str'}, + 'artifacts': {'key': 'properties.artifacts', 'type': '[TemplateSpecArtifact]'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'template': {'key': 'properties.template', 'type': 'object'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, location: str, artifacts=None, description: str=None, template=None, tags=None, **kwargs) -> None: + super(TemplateSpecVersion, self).__init__(**kwargs) + self.location = location + self.artifacts = artifacts + self.description = description + self.template = template + self.tags = tags + + +class TemplateSpecVersionUpdateModel(AzureResourceBase): + """Template Spec Version properties to be updated (only tags are currently + supported). + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: String Id used to locate any resource on Azure. + :vartype id: str + :ivar name: Name of this resource. + :vartype name: str + :ivar type: Type of this resource. + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy + and modifiedBy information. + :vartype system_data: + ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.SystemData + :param tags: Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, tags=None, **kwargs) -> None: + super(TemplateSpecVersionUpdateModel, self).__init__(**kwargs) + self.tags = tags diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_paged_models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_paged_models.py new file mode 100644 index 000000000000..d0b16217f29b --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_paged_models.py @@ -0,0 +1,40 @@ +# 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 TemplateSpecPaged(Paged): + """ + A paging container for iterating over a list of :class:`TemplateSpec ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[TemplateSpec]'} + } + + def __init__(self, *args, **kwargs): + + super(TemplateSpecPaged, self).__init__(*args, **kwargs) +class TemplateSpecVersionPaged(Paged): + """ + A paging container for iterating over a list of :class:`TemplateSpecVersion ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[TemplateSpecVersion]'} + } + + def __init__(self, *args, **kwargs): + + super(TemplateSpecVersionPaged, self).__init__(*args, **kwargs) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_template_specs_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_template_specs_client_enums.py new file mode 100644 index 000000000000..68ab94e64947 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/models/_template_specs_client_enums.py @@ -0,0 +1,20 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum + + +class CreatedByType(str, Enum): + + user = "User" + application = "Application" + managed_identity = "ManagedIdentity" + key = "Key" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/operations/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/operations/__init__.py new file mode 100644 index 000000000000..46ffcf9773bb --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/operations/__init__.py @@ -0,0 +1,18 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._template_specs_operations import TemplateSpecsOperations +from ._template_spec_versions_operations import TemplateSpecVersionsOperations + +__all__ = [ + 'TemplateSpecsOperations', + 'TemplateSpecVersionsOperations', +] diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/operations/_template_spec_versions_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/operations/_template_spec_versions_operations.py new file mode 100644 index 000000000000..090ffd24356b --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/operations/_template_spec_versions_operations.py @@ -0,0 +1,386 @@ +# 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 .. import models + + +class TemplateSpecVersionsOperations(object): + """TemplateSpecVersionsOperations 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: Client Api version. Constant value: "2019-06-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-06-01-preview" + + self.config = config + + def create_or_update( + self, resource_group_name, template_spec_name, template_spec_version, template_spec_version_model, custom_headers=None, raw=False, **operation_config): + """Creates or updates a Template Spec version. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param template_spec_name: Name of the Template Spec. + :type template_spec_name: str + :param template_spec_version: The version of the Template Spec. + :type template_spec_version: str + :param template_spec_version_model: Template Spec Version supplied to + the operation. + :type template_spec_version_model: + ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecVersion + :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: TemplateSpecVersion or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecVersion + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`TemplateSpecsErrorException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'templateSpecName': self._serialize.url("template_spec_name", template_spec_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'templateSpecVersion': self._serialize.url("template_spec_version", template_spec_version, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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(template_spec_version_model, 'TemplateSpecVersion') + + # 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]: + raise models.TemplateSpecsErrorException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('TemplateSpecVersion', response) + if response.status_code == 201: + deserialized = self._deserialize('TemplateSpecVersion', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName}/versions/{templateSpecVersion}'} + + def update( + self, resource_group_name, template_spec_name, template_spec_version, tags=None, custom_headers=None, raw=False, **operation_config): + """Updates Template Spec Version tags with specified values. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param template_spec_name: Name of the Template Spec. + :type template_spec_name: str + :param template_spec_version: The version of the Template Spec. + :type template_spec_version: str + :param tags: Resource tags. + :type tags: dict[str, 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: TemplateSpecVersion or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecVersion + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`TemplateSpecsErrorException` + """ + template_spec_version_update_model = None + if tags is not None: + template_spec_version_update_model = models.TemplateSpecVersionUpdateModel(tags=tags) + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'templateSpecName': self._serialize.url("template_spec_name", template_spec_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'templateSpecVersion': self._serialize.url("template_spec_version", template_spec_version, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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 + if template_spec_version_update_model is not None: + body_content = self._serialize.body(template_spec_version_update_model, 'TemplateSpecVersionUpdateModel') + else: + body_content = None + + # 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]: + raise models.TemplateSpecsErrorException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('TemplateSpecVersion', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName}/versions/{templateSpecVersion}'} + + def get( + self, resource_group_name, template_spec_name, template_spec_version, custom_headers=None, raw=False, **operation_config): + """Gets a Template Spec version from a specific Template Spec. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param template_spec_name: Name of the Template Spec. + :type template_spec_name: str + :param template_spec_version: The version of the Template Spec. + :type template_spec_version: str + :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: TemplateSpecVersion or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecVersion + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`TemplateSpecsErrorException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'templateSpecName': self._serialize.url("template_spec_name", template_spec_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'templateSpecVersion': self._serialize.url("template_spec_version", template_spec_version, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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]: + raise models.TemplateSpecsErrorException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('TemplateSpecVersion', 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/templateSpecs/{templateSpecName}/versions/{templateSpecVersion}'} + + def delete( + self, resource_group_name, template_spec_name, template_spec_version, custom_headers=None, raw=False, **operation_config): + """Deletes a specific version from a Template Spec. When operation + completes, status code 200 returned without content. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param template_spec_name: Name of the Template Spec. + :type template_spec_name: str + :param template_spec_version: The version of the Template Spec. + :type template_spec_version: str + :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:`TemplateSpecsErrorException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'templateSpecName': self._serialize.url("template_spec_name", template_spec_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'templateSpecVersion': self._serialize.url("template_spec_version", template_spec_version, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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]: + raise models.TemplateSpecsErrorException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName}/versions/{templateSpecVersion}'} + + def list( + self, resource_group_name, template_spec_name, custom_headers=None, raw=False, **operation_config): + """Lists all the Template Spec versions in the specified Template Spec. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param template_spec_name: Name of the Template Spec. + :type template_spec_name: str + :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 TemplateSpecVersion + :rtype: + ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecVersionPaged[~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecVersion] + :raises: + :class:`TemplateSpecsErrorException` + """ + 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'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'templateSpecName': self._serialize.url("template_spec_name", template_spec_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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]: + raise models.TemplateSpecsErrorException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.TemplateSpecVersionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName}/versions'} diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/operations/_template_specs_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/operations/_template_specs_operations.py new file mode 100644 index 000000000000..4b93ee7fafde --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/operations/_template_specs_operations.py @@ -0,0 +1,435 @@ +# 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 .. import models + + +class TemplateSpecsOperations(object): + """TemplateSpecsOperations 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: Client Api version. Constant value: "2019-06-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-06-01-preview" + + self.config = config + + def create_or_update( + self, resource_group_name, template_spec_name, template_spec, custom_headers=None, raw=False, **operation_config): + """Creates or updates a Template Spec. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param template_spec_name: Name of the Template Spec. + :type template_spec_name: str + :param template_spec: Template Spec supplied to the operation. + :type template_spec: + ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpec + :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: TemplateSpec or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpec + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`TemplateSpecsErrorException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'templateSpecName': self._serialize.url("template_spec_name", template_spec_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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(template_spec, 'TemplateSpec') + + # 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]: + raise models.TemplateSpecsErrorException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('TemplateSpec', response) + if response.status_code == 201: + deserialized = self._deserialize('TemplateSpec', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName}'} + + def update( + self, resource_group_name, template_spec_name, tags=None, custom_headers=None, raw=False, **operation_config): + """Updates Template Spec tags with specified values. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param template_spec_name: Name of the Template Spec. + :type template_spec_name: str + :param tags: Resource tags. + :type tags: dict[str, 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: TemplateSpec or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpec + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`TemplateSpecsErrorException` + """ + template_spec = None + if tags is not None: + template_spec = models.TemplateSpecUpdateModel(tags=tags) + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'templateSpecName': self._serialize.url("template_spec_name", template_spec_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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 + if template_spec is not None: + body_content = self._serialize.body(template_spec, 'TemplateSpecUpdateModel') + else: + body_content = None + + # 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]: + raise models.TemplateSpecsErrorException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('TemplateSpec', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName}'} + + def get( + self, resource_group_name, template_spec_name, custom_headers=None, raw=False, **operation_config): + """Gets a Template Spec with a given name. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param template_spec_name: Name of the Template Spec. + :type template_spec_name: str + :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: TemplateSpec or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpec + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`TemplateSpecsErrorException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'templateSpecName': self._serialize.url("template_spec_name", template_spec_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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]: + raise models.TemplateSpecsErrorException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('TemplateSpec', 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/templateSpecs/{templateSpecName}'} + + def delete( + self, resource_group_name, template_spec_name, custom_headers=None, raw=False, **operation_config): + """Deletes a Template Spec by name. When operation completes, status code + 200 returned without content. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param template_spec_name: Name of the Template Spec. + :type template_spec_name: str + :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:`TemplateSpecsErrorException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'templateSpecName': self._serialize.url("template_spec_name", template_spec_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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]: + raise models.TemplateSpecsErrorException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName}'} + + def list_by_subscription( + self, custom_headers=None, raw=False, **operation_config): + """Lists all the Template Specs within the specified subscriptions. + + :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 TemplateSpec + :rtype: + ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecPaged[~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpec] + :raises: + :class:`TemplateSpecsErrorException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.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]: + raise models.TemplateSpecsErrorException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.TemplateSpecPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Resources/templateSpecs/'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Lists all the Template Specs within the specified resource group. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :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 TemplateSpec + :rtype: + ~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpecPaged[~azure.mgmt.resource.templatespecs.v2019_06_01_preview.models.TemplateSpec] + :raises: + :class:`TemplateSpecsErrorException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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]: + raise models.TemplateSpecsErrorException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.TemplateSpecPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/'} diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/version.py new file mode 100644 index 000000000000..15a0084e7417 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/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-06-01-preview" +