From db989205b4c314739d1772a5a81003215d892031 Mon Sep 17 00:00:00 2001 From: Liang Wang Date: Fri, 15 May 2020 03:46:09 +0000 Subject: [PATCH] Release azure-mgmt-subscription 0.6.0 add 2019-10-preview tag for luis --- .../azure-mgmt-subscription/CHANGELOG.md | 21 + .../azure-mgmt-subscription/README.md | 30 +- .../mgmt/subscription/_subscription_client.py | 23 +- .../mgmt/subscription/models/__init__.py | 10 +- .../azure/mgmt/subscription/models/_models.py | 61 +-- .../mgmt/subscription/models/_models_py3.py | 67 +-- .../models/_subscription_client_enums.py | 12 +- .../mgmt/subscription/operations/__init__.py | 10 +- .../subscription/operations/_operations.py | 4 +- .../_subscription_factory_operations.py | 385 -------------- .../_subscription_operation_operations.py | 4 +- .../operations/_subscription_operations.py | 493 +++++++++++++++++- .../operations/_subscriptions_operations.py | 196 +------ .../azure/mgmt/subscription/version.py | 2 +- .../azure-mgmt-subscription/setup.py | 5 +- 15 files changed, 557 insertions(+), 766 deletions(-) delete mode 100644 sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_subscription_factory_operations.py diff --git a/sdk/subscription/azure-mgmt-subscription/CHANGELOG.md b/sdk/subscription/azure-mgmt-subscription/CHANGELOG.md index 87d5cca32f30..8742a4eca936 100644 --- a/sdk/subscription/azure-mgmt-subscription/CHANGELOG.md +++ b/sdk/subscription/azure-mgmt-subscription/CHANGELOG.md @@ -1,5 +1,26 @@ # Release History +## 0.6.0 (2020-06-05) + +**Features** + + - Model SubscriptionCreationParameters has a new parameter management_group_id + - Added operation SubscriptionOperations.create_subscription_in_enrollment_account + - Added operation SubscriptionOperations.create_subscription + - Added operation SubscriptionOperations.create_csp_subscription + - Added operation SubscriptionOperations.cancel + - Added operation SubscriptionOperations.rename + - Added operation SubscriptionOperations.enable + +**Breaking changes** + + - Model ModernSubscriptionCreationParameters no longer has parameter billing_profile_id + - Removed operation SubscriptionsOperations.cancel + - Removed operation SubscriptionsOperations.rename + - Removed operation SubscriptionsOperations.enable + - Removed operation SubscriptionOperations.list + - Removed operation group SubscriptionFactoryOperations + ## 0.5.0 (2019-08-21) **Features** diff --git a/sdk/subscription/azure-mgmt-subscription/README.md b/sdk/subscription/azure-mgmt-subscription/README.md index 518e5dbb45d5..b164a8eaf0b1 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 [Github repo](https://github.com/Azure/azure-sdk-for-python/) -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](https://pypi.python.org/pypi/azure) bundle package. -## 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 317ba22114e6..0615d2183607 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 @@ -14,11 +14,10 @@ from ._configuration import SubscriptionClientConfiguration from .operations import SubscriptionsOperations -from .operations import SubscriptionOperationOperations -from .operations import SubscriptionFactoryOperations +from .operations import TenantsOperations from .operations import SubscriptionOperations +from .operations import SubscriptionOperationOperations from .operations import Operations -from .operations import TenantsOperations from . import models @@ -30,16 +29,14 @@ class SubscriptionClient(SDKClient): :ivar subscriptions: Subscriptions operations :vartype subscriptions: azure.mgmt.subscription.operations.SubscriptionsOperations + :ivar tenants: Tenants operations + :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 subscription_factory: SubscriptionFactory operations - :vartype subscription_factory: azure.mgmt.subscription.operations.SubscriptionFactoryOperations - :ivar subscription_operations: SubscriptionOperations operations - :vartype subscription_operations: azure.mgmt.subscription.operations.SubscriptionOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.subscription.operations.Operations - :ivar tenants: Tenants operations - :vartype tenants: azure.mgmt.subscription.operations.TenantsOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -59,13 +56,11 @@ def __init__( self.subscriptions = SubscriptionsOperations( self._client, self.config, self._serialize, self._deserialize) - self.subscription_operation = SubscriptionOperationOperations( + self.tenants = TenantsOperations( self._client, self.config, self._serialize, self._deserialize) - self.subscription_factory = SubscriptionFactoryOperations( + self.subscription = SubscriptionOperations( self._client, self.config, self._serialize, self._deserialize) - self.subscription_operations = SubscriptionOperations( + self.subscription_operation = SubscriptionOperationOperations( self._client, self.config, self._serialize, self._deserialize) self.operations = Operations( self._client, self.config, self._serialize, self._deserialize) - self.tenants = TenantsOperations( - 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 ab713f9c6782..c73fdff6ab0b 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 @@ -25,8 +25,6 @@ from ._models_py3 import SubscriptionCreationParameters from ._models_py3 import SubscriptionCreationResult from ._models_py3 import SubscriptionName - from ._models_py3 import SubscriptionOperation - from ._models_py3 import SubscriptionOperationListResult from ._models_py3 import SubscriptionPolicies from ._models_py3 import TenantIdDescription except (SyntaxError, ImportError): @@ -45,17 +43,15 @@ from ._models import SubscriptionCreationParameters from ._models import SubscriptionCreationResult from ._models import SubscriptionName - from ._models import SubscriptionOperation - from ._models import SubscriptionOperationListResult from ._models import SubscriptionPolicies from ._models import TenantIdDescription from ._paged_models import LocationPaged from ._paged_models import SubscriptionPaged from ._paged_models import TenantIdDescriptionPaged from ._subscription_client_enums import ( - OfferType, SubscriptionState, SpendingLimit, + OfferType, ) __all__ = [ @@ -74,14 +70,12 @@ 'SubscriptionCreationParameters', 'SubscriptionCreationResult', 'SubscriptionName', - 'SubscriptionOperation', - 'SubscriptionOperationListResult', 'SubscriptionPolicies', 'TenantIdDescription', 'LocationPaged', 'SubscriptionPaged', 'TenantIdDescriptionPaged', - 'OfferType', 'SubscriptionState', 'SpendingLimit', + 'OfferType', ] 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 a00e2cc0fa73..594b69a9d206 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 @@ -184,8 +184,6 @@ class ModernCspSubscriptionCreationParameters(Model): :type sku_id: str :param reseller_id: Reseller ID, basically MPN Id. :type reseller_id: str - :param service_provider_id: Service provider ID, basically MPN Id. - :type service_provider_id: str """ _validation = { @@ -197,7 +195,6 @@ class ModernCspSubscriptionCreationParameters(Model): 'display_name': {'key': 'displayName', 'type': 'str'}, 'sku_id': {'key': 'skuId', 'type': 'str'}, 'reseller_id': {'key': 'resellerId', 'type': 'str'}, - 'service_provider_id': {'key': 'serviceProviderId', 'type': 'str'}, } def __init__(self, **kwargs): @@ -205,7 +202,6 @@ def __init__(self, **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) - self.service_provider_id = kwargs.get('service_provider_id', None) class ModernSubscriptionCreationParameters(Model): @@ -215,9 +211,6 @@ class ModernSubscriptionCreationParameters(Model): :param display_name: Required. The friendly name of the subscription. :type display_name: str - :param billing_profile_id: Required. The ARM ID of the billing profile for - which you want to create the subscription. - :type billing_profile_id: 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 @@ -240,13 +233,11 @@ class ModernSubscriptionCreationParameters(Model): _validation = { 'display_name': {'required': True}, - 'billing_profile_id': {'required': True}, 'sku_id': {'required': True}, } _attribute_map = { 'display_name': {'key': 'displayName', 'type': 'str'}, - 'billing_profile_id': {'key': 'billingProfileId', 'type': 'str'}, 'sku_id': {'key': 'skuId', 'type': 'str'}, 'cost_center': {'key': 'costCenter', 'type': 'str'}, 'owner': {'key': 'owner', 'type': 'AdPrincipal'}, @@ -257,7 +248,6 @@ class ModernSubscriptionCreationParameters(Model): def __init__(self, **kwargs): super(ModernSubscriptionCreationParameters, self).__init__(**kwargs) self.display_name = kwargs.get('display_name', None) - self.billing_profile_id = kwargs.get('billing_profile_id', None) self.sku_id = kwargs.get('sku_id', None) self.cost_center = kwargs.get('cost_center', None) self.owner = kwargs.get('owner', None) @@ -413,6 +403,8 @@ class SubscriptionCreationParameters(Model): :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. @@ -430,6 +422,7 @@ class SubscriptionCreationParameters(Model): _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}'}, @@ -438,6 +431,7 @@ class SubscriptionCreationParameters(Model): 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) @@ -476,53 +470,6 @@ def __init__(self, **kwargs): self.subscription_name = kwargs.get('subscription_name', None) -class SubscriptionOperation(Model): - """status of the subscription POST operation. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: The operation Id. - :vartype id: str - :param status: Status of the pending subscription - :type status: str - :param status_detail: Status Detail of the pending subscription - :type status_detail: str - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'status_detail': {'key': 'statusDetail', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(SubscriptionOperation, self).__init__(**kwargs) - self.id = None - self.status = kwargs.get('status', None) - self.status_detail = kwargs.get('status_detail', None) - - -class SubscriptionOperationListResult(Model): - """A list of pending subscription operations. - - :param value: A list of pending SubscriptionOperations - :type value: list[~azure.mgmt.subscription.models.SubscriptionOperation] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SubscriptionOperation]'}, - } - - def __init__(self, **kwargs): - super(SubscriptionOperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - class SubscriptionPolicies(Model): """Subscription policies. 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 ed9caff8d991..8292c0a157de 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 @@ -184,8 +184,6 @@ class ModernCspSubscriptionCreationParameters(Model): :type sku_id: str :param reseller_id: Reseller ID, basically MPN Id. :type reseller_id: str - :param service_provider_id: Service provider ID, basically MPN Id. - :type service_provider_id: str """ _validation = { @@ -197,15 +195,13 @@ class ModernCspSubscriptionCreationParameters(Model): 'display_name': {'key': 'displayName', 'type': 'str'}, 'sku_id': {'key': 'skuId', 'type': 'str'}, 'reseller_id': {'key': 'resellerId', 'type': 'str'}, - 'service_provider_id': {'key': 'serviceProviderId', 'type': 'str'}, } - def __init__(self, *, display_name: str, sku_id: str, reseller_id: str=None, service_provider_id: str=None, **kwargs) -> None: + 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 - self.service_provider_id = service_provider_id class ModernSubscriptionCreationParameters(Model): @@ -215,9 +211,6 @@ class ModernSubscriptionCreationParameters(Model): :param display_name: Required. The friendly name of the subscription. :type display_name: str - :param billing_profile_id: Required. The ARM ID of the billing profile for - which you want to create the subscription. - :type billing_profile_id: 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 @@ -240,13 +233,11 @@ class ModernSubscriptionCreationParameters(Model): _validation = { 'display_name': {'required': True}, - 'billing_profile_id': {'required': True}, 'sku_id': {'required': True}, } _attribute_map = { 'display_name': {'key': 'displayName', 'type': 'str'}, - 'billing_profile_id': {'key': 'billingProfileId', 'type': 'str'}, 'sku_id': {'key': 'skuId', 'type': 'str'}, 'cost_center': {'key': 'costCenter', 'type': 'str'}, 'owner': {'key': 'owner', 'type': 'AdPrincipal'}, @@ -254,10 +245,9 @@ class ModernSubscriptionCreationParameters(Model): 'additional_parameters': {'key': 'additionalParameters', 'type': '{object}'}, } - def __init__(self, *, display_name: str, billing_profile_id: str, sku_id: str, cost_center: str=None, owner=None, management_group_id: str=None, additional_parameters=None, **kwargs) -> None: + 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.billing_profile_id = billing_profile_id self.sku_id = sku_id self.cost_center = cost_center self.owner = owner @@ -413,6 +403,8 @@ class SubscriptionCreationParameters(Model): :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. @@ -430,14 +422,16 @@ class SubscriptionCreationParameters(Model): _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, owners=None, offer_type=None, additional_parameters=None, **kwargs) -> None: + 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 @@ -476,53 +470,6 @@ def __init__(self, *, subscription_name: str=None, **kwargs) -> None: self.subscription_name = subscription_name -class SubscriptionOperation(Model): - """status of the subscription POST operation. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: The operation Id. - :vartype id: str - :param status: Status of the pending subscription - :type status: str - :param status_detail: Status Detail of the pending subscription - :type status_detail: str - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'status_detail': {'key': 'statusDetail', 'type': 'str'}, - } - - def __init__(self, *, status: str=None, status_detail: str=None, **kwargs) -> None: - super(SubscriptionOperation, self).__init__(**kwargs) - self.id = None - self.status = status - self.status_detail = status_detail - - -class SubscriptionOperationListResult(Model): - """A list of pending subscription operations. - - :param value: A list of pending SubscriptionOperations - :type value: list[~azure.mgmt.subscription.models.SubscriptionOperation] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SubscriptionOperation]'}, - } - - def __init__(self, *, value=None, **kwargs) -> None: - super(SubscriptionOperationListResult, self).__init__(**kwargs) - self.value = value - - class SubscriptionPolicies(Model): """Subscription policies. 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 95601304f532..87664497899a 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 @@ -12,12 +12,6 @@ from enum import Enum -class OfferType(str, Enum): - - ms_azr_0017_p = "MS-AZR-0017P" - ms_azr_0148_p = "MS-AZR-0148P" - - class SubscriptionState(str, Enum): enabled = "Enabled" @@ -32,3 +26,9 @@ class SpendingLimit(str, Enum): on = "On" off = "Off" current_period_off = "CurrentPeriodOff" + + +class OfferType(str, Enum): + + ms_azr_0017_p = "MS-AZR-0017P" + ms_azr_0148_p = "MS-AZR-0148P" 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 40463eff4de2..c2f37a193501 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 @@ -10,17 +10,15 @@ # -------------------------------------------------------------------------- from ._subscriptions_operations import SubscriptionsOperations -from ._subscription_operation_operations import SubscriptionOperationOperations -from ._subscription_factory_operations import SubscriptionFactoryOperations +from ._tenants_operations import TenantsOperations from ._subscription_operations import SubscriptionOperations +from ._subscription_operation_operations import SubscriptionOperationOperations from ._operations import Operations -from ._tenants_operations import TenantsOperations __all__ = [ 'SubscriptionsOperations', - 'SubscriptionOperationOperations', - 'SubscriptionFactoryOperations', + 'TenantsOperations', 'SubscriptionOperations', + 'SubscriptionOperationOperations', 'Operations', - 'TenantsOperations', ] 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 2fd9e8ce9cbb..664844824d5e 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 2015-06-01. Constant value: "2018-03-01-preview". + :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 @@ -34,7 +34,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-03-01-preview" + self.api_version = "2019-10-01-preview" self.config = config diff --git a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_subscription_factory_operations.py b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_subscription_factory_operations.py deleted file mode 100644 index 1bd11910b9da..000000000000 --- a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_subscription_factory_operations.py +++ /dev/null @@ -1,385 +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 msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling - -from .. import models - - -class SubscriptionFactoryOperations(object): - """SubscriptionFactoryOperations 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. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - - self.config = config - - - def _create_subscription_initial( - self, billing_account_name, billing_profile_name, invoice_section_name, body, custom_headers=None, raw=False, **operation_config): - api_version = "2018-11-01-preview" - - # 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("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(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): - api_version = "2018-11-01-preview" - - # 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("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(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'} - - - def _create_subscription_in_enrollment_account_initial( - self, enrollment_account_name, body, custom_headers=None, raw=False, **operation_config): - api_version = "2018-03-01-preview" - - # 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("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(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'} 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 index 3cf803fa2d0a..ff4eaf571ec7 100644 --- 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 @@ -25,7 +25,7 @@ class SubscriptionOperationOperations(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 2018-11-01-preview. Constant value: "2018-11-01-preview". + :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 @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-11-01-preview" + self.api_version = "2019-10-01-preview" self.config = config 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 6c40f0c4f76f..cfede3b61f16 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,6 +11,8 @@ import uuid from msrest.pipeline import ClientRawResponse +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling from .. import models @@ -24,7 +26,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 2015-06-01. Constant value: "2018-03-01-preview". + :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 @@ -34,30 +36,141 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-03-01-preview" + self.api_version = "2019-10-01-preview" self.config = config - def list( - self, custom_headers=None, raw=False, **operation_config): - """Lists all of the available pending Microsoft.Subscription API - operations. + 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. + + :param subscription_id: Subscription Id. + :type subscription_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: SubscriptionOperationListResult or ClientRawResponse if - raw=true - :rtype: - ~azure.mgmt.subscription.models.SubscriptionOperationListResult or + :return: CanceledSubscriptionId or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.subscription.models.CanceledSubscriptionId or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ # Construct URL - url = self.list.metadata['url'] + url = self.cancel.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} @@ -74,7 +187,7 @@ def list( 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) + request = self._client.post(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: @@ -82,11 +195,363 @@ def list( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SubscriptionOperationListResult', response) + deserialized = self._deserialize('CanceledSubscriptionId', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - list.metadata = {'url': '/providers/Microsoft.Subscription/subscriptionOperations'} + cancel.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/cancel'} + + def rename( + self, subscription_id, subscription_name=None, custom_headers=None, raw=False, **operation_config): + """The operation to rename a subscription. + + :param subscription_id: Subscription Id. + :type subscription_id: str + :param subscription_name: New subscription name + :type subscription_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: RenamedSubscriptionId or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.subscription.models.RenamedSubscriptionId or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + body = models.SubscriptionName(subscription_name=subscription_name) + + # Construct URL + url = self.rename.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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, 'SubscriptionName') + + # 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('RenamedSubscriptionId', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + rename.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/rename'} + + def enable( + self, subscription_id, custom_headers=None, raw=False, **operation_config): + """The operation to enable a subscription. + + :param subscription_id: Subscription Id. + :type subscription_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: EnabledSubscriptionId or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.subscription.models.EnabledSubscriptionId or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.enable.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('EnabledSubscriptionId', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + 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'} diff --git a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_subscriptions_operations.py b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_subscriptions_operations.py index 59dd9e265908..fa1e1305cfd9 100644 --- a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_subscriptions_operations.py +++ b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/operations/_subscriptions_operations.py @@ -25,6 +25,7 @@ class SubscriptionsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for the operation. Constant value: "2016-06-01". """ models = models @@ -34,191 +35,10 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer + self.api_version = "2016-06-01" self.config = config - def cancel( - self, subscription_id, custom_headers=None, raw=False, **operation_config): - """The operation to cancel a subscription. - - :param subscription_id: Subscription Id. - :type subscription_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: CanceledSubscriptionId or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.subscription.models.CanceledSubscriptionId or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - api_version = "2019-03-01-preview" - - # Construct URL - url = self.cancel.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) - 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('CanceledSubscriptionId', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - cancel.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/cancel'} - - def rename( - self, subscription_id, subscription_name=None, custom_headers=None, raw=False, **operation_config): - """The operation to rename a subscription. - - :param subscription_id: Subscription Id. - :type subscription_id: str - :param subscription_name: New subscription name - :type subscription_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: RenamedSubscriptionId or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.subscription.models.RenamedSubscriptionId or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - body = models.SubscriptionName(subscription_name=subscription_name) - - api_version = "2019-03-01-preview" - - # Construct URL - url = self.rename.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(body, 'SubscriptionName') - - # 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('RenamedSubscriptionId', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - rename.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/rename'} - - def enable( - self, subscription_id, custom_headers=None, raw=False, **operation_config): - """The operation to enable a subscription. - - :param subscription_id: Subscription Id. - :type subscription_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: EnabledSubscriptionId or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.subscription.models.EnabledSubscriptionId or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - api_version = "2019-03-01-preview" - - # Construct URL - url = self.enable.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) - 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('EnabledSubscriptionId', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - enable.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/enable'} - def list_locations( self, subscription_id, custom_headers=None, raw=False, **operation_config): """Gets all available geo-locations. @@ -239,8 +59,6 @@ def list_locations( ~azure.mgmt.subscription.models.LocationPaged[~azure.mgmt.subscription.models.Location] :raises: :class:`CloudError` """ - api_version = "2016-06-01" - def prepare_request(next_link=None): if not next_link: # Construct URL @@ -252,7 +70,7 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link @@ -309,8 +127,6 @@ def get( ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ - api_version = "2016-06-01" - # Construct URL url = self.get.metadata['url'] path_format_arguments = { @@ -320,7 +136,7 @@ def get( # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') # Construct headers header_parameters = {} @@ -366,8 +182,6 @@ def list( ~azure.mgmt.subscription.models.SubscriptionPaged[~azure.mgmt.subscription.models.Subscription] :raises: :class:`CloudError` """ - api_version = "2016-06-01" - def prepare_request(next_link=None): if not next_link: # Construct URL @@ -375,7 +189,7 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link diff --git a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/version.py b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/version.py index 266f5a486d79..5a7feab42d26 100644 --- a/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/version.py +++ b/sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.5.0" +VERSION = "0.6.0" diff --git a/sdk/subscription/azure-mgmt-subscription/setup.py b/sdk/subscription/azure-mgmt-subscription/setup.py index 289ed7e21633..6861d30fed17 100644 --- a/sdk/subscription/azure-mgmt-subscription/setup.py +++ b/sdk/subscription/azure-mgmt-subscription/setup.py @@ -36,7 +36,9 @@ pass # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, 'version.py'), 'r') as fd: +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) @@ -67,6 +69,7 @@ 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', 'License :: OSI Approved :: MIT License', ], zip_safe=False,