From 3004a79c579fe257efea1d77c84778430ba90eca Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Fri, 2 Oct 2020 19:20:29 +0000 Subject: [PATCH] Generated from 2174f01d50fead9cd9fe3fa9d193714217c9ce4a --- .../azure-mgmt-subscription/README.md | 30 +- .../mgmt/subscription/_subscription_client.py | 10 +- .../mgmt/subscription/models/__init__.py | 39 +- .../azure/mgmt/subscription/models/_models.py | 346 +++++++++--------- .../mgmt/subscription/models/_models_py3.py | 346 +++++++++--------- .../models/_subscription_client_enums.py | 13 +- .../mgmt/subscription/operations/__init__.py | 4 +- .../operations/_alias_operations.py | 294 +++++++++++++++ .../subscription/operations/_operations.py | 4 +- .../_subscription_operation_operations.py | 104 ------ .../operations/_subscription_operations.py | 346 +----------------- 11 files changed, 712 insertions(+), 824 deletions(-) create mode 100644 sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_alias_operations.py delete mode 100644 sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_subscription_operation_operations.py diff --git a/sdk/subscription/azure-mgmt-subscription/README.md b/sdk/subscription/azure-mgmt-subscription/README.md index df35c72d26b9..5f3e0514b162 100644 --- a/sdk/subscription/azure-mgmt-subscription/README.md +++ b/sdk/subscription/azure-mgmt-subscription/README.md @@ -1,29 +1,21 @@ -## Microsoft Azure SDK for Python +# Microsoft Azure SDK for Python This is the Microsoft Azure Subscription Management Client Library. +This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). -Azure Resource Manager (ARM) is the next generation of management APIs -that replace the old Azure Service Management (ASM). -This package has been tested with Python 2.7, 3.5, 3.6 and 3.7. +# Usage -For the older Azure Service Management (ASM) libraries, see -[azure-servicemanagement-legacy](https://pypi.python.org/pypi/azure-servicemanagement-legacy) -library. +For code examples, see [Subscription Management](https://docs.microsoft.com/python/api/overview/azure/) +on docs.microsoft.com. -For a more complete set of Azure libraries, see the -[azure sdk python release](https://aka.ms/azsdk/python/all). -## Usage +# Provide Feedback -For code examples, see [Subscription -Management](https://docs.microsoft.com/python/api/overview/azure/) on -docs.microsoft.com. - -## Provide Feedback - -If you encounter any bugs or have suggestions, please file an issue in -the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) section of the project. -![image](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-subscription%2FREADME.png) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-subscription%2FREADME.png) diff --git a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/_subscription_client.py b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/_subscription_client.py index 0615d2183607..50368efac6d7 100644 --- a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/_subscription_client.py +++ b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/_subscription_client.py @@ -16,8 +16,8 @@ from .operations import SubscriptionsOperations from .operations import TenantsOperations from .operations import SubscriptionOperations -from .operations import SubscriptionOperationOperations from .operations import Operations +from .operations import AliasOperations from . import models @@ -33,10 +33,10 @@ class SubscriptionClient(SDKClient): :vartype tenants: azure.mgmt.subscription.operations.TenantsOperations :ivar subscription: Subscription operations :vartype subscription: azure.mgmt.subscription.operations.SubscriptionOperations - :ivar subscription_operation: SubscriptionOperation operations - :vartype subscription_operation: azure.mgmt.subscription.operations.SubscriptionOperationOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.subscription.operations.Operations + :ivar alias: Alias operations + :vartype alias: azure.mgmt.subscription.operations.AliasOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -60,7 +60,7 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.subscription = SubscriptionOperations( self._client, self.config, self._serialize, self._deserialize) - self.subscription_operation = SubscriptionOperationOperations( - self._client, self.config, self._serialize, self._deserialize) self.operations = Operations( self._client, self.config, self._serialize, self._deserialize) + self.alias = AliasOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/models/__init__.py b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/models/__init__.py index c73fdff6ab0b..4f8adac0970e 100644 --- a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/models/__init__.py +++ b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/models/__init__.py @@ -10,38 +10,40 @@ # -------------------------------------------------------------------------- try: - from ._models_py3 import AdPrincipal from ._models_py3 import CanceledSubscriptionId from ._models_py3 import EnabledSubscriptionId from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import ErrorResponseBody, ErrorResponseBodyException from ._models_py3 import Location - from ._models_py3 import ModernCspSubscriptionCreationParameters - from ._models_py3 import ModernSubscriptionCreationParameters from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import OperationListResult + from ._models_py3 import PutAliasListResult + from ._models_py3 import PutAliasRequest + from ._models_py3 import PutAliasRequestProperties + from ._models_py3 import PutAliasResponse + from ._models_py3 import PutAliasResponseProperties from ._models_py3 import RenamedSubscriptionId from ._models_py3 import Subscription - from ._models_py3 import SubscriptionCreationParameters - from ._models_py3 import SubscriptionCreationResult from ._models_py3 import SubscriptionName from ._models_py3 import SubscriptionPolicies from ._models_py3 import TenantIdDescription except (SyntaxError, ImportError): - from ._models import AdPrincipal from ._models import CanceledSubscriptionId from ._models import EnabledSubscriptionId from ._models import ErrorResponse, ErrorResponseException + from ._models import ErrorResponseBody, ErrorResponseBodyException from ._models import Location - from ._models import ModernCspSubscriptionCreationParameters - from ._models import ModernSubscriptionCreationParameters from ._models import Operation from ._models import OperationDisplay from ._models import OperationListResult + from ._models import PutAliasListResult + from ._models import PutAliasRequest + from ._models import PutAliasRequestProperties + from ._models import PutAliasResponse + from ._models import PutAliasResponseProperties from ._models import RenamedSubscriptionId from ._models import Subscription - from ._models import SubscriptionCreationParameters - from ._models import SubscriptionCreationResult from ._models import SubscriptionName from ._models import SubscriptionPolicies from ._models import TenantIdDescription @@ -51,24 +53,26 @@ from ._subscription_client_enums import ( SubscriptionState, SpendingLimit, - OfferType, + Workload, + ProvisioningState, ) __all__ = [ - 'AdPrincipal', 'CanceledSubscriptionId', 'EnabledSubscriptionId', 'ErrorResponse', 'ErrorResponseException', + 'ErrorResponseBody', 'ErrorResponseBodyException', 'Location', - 'ModernCspSubscriptionCreationParameters', - 'ModernSubscriptionCreationParameters', 'Operation', 'OperationDisplay', 'OperationListResult', + 'PutAliasListResult', + 'PutAliasRequest', + 'PutAliasRequestProperties', + 'PutAliasResponse', + 'PutAliasResponseProperties', 'RenamedSubscriptionId', 'Subscription', - 'SubscriptionCreationParameters', - 'SubscriptionCreationResult', 'SubscriptionName', 'SubscriptionPolicies', 'TenantIdDescription', @@ -77,5 +81,6 @@ 'TenantIdDescriptionPaged', 'SubscriptionState', 'SpendingLimit', - 'OfferType', + 'Workload', + 'ProvisioningState', ] diff --git a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/models/_models.py b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/models/_models.py index 594b69a9d206..645cc9679266 100644 --- a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/models/_models.py +++ b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/models/_models.py @@ -13,28 +13,6 @@ from msrest.exceptions import HttpOperationError -class AdPrincipal(Model): - """Active Directory Principal who’ll get owner access on the new subscription. - - All required parameters must be populated in order to send to Azure. - - :param object_id: Required. Object id of the Principal - :type object_id: str - """ - - _validation = { - 'object_id': {'required': True}, - } - - _attribute_map = { - 'object_id': {'key': 'objectId', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(AdPrincipal, self).__init__(**kwargs) - self.object_id = kwargs.get('object_id', None) - - class CanceledSubscriptionId(Model): """The ID of the canceled subscription. @@ -121,6 +99,35 @@ def __init__(self, deserialize, response, *args): super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) +class ErrorResponseBody(Model): + """Error response indicates that the service is not able to process the + incoming request. The reason is provided in the error message. + + :param error: The details of the error. + :type error: ~azure.mgmt.subscription.models.ErrorResponse + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__(self, **kwargs): + super(ErrorResponseBody, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorResponseBodyException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponseBody'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseBodyException, self).__init__(deserialize, response, 'ErrorResponseBody', *args) + + class Location(Model): """Location information. @@ -170,91 +177,6 @@ def __init__(self, **kwargs): self.longitude = None -class ModernCspSubscriptionCreationParameters(Model): - """The parameters required to create a new CSP subscription. - - All required parameters must be populated in order to send to Azure. - - :param display_name: Required. The friendly name of the subscription. - :type display_name: str - :param sku_id: Required. The SKU ID of the Azure plan. Azure plan - determines the pricing and service-level agreement of the subscription. - Use 001 for Microsoft Azure Plan and 002 for Microsoft Azure Plan for - DevTest. - :type sku_id: str - :param reseller_id: Reseller ID, basically MPN Id. - :type reseller_id: str - """ - - _validation = { - 'display_name': {'required': True}, - 'sku_id': {'required': True}, - } - - _attribute_map = { - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'sku_id': {'key': 'skuId', 'type': 'str'}, - 'reseller_id': {'key': 'resellerId', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(ModernCspSubscriptionCreationParameters, self).__init__(**kwargs) - self.display_name = kwargs.get('display_name', None) - self.sku_id = kwargs.get('sku_id', None) - self.reseller_id = kwargs.get('reseller_id', None) - - -class ModernSubscriptionCreationParameters(Model): - """The parameters required to create a new subscription. - - All required parameters must be populated in order to send to Azure. - - :param display_name: Required. The friendly name of the subscription. - :type display_name: str - :param sku_id: Required. The SKU ID of the Azure plan. Azure plan - determines the pricing and service-level agreement of the subscription. - Use 001 for Microsoft Azure Plan and 002 for Microsoft Azure Plan for - DevTest. - :type sku_id: str - :param cost_center: If set, the cost center will show up on the Azure - usage and charges file. - :type cost_center: str - :param owner: If specified, the AD principal will get owner access to the - subscription, along with the user who is performing the create - subscription operation - :type owner: ~azure.mgmt.subscription.models.AdPrincipal - :param management_group_id: The identifier of the management group to - which this subscription will be associated. - :type management_group_id: str - :param additional_parameters: Additional, untyped parameters to support - custom subscription creation scenarios. - :type additional_parameters: dict[str, object] - """ - - _validation = { - 'display_name': {'required': True}, - 'sku_id': {'required': True}, - } - - _attribute_map = { - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'sku_id': {'key': 'skuId', 'type': 'str'}, - 'cost_center': {'key': 'costCenter', 'type': 'str'}, - 'owner': {'key': 'owner', 'type': 'AdPrincipal'}, - 'management_group_id': {'key': 'managementGroupId', 'type': 'str'}, - 'additional_parameters': {'key': 'additionalParameters', 'type': '{object}'}, - } - - def __init__(self, **kwargs): - super(ModernSubscriptionCreationParameters, self).__init__(**kwargs) - self.display_name = kwargs.get('display_name', None) - self.sku_id = kwargs.get('sku_id', None) - self.cost_center = kwargs.get('cost_center', None) - self.owner = kwargs.get('owner', None) - self.management_group_id = kwargs.get('management_group_id', None) - self.additional_parameters = kwargs.get('additional_parameters', None) - - class Operation(Model): """REST API operation. @@ -322,6 +244,159 @@ def __init__(self, **kwargs): self.next_link = kwargs.get('next_link', None) +class PutAliasListResult(Model): + """The list of aliases. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of alias. + :vartype value: list[~azure.mgmt.subscription.models.PutAliasResponse] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PutAliasResponse]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PutAliasListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class PutAliasRequest(Model): + """The parameters required to create a new subscription. + + All required parameters must be populated in order to send to Azure. + + :param properties: Required. Put alias request properties. + :type properties: + ~azure.mgmt.subscription.models.PutAliasRequestProperties + """ + + _validation = { + 'properties': {'required': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'PutAliasRequestProperties'}, + } + + def __init__(self, **kwargs): + super(PutAliasRequest, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class PutAliasRequestProperties(Model): + """Put subscription properties. + + :param display_name: The friendly name of the subscription. + :type display_name: str + :param workload: The workload type of the subscription. It can be either + Production or DevTest. Possible values include: 'Production', 'DevTest' + :type workload: str or ~azure.mgmt.subscription.models.Workload + :param billing_scope: Determines whether subscription is fieldLed, + partnerLed or LegacyEA + :type billing_scope: str + :param subscription_id: This parameter can be used to create alias for + existing subscription Id + :type subscription_id: str + :param reseller_id: Reseller ID, basically MPN Id + :type reseller_id: str + """ + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'workload': {'key': 'workload', 'type': 'str'}, + 'billing_scope': {'key': 'billingScope', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'reseller_id': {'key': 'resellerId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PutAliasRequestProperties, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + self.workload = kwargs.get('workload', None) + self.billing_scope = kwargs.get('billing_scope', None) + self.subscription_id = kwargs.get('subscription_id', None) + self.reseller_id = kwargs.get('reseller_id', None) + + +class PutAliasResponse(Model): + """Subscription Information with the alias. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified ID for the alias resource. + :vartype id: str + :ivar name: Alias ID. + :vartype name: str + :ivar type: Resource type, Microsoft.Subscription/aliases. + :vartype type: str + :param properties: Put Alias response properties. + :type properties: + ~azure.mgmt.subscription.models.PutAliasResponseProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'PutAliasResponseProperties'}, + } + + def __init__(self, **kwargs): + super(PutAliasResponse, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = kwargs.get('properties', None) + + +class PutAliasResponseProperties(Model): + """Put subscription creation result properties. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar subscription_id: Newly created subscription Id. + :vartype subscription_id: str + :param provisioning_state: The provisioning state of the resource. + Possible values include: 'Accepted', 'Succeeded', 'Failed' + :type provisioning_state: str or + ~azure.mgmt.subscription.models.ProvisioningState + """ + + _validation = { + 'subscription_id': {'readonly': True}, + } + + _attribute_map = { + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PutAliasResponseProperties, self).__init__(**kwargs) + self.subscription_id = None + self.provisioning_state = kwargs.get('provisioning_state', None) + + class RenamedSubscriptionId(Model): """The ID of the subscriptions that is being renamed. @@ -397,63 +472,6 @@ def __init__(self, **kwargs): self.authorization_source = kwargs.get('authorization_source', None) -class SubscriptionCreationParameters(Model): - """Subscription Creation Parameters required to create a new Azure - subscription. - - :param display_name: The display name of the subscription. - :type display_name: str - :param management_group_id: The Management Group Id. - :type management_group_id: str - :param owners: The list of principals that should be granted Owner access - on the subscription. Principals should be of type User, Service Principal - or Security Group. - :type owners: list[~azure.mgmt.subscription.models.AdPrincipal] - :param offer_type: The offer type of the subscription. For example, - MS-AZR-0017P (EnterpriseAgreement) and MS-AZR-0148P (EnterpriseAgreement - devTest) are available. Only valid when creating a subscription in a - enrollment account scope. Possible values include: 'MS-AZR-0017P', - 'MS-AZR-0148P' - :type offer_type: str or ~azure.mgmt.subscription.models.OfferType - :param additional_parameters: Additional, untyped parameters to support - custom subscription creation scenarios. - :type additional_parameters: dict[str, object] - """ - - _attribute_map = { - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'management_group_id': {'key': 'managementGroupId', 'type': 'str'}, - 'owners': {'key': 'owners', 'type': '[AdPrincipal]'}, - 'offer_type': {'key': 'offerType', 'type': 'str'}, - 'additional_parameters': {'key': 'additionalParameters', 'type': '{object}'}, - } - - def __init__(self, **kwargs): - super(SubscriptionCreationParameters, self).__init__(**kwargs) - self.display_name = kwargs.get('display_name', None) - self.management_group_id = kwargs.get('management_group_id', None) - self.owners = kwargs.get('owners', None) - self.offer_type = kwargs.get('offer_type', None) - self.additional_parameters = kwargs.get('additional_parameters', None) - - -class SubscriptionCreationResult(Model): - """The created subscription object. - - :param subscription_link: The link to the new subscription. Use this link - to check the status of subscription creation operation. - :type subscription_link: str - """ - - _attribute_map = { - 'subscription_link': {'key': 'subscriptionLink', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(SubscriptionCreationResult, self).__init__(**kwargs) - self.subscription_link = kwargs.get('subscription_link', None) - - class SubscriptionName(Model): """The new name of the subscription. diff --git a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/models/_models_py3.py b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/models/_models_py3.py index 8292c0a157de..6eb2c1fbf44a 100644 --- a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/models/_models_py3.py +++ b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/models/_models_py3.py @@ -13,28 +13,6 @@ from msrest.exceptions import HttpOperationError -class AdPrincipal(Model): - """Active Directory Principal who’ll get owner access on the new subscription. - - All required parameters must be populated in order to send to Azure. - - :param object_id: Required. Object id of the Principal - :type object_id: str - """ - - _validation = { - 'object_id': {'required': True}, - } - - _attribute_map = { - 'object_id': {'key': 'objectId', 'type': 'str'}, - } - - def __init__(self, *, object_id: str, **kwargs) -> None: - super(AdPrincipal, self).__init__(**kwargs) - self.object_id = object_id - - class CanceledSubscriptionId(Model): """The ID of the canceled subscription. @@ -121,6 +99,35 @@ def __init__(self, deserialize, response, *args): super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) +class ErrorResponseBody(Model): + """Error response indicates that the service is not able to process the + incoming request. The reason is provided in the error message. + + :param error: The details of the error. + :type error: ~azure.mgmt.subscription.models.ErrorResponse + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponse'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(ErrorResponseBody, self).__init__(**kwargs) + self.error = error + + +class ErrorResponseBodyException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponseBody'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseBodyException, self).__init__(deserialize, response, 'ErrorResponseBody', *args) + + class Location(Model): """Location information. @@ -170,91 +177,6 @@ def __init__(self, **kwargs) -> None: self.longitude = None -class ModernCspSubscriptionCreationParameters(Model): - """The parameters required to create a new CSP subscription. - - All required parameters must be populated in order to send to Azure. - - :param display_name: Required. The friendly name of the subscription. - :type display_name: str - :param sku_id: Required. The SKU ID of the Azure plan. Azure plan - determines the pricing and service-level agreement of the subscription. - Use 001 for Microsoft Azure Plan and 002 for Microsoft Azure Plan for - DevTest. - :type sku_id: str - :param reseller_id: Reseller ID, basically MPN Id. - :type reseller_id: str - """ - - _validation = { - 'display_name': {'required': True}, - 'sku_id': {'required': True}, - } - - _attribute_map = { - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'sku_id': {'key': 'skuId', 'type': 'str'}, - 'reseller_id': {'key': 'resellerId', 'type': 'str'}, - } - - def __init__(self, *, display_name: str, sku_id: str, reseller_id: str=None, **kwargs) -> None: - super(ModernCspSubscriptionCreationParameters, self).__init__(**kwargs) - self.display_name = display_name - self.sku_id = sku_id - self.reseller_id = reseller_id - - -class ModernSubscriptionCreationParameters(Model): - """The parameters required to create a new subscription. - - All required parameters must be populated in order to send to Azure. - - :param display_name: Required. The friendly name of the subscription. - :type display_name: str - :param sku_id: Required. The SKU ID of the Azure plan. Azure plan - determines the pricing and service-level agreement of the subscription. - Use 001 for Microsoft Azure Plan and 002 for Microsoft Azure Plan for - DevTest. - :type sku_id: str - :param cost_center: If set, the cost center will show up on the Azure - usage and charges file. - :type cost_center: str - :param owner: If specified, the AD principal will get owner access to the - subscription, along with the user who is performing the create - subscription operation - :type owner: ~azure.mgmt.subscription.models.AdPrincipal - :param management_group_id: The identifier of the management group to - which this subscription will be associated. - :type management_group_id: str - :param additional_parameters: Additional, untyped parameters to support - custom subscription creation scenarios. - :type additional_parameters: dict[str, object] - """ - - _validation = { - 'display_name': {'required': True}, - 'sku_id': {'required': True}, - } - - _attribute_map = { - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'sku_id': {'key': 'skuId', 'type': 'str'}, - 'cost_center': {'key': 'costCenter', 'type': 'str'}, - 'owner': {'key': 'owner', 'type': 'AdPrincipal'}, - 'management_group_id': {'key': 'managementGroupId', 'type': 'str'}, - 'additional_parameters': {'key': 'additionalParameters', 'type': '{object}'}, - } - - def __init__(self, *, display_name: str, sku_id: str, cost_center: str=None, owner=None, management_group_id: str=None, additional_parameters=None, **kwargs) -> None: - super(ModernSubscriptionCreationParameters, self).__init__(**kwargs) - self.display_name = display_name - self.sku_id = sku_id - self.cost_center = cost_center - self.owner = owner - self.management_group_id = management_group_id - self.additional_parameters = additional_parameters - - class Operation(Model): """REST API operation. @@ -322,6 +244,159 @@ def __init__(self, *, value=None, next_link: str=None, **kwargs) -> None: self.next_link = next_link +class PutAliasListResult(Model): + """The list of aliases. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: The list of alias. + :vartype value: list[~azure.mgmt.subscription.models.PutAliasResponse] + :ivar next_link: The link (url) to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PutAliasResponse]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(PutAliasListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class PutAliasRequest(Model): + """The parameters required to create a new subscription. + + All required parameters must be populated in order to send to Azure. + + :param properties: Required. Put alias request properties. + :type properties: + ~azure.mgmt.subscription.models.PutAliasRequestProperties + """ + + _validation = { + 'properties': {'required': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'PutAliasRequestProperties'}, + } + + def __init__(self, *, properties, **kwargs) -> None: + super(PutAliasRequest, self).__init__(**kwargs) + self.properties = properties + + +class PutAliasRequestProperties(Model): + """Put subscription properties. + + :param display_name: The friendly name of the subscription. + :type display_name: str + :param workload: The workload type of the subscription. It can be either + Production or DevTest. Possible values include: 'Production', 'DevTest' + :type workload: str or ~azure.mgmt.subscription.models.Workload + :param billing_scope: Determines whether subscription is fieldLed, + partnerLed or LegacyEA + :type billing_scope: str + :param subscription_id: This parameter can be used to create alias for + existing subscription Id + :type subscription_id: str + :param reseller_id: Reseller ID, basically MPN Id + :type reseller_id: str + """ + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'workload': {'key': 'workload', 'type': 'str'}, + 'billing_scope': {'key': 'billingScope', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'reseller_id': {'key': 'resellerId', 'type': 'str'}, + } + + def __init__(self, *, display_name: str=None, workload=None, billing_scope: str=None, subscription_id: str=None, reseller_id: str=None, **kwargs) -> None: + super(PutAliasRequestProperties, self).__init__(**kwargs) + self.display_name = display_name + self.workload = workload + self.billing_scope = billing_scope + self.subscription_id = subscription_id + self.reseller_id = reseller_id + + +class PutAliasResponse(Model): + """Subscription Information with the alias. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified ID for the alias resource. + :vartype id: str + :ivar name: Alias ID. + :vartype name: str + :ivar type: Resource type, Microsoft.Subscription/aliases. + :vartype type: str + :param properties: Put Alias response properties. + :type properties: + ~azure.mgmt.subscription.models.PutAliasResponseProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'PutAliasResponseProperties'}, + } + + def __init__(self, *, properties=None, **kwargs) -> None: + super(PutAliasResponse, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = properties + + +class PutAliasResponseProperties(Model): + """Put subscription creation result properties. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar subscription_id: Newly created subscription Id. + :vartype subscription_id: str + :param provisioning_state: The provisioning state of the resource. + Possible values include: 'Accepted', 'Succeeded', 'Failed' + :type provisioning_state: str or + ~azure.mgmt.subscription.models.ProvisioningState + """ + + _validation = { + 'subscription_id': {'readonly': True}, + } + + _attribute_map = { + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__(self, *, provisioning_state=None, **kwargs) -> None: + super(PutAliasResponseProperties, self).__init__(**kwargs) + self.subscription_id = None + self.provisioning_state = provisioning_state + + class RenamedSubscriptionId(Model): """The ID of the subscriptions that is being renamed. @@ -397,63 +472,6 @@ def __init__(self, *, subscription_policies=None, authorization_source: str=None self.authorization_source = authorization_source -class SubscriptionCreationParameters(Model): - """Subscription Creation Parameters required to create a new Azure - subscription. - - :param display_name: The display name of the subscription. - :type display_name: str - :param management_group_id: The Management Group Id. - :type management_group_id: str - :param owners: The list of principals that should be granted Owner access - on the subscription. Principals should be of type User, Service Principal - or Security Group. - :type owners: list[~azure.mgmt.subscription.models.AdPrincipal] - :param offer_type: The offer type of the subscription. For example, - MS-AZR-0017P (EnterpriseAgreement) and MS-AZR-0148P (EnterpriseAgreement - devTest) are available. Only valid when creating a subscription in a - enrollment account scope. Possible values include: 'MS-AZR-0017P', - 'MS-AZR-0148P' - :type offer_type: str or ~azure.mgmt.subscription.models.OfferType - :param additional_parameters: Additional, untyped parameters to support - custom subscription creation scenarios. - :type additional_parameters: dict[str, object] - """ - - _attribute_map = { - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'management_group_id': {'key': 'managementGroupId', 'type': 'str'}, - 'owners': {'key': 'owners', 'type': '[AdPrincipal]'}, - 'offer_type': {'key': 'offerType', 'type': 'str'}, - 'additional_parameters': {'key': 'additionalParameters', 'type': '{object}'}, - } - - def __init__(self, *, display_name: str=None, management_group_id: str=None, owners=None, offer_type=None, additional_parameters=None, **kwargs) -> None: - super(SubscriptionCreationParameters, self).__init__(**kwargs) - self.display_name = display_name - self.management_group_id = management_group_id - self.owners = owners - self.offer_type = offer_type - self.additional_parameters = additional_parameters - - -class SubscriptionCreationResult(Model): - """The created subscription object. - - :param subscription_link: The link to the new subscription. Use this link - to check the status of subscription creation operation. - :type subscription_link: str - """ - - _attribute_map = { - 'subscription_link': {'key': 'subscriptionLink', 'type': 'str'}, - } - - def __init__(self, *, subscription_link: str=None, **kwargs) -> None: - super(SubscriptionCreationResult, self).__init__(**kwargs) - self.subscription_link = subscription_link - - class SubscriptionName(Model): """The new name of the subscription. diff --git a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/models/_subscription_client_enums.py b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/models/_subscription_client_enums.py index 87664497899a..bc3dcc5c2606 100644 --- a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/models/_subscription_client_enums.py +++ b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/models/_subscription_client_enums.py @@ -28,7 +28,14 @@ class SpendingLimit(str, Enum): current_period_off = "CurrentPeriodOff" -class OfferType(str, Enum): +class Workload(str, Enum): - ms_azr_0017_p = "MS-AZR-0017P" - ms_azr_0148_p = "MS-AZR-0148P" + production = "Production" + dev_test = "DevTest" + + +class ProvisioningState(str, Enum): + + accepted = "Accepted" + succeeded = "Succeeded" + failed = "Failed" diff --git a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/__init__.py b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/__init__.py index c2f37a193501..1aae4ad6020b 100644 --- a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/__init__.py +++ b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/__init__.py @@ -12,13 +12,13 @@ from ._subscriptions_operations import SubscriptionsOperations from ._tenants_operations import TenantsOperations from ._subscription_operations import SubscriptionOperations -from ._subscription_operation_operations import SubscriptionOperationOperations from ._operations import Operations +from ._alias_operations import AliasOperations __all__ = [ 'SubscriptionsOperations', 'TenantsOperations', 'SubscriptionOperations', - 'SubscriptionOperationOperations', 'Operations', + 'AliasOperations', ] diff --git a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_alias_operations.py b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_alias_operations.py new file mode 100644 index 000000000000..106275bc23dc --- /dev/null +++ b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_alias_operations.py @@ -0,0 +1,294 @@ +# 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 msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class AliasOperations(object): + """AliasOperations 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: Version of the API to be used with the client request. Current version is 2020-09-01. Constant value: "2020-09-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-09-01" + + self.config = config + + + def _create_initial( + self, alias_name, properties, custom_headers=None, raw=False, **operation_config): + body = models.PutAliasRequest(properties=properties) + + # Construct URL + url = self.create.metadata['url'] + path_format_arguments = { + 'aliasName': self._serialize.url("alias_name", alias_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(body, 'PutAliasRequest') + + # 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.ErrorResponseBodyException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('PutAliasResponse', response) + if response.status_code == 201: + deserialized = self._deserialize('PutAliasResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create( + self, alias_name, properties, custom_headers=None, raw=False, polling=True, **operation_config): + """Create Alias Subscription. + + :param alias_name: Alias Name + :type alias_name: str + :param properties: Put alias request properties. + :type properties: + ~azure.mgmt.subscription.models.PutAliasRequestProperties + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns PutAliasResponse or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.subscription.models.PutAliasResponse] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.subscription.models.PutAliasResponse]] + :raises: + :class:`ErrorResponseBodyException` + """ + raw_result = self._create_initial( + alias_name=alias_name, + properties=properties, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('PutAliasResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create.metadata = {'url': '/providers/Microsoft.Subscription/aliases/{aliasName}'} + + def get( + self, alias_name, custom_headers=None, raw=False, **operation_config): + """Get Alias Subscription. + + :param alias_name: Alias Name + :type alias_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: PutAliasResponse or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.subscription.models.PutAliasResponse or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseBodyException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'aliasName': self._serialize.url("alias_name", alias_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseBodyException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PutAliasResponse', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/providers/Microsoft.Subscription/aliases/{aliasName}'} + + def delete( + self, alias_name, custom_headers=None, raw=False, **operation_config): + """Delete Alias. + + :param alias_name: Alias Name + :type alias_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:`ErrorResponseBodyException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'aliasName': self._serialize.url("alias_name", alias_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseBodyException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/providers/Microsoft.Subscription/aliases/{aliasName}'} + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Get Alias Subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: PutAliasListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.subscription.models.PutAliasListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseBodyException` + """ + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # 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.ErrorResponseBodyException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PutAliasListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Subscription/aliases'} diff --git a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_operations.py b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_operations.py index 664844824d5e..7c7ed1a72414 100644 --- a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_operations.py +++ b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_operations.py @@ -24,7 +24,7 @@ class Operations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. Current version is 2019-10-01-preview. Constant value: "2019-10-01-preview". + :ivar api_version: Version of the API to be used with the client request. Current version is 2020-09-01. Constant value: "2020-09-01". """ models = models @@ -34,7 +34,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-10-01-preview" + self.api_version = "2020-09-01" self.config = config diff --git a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_subscription_operation_operations.py b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_subscription_operation_operations.py deleted file mode 100644 index ff4eaf571ec7..000000000000 --- a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_subscription_operation_operations.py +++ /dev/null @@ -1,104 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError - -from .. import models - - -class SubscriptionOperationOperations(object): - """SubscriptionOperationOperations 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: Version of the API to be used with the client request. Current version is 2019-10-01-preview. Constant value: "2019-10-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2019-10-01-preview" - - self.config = config - - def get( - self, operation_id, custom_headers=None, raw=False, **operation_config): - """Get the status of the pending Microsoft.Subscription API operations. - - :param operation_id: The operation ID, which can be found from the - Location field in the generate recommendation response header. - :type operation_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SubscriptionCreationResult or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.subscription.models.SubscriptionCreationResult or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'operationId': self._serialize.url("operation_id", operation_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - header_dict = {} - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SubscriptionCreationResult', response) - header_dict = { - 'Location': 'str', - 'Retry-After': 'int', - } - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response - - return deserialized - get.metadata = {'url': '/providers/Microsoft.Subscription/subscriptionOperations/{operationId}'} diff --git a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_subscription_operations.py b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_subscription_operations.py index cfede3b61f16..02f15f9190ff 100644 --- a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_subscription_operations.py +++ b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_subscription_operations.py @@ -11,8 +11,6 @@ import uuid from msrest.pipeline import ClientRawResponse -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling from .. import models @@ -26,7 +24,7 @@ class SubscriptionOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Version of the API to be used with the client request. Current version is 2019-10-01-preview. Constant value: "2019-10-01-preview". + :ivar api_version: Version of the API to be used with the client request. Current version is 2020-09-01. Constant value: "2020-09-01". """ models = models @@ -36,118 +34,10 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-10-01-preview" + self.api_version = "2020-09-01" self.config = config - - def _create_subscription_in_enrollment_account_initial( - self, enrollment_account_name, body, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.create_subscription_in_enrollment_account.metadata['url'] - path_format_arguments = { - 'enrollmentAccountName': self._serialize.url("enrollment_account_name", enrollment_account_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(body, 'SubscriptionCreationParameters') - - # 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, 202]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - header_dict = {} - - if response.status_code == 200: - deserialized = self._deserialize('SubscriptionCreationResult', response) - header_dict = { - 'Location': 'str', - 'Retry-After': 'str', - } - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response - - return deserialized - - def create_subscription_in_enrollment_account( - self, enrollment_account_name, body, custom_headers=None, raw=False, polling=True, **operation_config): - """Creates an Azure subscription. - - :param enrollment_account_name: The name of the enrollment account to - which the subscription will be billed. - :type enrollment_account_name: str - :param body: The subscription creation parameters. - :type body: - ~azure.mgmt.subscription.models.SubscriptionCreationParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns - SubscriptionCreationResult or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.subscription.models.SubscriptionCreationResult] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.subscription.models.SubscriptionCreationResult]] - :raises: - :class:`ErrorResponseException` - """ - raw_result = self._create_subscription_in_enrollment_account_initial( - enrollment_account_name=enrollment_account_name, - body=body, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - header_dict = { - 'Location': 'str', - 'Retry-After': 'str', - } - deserialized = self._deserialize('SubscriptionCreationResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_subscription_in_enrollment_account.metadata = {'url': '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountName}/providers/Microsoft.Subscription/createSubscription'} - def cancel( self, subscription_id, custom_headers=None, raw=False, **operation_config): """The operation to cancel a subscription. @@ -323,235 +213,3 @@ def enable( return deserialized enable.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/enable'} - - - def _create_subscription_initial( - self, billing_account_name, billing_profile_name, invoice_section_name, body, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.create_subscription.metadata['url'] - path_format_arguments = { - 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), - 'billingProfileName': self._serialize.url("billing_profile_name", billing_profile_name, 'str'), - 'invoiceSectionName': self._serialize.url("invoice_section_name", invoice_section_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(body, 'ModernSubscriptionCreationParameters') - - # 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, 202]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - header_dict = {} - - if response.status_code == 200: - deserialized = self._deserialize('SubscriptionCreationResult', response) - header_dict = { - 'Location': 'str', - 'Retry-After': 'int', - } - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response - - return deserialized - - def create_subscription( - self, billing_account_name, billing_profile_name, invoice_section_name, body, custom_headers=None, raw=False, polling=True, **operation_config): - """The operation to create a new WebDirect or EA Azure subscription. - - :param billing_account_name: The name of the Microsoft Customer - Agreement billing account for which you want to create the - subscription. - :type billing_account_name: str - :param billing_profile_name: The name of the billing profile in the - billing account for which you want to create the subscription. - :type billing_profile_name: str - :param invoice_section_name: The name of the invoice section in the - billing account for which you want to create the subscription. - :type invoice_section_name: str - :param body: The subscription creation parameters. - :type body: - ~azure.mgmt.subscription.models.ModernSubscriptionCreationParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns - SubscriptionCreationResult or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.subscription.models.SubscriptionCreationResult] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.subscription.models.SubscriptionCreationResult]] - :raises: - :class:`ErrorResponseException` - """ - raw_result = self._create_subscription_initial( - billing_account_name=billing_account_name, - billing_profile_name=billing_profile_name, - invoice_section_name=invoice_section_name, - body=body, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - header_dict = { - 'Location': 'str', - 'Retry-After': 'int', - } - deserialized = self._deserialize('SubscriptionCreationResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_subscription.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Subscription/createSubscription'} - - - def _create_csp_subscription_initial( - self, billing_account_name, customer_name, body, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.create_csp_subscription.metadata['url'] - path_format_arguments = { - 'billingAccountName': self._serialize.url("billing_account_name", billing_account_name, 'str'), - 'customerName': self._serialize.url("customer_name", customer_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(body, 'ModernCspSubscriptionCreationParameters') - - # 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, 202]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - header_dict = {} - - if response.status_code == 200: - deserialized = self._deserialize('SubscriptionCreationResult', response) - header_dict = { - 'Location': 'str', - 'Retry-After': 'int', - } - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response - - return deserialized - - def create_csp_subscription( - self, billing_account_name, customer_name, body, custom_headers=None, raw=False, polling=True, **operation_config): - """The operation to create a new CSP subscription. - - :param billing_account_name: The name of the Microsoft Customer - Agreement billing account for which you want to create the - subscription. - :type billing_account_name: str - :param customer_name: The name of the customer. - :type customer_name: str - :param body: The subscription creation parameters. - :type body: - ~azure.mgmt.subscription.models.ModernCspSubscriptionCreationParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns - SubscriptionCreationResult or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.subscription.models.SubscriptionCreationResult] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.subscription.models.SubscriptionCreationResult]] - :raises: - :class:`ErrorResponseException` - """ - raw_result = self._create_csp_subscription_initial( - billing_account_name=billing_account_name, - customer_name=customer_name, - body=body, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - header_dict = { - 'Location': 'str', - 'Retry-After': 'int', - } - deserialized = self._deserialize('SubscriptionCreationResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_csp_subscription.metadata = {'url': '/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/providers/Microsoft.Subscription/createSubscription'}