diff --git a/src/subscription/azext_subscription/_client_factory.py b/src/subscription/azext_subscription/_client_factory.py index 515992d4507..7d459812dfb 100644 --- a/src/subscription/azext_subscription/_client_factory.py +++ b/src/subscription/azext_subscription/_client_factory.py @@ -11,5 +11,5 @@ def cf_subscription(cli_ctx, **_): return client -def subscription_definitions_mgmt_client_factory(cli_ctx, kwargs): - return cf_subscription(cli_ctx, **kwargs).subscription_definitions +def subscription_factory(cli_ctx, kwargs): + return cf_subscription(cli_ctx, **kwargs).subscription_factory diff --git a/src/subscription/azext_subscription/_help.py b/src/subscription/azext_subscription/_help.py index 50d64121749..5aa58e6756e 100644 --- a/src/subscription/azext_subscription/_help.py +++ b/src/subscription/azext_subscription/_help.py @@ -6,12 +6,7 @@ from knack.help_files import helps -helps['account subscription-definition'] = """ - type: group - short-summary: Manage Azure Subscription Definitions. -""" - -helps['account subscription-definition create'] = """ +helps['account create'] = """ type: command - short-summary: Create a subscription definition. + short-summary: Create a subscription. """ diff --git a/src/subscription/azext_subscription/_params.py b/src/subscription/azext_subscription/_params.py index 59676b65d81..4b011ac3f71 100644 --- a/src/subscription/azext_subscription/_params.py +++ b/src/subscription/azext_subscription/_params.py @@ -8,10 +8,10 @@ # pylint: disable=line-too-long def load_arguments(self, _): - with self.argument_context('account subscription-definition create') as c: + with self.argument_context('account create') as c: + c.argument('enrollment_account_name', options_list=('--enrollment-account-name', '--enrollment-account-object-id'), required=True, help='The name of the enrollment account which should be used to create a subscription.') c.argument('offer_type', required=True, help='The offer type of the subscription. For example, MS-AZR-0017P (EnterpriseAgreement) and MS-AZR-0148P (EnterpriseAgreement devTest) are available.', arg_type=get_enum_type(['MS-AZR-0017P', 'MS-AZR-0148P'])) - c.argument('subscription_display_name', help='The subscription display name of the subscription definition.') - - for scope in ['account subscription-definition create', 'account subscription-definition show']: - with self.argument_context(scope) as c: - c.argument('subscription_definition_name', options_list=['--name', '-n'], help='Name of the subscription definition.') + c.argument('display_name', help='The display name of the subscription.') + c.argument('owner_object_id', help='The object id(s) of the owner(s) which should be granted access to the new subscription.') + c.argument('owner_spn', help='The service principal name(s) of the owner(s) which should be granted access to the new subscription.') + c.argument('owner_upn', help='The user principal name(s) of owner(s) who should be granted access to the new subscription.') diff --git a/src/subscription/azext_subscription/azext_metadata.json b/src/subscription/azext_subscription/azext_metadata.json index bbe67260f34..85be557b589 100644 --- a/src/subscription/azext_subscription/azext_metadata.json +++ b/src/subscription/azext_subscription/azext_metadata.json @@ -1,3 +1,4 @@ { - "azext.minCliCoreVersion": "2.0.24" + "azext.minCliCoreVersion": "2.0.30", + "azext.isPreview": true } \ No newline at end of file diff --git a/src/subscription/azext_subscription/commands.py b/src/subscription/azext_subscription/commands.py index 46aec474b3b..5fde2f2cf91 100644 --- a/src/subscription/azext_subscription/commands.py +++ b/src/subscription/azext_subscription/commands.py @@ -6,19 +6,17 @@ # pylint: disable=line-too-long from azure.cli.core.commands import CliCommandType -from ._client_factory import subscription_definitions_mgmt_client_factory +from ._client_factory import subscription_factory from ._exception_handler import subscription_exception_handler def load_command_table(self, _): - subscription_definition_util = CliCommandType( - operations_tmpl='azext_subscription.subscription.operations.subscription_definitions_operations#SubscriptionDefinitionsOperations.{}', - client_factory=subscription_definitions_mgmt_client_factory, + subscription_util = CliCommandType( + operations_tmpl='azext_subscription.subscription.operations.subscription_factory_operations#SubscriptionFactoryOperations.{}', + client_factory=subscription_factory, client_arg_name='self', exception_handler=subscription_exception_handler ) - with self.command_group('account subscription-definition', subscription_definition_util, client_factory=subscription_definitions_mgmt_client_factory) as g: - g.command('list', 'list') - g.command('show', 'get') - g.custom_command('create', 'cli_subscription_create_subscription_definition') + with self.command_group('account', subscription_util, client_factory=subscription_factory) as g: + g.custom_command('create', 'cli_subscription_create') diff --git a/src/subscription/azext_subscription/custom.py b/src/subscription/azext_subscription/custom.py index 1825898283e..7f557e1379f 100644 --- a/src/subscription/azext_subscription/custom.py +++ b/src/subscription/azext_subscription/custom.py @@ -3,16 +3,87 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -from azext_subscription.subscription.models import SubscriptionDefinition +from knack.log import get_logger +from knack.util import CLIError +from azext_subscription.subscription.models import (SubscriptionCreationParameters, AdPrincipal) +logger = get_logger(__name__) -def cli_subscription_create_subscription_definition(client, subscription_definition_name, - offer_type, subscription_display_name=None): - if subscription_display_name is None: - subscription_display_name = subscription_definition_name - new_def = SubscriptionDefinition( - subscription_display_name=subscription_display_name, - offer_type=offer_type) +def _get_object_id_by_spn(graph_client, spn): + accounts = list(graph_client.service_principals.list( + filter="servicePrincipalNames/any(c:c eq '{}')".format(spn))) + if not accounts: + logger.warning("Unable to find user with spn '%s'", spn) + return None + if len(accounts) > 1: + logger.warning("Multiple service principals found with spn '%s'. " + "You can avoid this by specifying object id.", spn) + return None + return accounts[0].object_id - return client.create(subscription_definition_name, new_def) + +def _get_object_id_by_upn(graph_client, upn): + accounts = list(graph_client.users.list(filter="userPrincipalName eq '{}'".format(upn))) + if not accounts: + logger.warning("Unable to find user with upn '%s'", upn) + return None + if len(accounts) > 1: + logger.warning("Multiple users principals found with upn '%s'. " + "You can avoid this by specifying object id.", upn) + return None + return accounts[0].object_id + + +def _get_object_id_from_subscription(graph_client, subscription): + if subscription['user']: + if subscription['user']['type'] == 'user': + return _get_object_id_by_upn(graph_client, subscription['user']['name']) + elif subscription['user']['type'] == 'servicePrincipal': + return _get_object_id_by_spn(graph_client, subscription['user']['name']) + else: + logger.warning("Unknown user type '%s'", subscription['user']['type']) + else: + logger.warning('Current credentials are not from a user or service principal. ' + 'Azure Key Vault does not work with certificate credentials.') + return None + + +def _get_object_id(graph_client, subscription=None, spn=None, upn=None): + if spn: + return _get_object_id_by_spn(graph_client, spn) + if upn: + return _get_object_id_by_upn(graph_client, upn) + return _get_object_id_from_subscription(graph_client, subscription) + + +def _object_id_args_helper(cli_ctx, object_id=None, spn=None, upn=None): + if not object_id: + from azure.cli.core._profile import Profile + from azure.graphrbac import GraphRbacManagementClient + + profile = Profile(cli_ctx=cli_ctx) + cred, _, tenant_id = profile.get_login_credentials( + resource=cli_ctx.cloud.endpoints.active_directory_graph_resource_id) + graph_client = GraphRbacManagementClient(cred, + tenant_id, + base_url=cli_ctx.cloud.endpoints.active_directory_graph_resource_id) + object_id = _get_object_id(graph_client, spn=spn, upn=upn) + if not object_id: + raise CLIError('Unable to get object id from principal name.') + return object_id + + +def cli_subscription_create(cmd, client, enrollment_account_name, offer_type, + display_name=None, owner_object_id="", owner_spn="", + owner_upn=""): + owners = [_object_id_args_helper(cmd.cli_ctx, object_id=x) for x + in owner_object_id.split(',') if owner_object_id] + \ + [_object_id_args_helper(cmd.cli_ctx, spn=x) for x in owner_spn.split(',') if owner_spn] + \ + [_object_id_args_helper(cmd.cli_ctx, upn=x) for x in owner_upn.split(',') if owner_upn] + creation_parameters = SubscriptionCreationParameters( + display_name=display_name, + offer_type=offer_type, + owners=[AdPrincipal(object_id=x) for x in owners]) + + return client.create_subscription_in_enrollment_account(enrollment_account_name, creation_parameters) diff --git a/src/subscription/azext_subscription/subscription/models/__init__.py b/src/subscription/azext_subscription/subscription/models/__init__.py index 6611f4ef8fb..714aff9a52e 100644 --- a/src/subscription/azext_subscription/subscription/models/__init__.py +++ b/src/subscription/azext_subscription/subscription/models/__init__.py @@ -9,38 +9,61 @@ # regenerated. # -------------------------------------------------------------------------- -from .subscription_definition import SubscriptionDefinition -from .operation_display import OperationDisplay -from .operation import Operation -from .error_response import ErrorResponse, ErrorResponseException -from .location import Location -from .subscription_policies import SubscriptionPolicies -from .subscription import Subscription -from .tenant_id_description import TenantIdDescription -from .operation_paged import OperationPaged -from .subscription_definition_paged import SubscriptionDefinitionPaged +try: + from .subscription_creation_result_py3 import SubscriptionCreationResult + from .ad_principal_py3 import AdPrincipal + from .subscription_creation_parameters_py3 import SubscriptionCreationParameters + from .error_response_py3 import ErrorResponse, ErrorResponseException + from .subscription_operation_py3 import SubscriptionOperation + from .subscription_operation_list_result_py3 import SubscriptionOperationListResult + from .operation_display_py3 import OperationDisplay + from .operation_py3 import Operation + from .operation_list_result_py3 import OperationListResult + from .location_py3 import Location + from .subscription_policies_py3 import SubscriptionPolicies + from .subscription_py3 import Subscription + from .tenant_id_description_py3 import TenantIdDescription +except (SyntaxError, ImportError): + from .subscription_creation_result import SubscriptionCreationResult + from .ad_principal import AdPrincipal + from .subscription_creation_parameters import SubscriptionCreationParameters + from .error_response import ErrorResponse, ErrorResponseException + from .subscription_operation import SubscriptionOperation + from .subscription_operation_list_result import SubscriptionOperationListResult + from .operation_display import OperationDisplay + from .operation import Operation + from .operation_list_result import OperationListResult + from .location import Location + from .subscription_policies import SubscriptionPolicies + from .subscription import Subscription + from .tenant_id_description import TenantIdDescription from .location_paged import LocationPaged from .subscription_paged import SubscriptionPaged from .tenant_id_description_paged import TenantIdDescriptionPaged from .subscription_client_enums import ( + OfferType, SubscriptionState, SpendingLimit, ) __all__ = [ - 'SubscriptionDefinition', + 'SubscriptionCreationResult', + 'AdPrincipal', + 'SubscriptionCreationParameters', + 'ErrorResponse', 'ErrorResponseException', + 'SubscriptionOperation', + 'SubscriptionOperationListResult', 'OperationDisplay', 'Operation', - 'ErrorResponse', 'ErrorResponseException', + 'OperationListResult', 'Location', 'SubscriptionPolicies', 'Subscription', 'TenantIdDescription', - 'OperationPaged', - 'SubscriptionDefinitionPaged', 'LocationPaged', 'SubscriptionPaged', 'TenantIdDescriptionPaged', + 'OfferType', 'SubscriptionState', 'SpendingLimit', ] diff --git a/src/subscription/azext_subscription/subscription/models/ad_principal.py b/src/subscription/azext_subscription/subscription/models/ad_principal.py new file mode 100644 index 00000000000..8063b834162 --- /dev/null +++ b/src/subscription/azext_subscription/subscription/models/ad_principal.py @@ -0,0 +1,34 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class AdPrincipal(Model): + """Active Directory Principal for subscription creation delegated permission. + + 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) diff --git a/src/subscription/azext_subscription/subscription/models/ad_principal_py3.py b/src/subscription/azext_subscription/subscription/models/ad_principal_py3.py new file mode 100644 index 00000000000..8c6466a671f --- /dev/null +++ b/src/subscription/azext_subscription/subscription/models/ad_principal_py3.py @@ -0,0 +1,34 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class AdPrincipal(Model): + """Active Directory Principal for subscription creation delegated permission. + + 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 diff --git a/src/subscription/azext_subscription/subscription/models/error_response.py b/src/subscription/azext_subscription/subscription/models/error_response.py index 2cc2d8d6851..b3d490a4950 100644 --- a/src/subscription/azext_subscription/subscription/models/error_response.py +++ b/src/subscription/azext_subscription/subscription/models/error_response.py @@ -27,9 +27,10 @@ class ErrorResponse(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, code=None, message=None): - self.code = code - self.message = message + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) class ErrorResponseException(HttpOperationError): diff --git a/src/subscription/azext_subscription/subscription/models/error_response_py3.py b/src/subscription/azext_subscription/subscription/models/error_response_py3.py new file mode 100644 index 00000000000..5504940d687 --- /dev/null +++ b/src/subscription/azext_subscription/subscription/models/error_response_py3.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ErrorResponse(Model): + """Describes the format of Error response. + + :param code: Error code + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) diff --git a/src/subscription/azext_subscription/subscription/models/location.py b/src/subscription/azext_subscription/subscription/models/location.py index ee2afd412c6..691616984d2 100644 --- a/src/subscription/azext_subscription/subscription/models/location.py +++ b/src/subscription/azext_subscription/subscription/models/location.py @@ -51,7 +51,8 @@ class Location(Model): 'longitude': {'key': 'longitude', 'type': 'str'}, } - def __init__(self): + def __init__(self, **kwargs): + super(Location, self).__init__(**kwargs) self.id = None self.subscription_id = None self.name = None diff --git a/src/subscription/azext_subscription/subscription/models/location_py3.py b/src/subscription/azext_subscription/subscription/models/location_py3.py new file mode 100644 index 00000000000..40af216a664 --- /dev/null +++ b/src/subscription/azext_subscription/subscription/models/location_py3.py @@ -0,0 +1,61 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class Location(Model): + """Location information. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The fully qualified ID of the location. For example, + /subscriptions/00000000-0000-0000-0000-000000000000/locations/westus. + :vartype id: str + :ivar subscription_id: The subscription ID. + :vartype subscription_id: str + :ivar name: The location name. + :vartype name: str + :ivar display_name: The display name of the location. + :vartype display_name: str + :ivar latitude: The latitude of the location. + :vartype latitude: str + :ivar longitude: The longitude of the location. + :vartype longitude: str + """ + + _validation = { + 'id': {'readonly': True}, + 'subscription_id': {'readonly': True}, + 'name': {'readonly': True}, + 'display_name': {'readonly': True}, + 'latitude': {'readonly': True}, + 'longitude': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'latitude': {'key': 'latitude', 'type': 'str'}, + 'longitude': {'key': 'longitude', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(Location, self).__init__(**kwargs) + self.id = None + self.subscription_id = None + self.name = None + self.display_name = None + self.latitude = None + self.longitude = None diff --git a/src/subscription/azext_subscription/subscription/models/operation.py b/src/subscription/azext_subscription/subscription/models/operation.py index d9088e03cfd..c07607304e2 100644 --- a/src/subscription/azext_subscription/subscription/models/operation.py +++ b/src/subscription/azext_subscription/subscription/models/operation.py @@ -26,6 +26,7 @@ class Operation(Model): 'display': {'key': 'display', 'type': 'OperationDisplay'}, } - def __init__(self, name=None, display=None): - self.name = name - self.display = display + def __init__(self, **kwargs): + super(Operation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) diff --git a/src/subscription/azext_subscription/subscription/models/operation_display.py b/src/subscription/azext_subscription/subscription/models/operation_display.py index 405bad34fa1..990aaa27291 100644 --- a/src/subscription/azext_subscription/subscription/models/operation_display.py +++ b/src/subscription/azext_subscription/subscription/models/operation_display.py @@ -30,7 +30,8 @@ class OperationDisplay(Model): 'operation': {'key': 'operation', 'type': 'str'}, } - def __init__(self, provider=None, resource=None, operation=None): - self.provider = provider - self.resource = resource - self.operation = operation + def __init__(self, **kwargs): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) diff --git a/src/subscription/azext_subscription/subscription/models/operation_display_py3.py b/src/subscription/azext_subscription/subscription/models/operation_display_py3.py new file mode 100644 index 00000000000..7f6ba3c819d --- /dev/null +++ b/src/subscription/azext_subscription/subscription/models/operation_display_py3.py @@ -0,0 +1,37 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class OperationDisplay(Model): + """The object that represents the operation. + + :param provider: Service provider: Microsoft.Subscription + :type provider: str + :param resource: Resource on which the operation is performed: Profile, + endpoint, etc. + :type resource: str + :param operation: Operation type: Read, write, delete, etc. + :type operation: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + } + + def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, **kwargs) -> None: + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation diff --git a/src/subscription/azext_subscription/subscription/models/operation_list_result.py b/src/subscription/azext_subscription/subscription/models/operation_list_result.py new file mode 100644 index 00000000000..1833b37c8c7 --- /dev/null +++ b/src/subscription/azext_subscription/subscription/models/operation_list_result.py @@ -0,0 +1,34 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class OperationListResult(Model): + """Result of the request to list operations. It contains a list of operations + and a URL link to get the next set of results. + + :param value: List of operations. + :type value: list[~azure.mgmt.subscription.models.Operation] + :param next_link: URL to get the next set of operation list results if + there are any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(OperationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) diff --git a/src/subscription/azext_subscription/subscription/models/operation_list_result_py3.py b/src/subscription/azext_subscription/subscription/models/operation_list_result_py3.py new file mode 100644 index 00000000000..573e35ed80c --- /dev/null +++ b/src/subscription/azext_subscription/subscription/models/operation_list_result_py3.py @@ -0,0 +1,34 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class OperationListResult(Model): + """Result of the request to list operations. It contains a list of operations + and a URL link to get the next set of results. + + :param value: List of operations. + :type value: list[~azure.mgmt.subscription.models.Operation] + :param next_link: URL to get the next set of operation list results if + there are any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, *, value=None, next_link: str=None, **kwargs) -> None: + super(OperationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link diff --git a/src/subscription/azext_subscription/subscription/models/operation_py3.py b/src/subscription/azext_subscription/subscription/models/operation_py3.py new file mode 100644 index 00000000000..e6823f8d561 --- /dev/null +++ b/src/subscription/azext_subscription/subscription/models/operation_py3.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class Operation(Model): + """REST API operation. + + :param name: Operation name: {provider}/{resource}/{operation} + :type name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.subscription.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__(self, *, name: str=None, display=None, **kwargs) -> None: + super(Operation, self).__init__(**kwargs) + self.name = name + self.display = display diff --git a/src/subscription/azext_subscription/subscription/models/subscription.py b/src/subscription/azext_subscription/subscription/models/subscription.py index 363a487bbd2..0af82c0632b 100644 --- a/src/subscription/azext_subscription/subscription/models/subscription.py +++ b/src/subscription/azext_subscription/subscription/models/subscription.py @@ -54,10 +54,11 @@ class Subscription(Model): 'authorization_source': {'key': 'authorizationSource', 'type': 'str'}, } - def __init__(self, subscription_policies=None, authorization_source=None): + def __init__(self, **kwargs): + super(Subscription, self).__init__(**kwargs) self.id = None self.subscription_id = None self.display_name = None self.state = None - self.subscription_policies = subscription_policies - self.authorization_source = authorization_source + self.subscription_policies = kwargs.get('subscription_policies', None) + self.authorization_source = kwargs.get('authorization_source', None) diff --git a/src/subscription/azext_subscription/subscription/models/subscription_client_enums.py b/src/subscription/azext_subscription/subscription/models/subscription_client_enums.py index edfce74d4f8..95601304f53 100644 --- a/src/subscription/azext_subscription/subscription/models/subscription_client_enums.py +++ b/src/subscription/azext_subscription/subscription/models/subscription_client_enums.py @@ -12,7 +12,13 @@ from enum import Enum -class SubscriptionState(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" warned = "Warned" @@ -21,7 +27,7 @@ class SubscriptionState(Enum): deleted = "Deleted" -class SpendingLimit(Enum): +class SpendingLimit(str, Enum): on = "On" off = "Off" diff --git a/src/subscription/azext_subscription/subscription/models/subscription_creation_parameters.py b/src/subscription/azext_subscription/subscription/models/subscription_creation_parameters.py new file mode 100644 index 00000000000..da5f3a437e4 --- /dev/null +++ b/src/subscription/azext_subscription/subscription/models/subscription_creation_parameters.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +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 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'}, + '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.owners = kwargs.get('owners', None) + self.offer_type = kwargs.get('offer_type', None) + self.additional_parameters = kwargs.get('additional_parameters', None) diff --git a/src/subscription/azext_subscription/subscription/models/subscription_creation_parameters_py3.py b/src/subscription/azext_subscription/subscription/models/subscription_creation_parameters_py3.py new file mode 100644 index 00000000000..3f9693014ab --- /dev/null +++ b/src/subscription/azext_subscription/subscription/models/subscription_creation_parameters_py3.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +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 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'}, + '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: + super(SubscriptionCreationParameters, self).__init__(**kwargs) + self.display_name = display_name + self.owners = owners + self.offer_type = offer_type + self.additional_parameters = additional_parameters diff --git a/src/subscription/azext_subscription/subscription/models/operation_paged.py b/src/subscription/azext_subscription/subscription/models/subscription_creation_result.py similarity index 52% rename from src/subscription/azext_subscription/subscription/models/operation_paged.py rename to src/subscription/azext_subscription/subscription/models/subscription_creation_result.py index 4427c2811b1..754c0a8ee25 100644 --- a/src/subscription/azext_subscription/subscription/models/operation_paged.py +++ b/src/subscription/azext_subscription/subscription/models/subscription_creation_result.py @@ -9,19 +9,20 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.paging import Paged +from msrest.serialization import Model -class OperationPaged(Paged): - """ - A paging container for iterating over a list of :class:`Operation ` object +class SubscriptionCreationResult(Model): + """The created subscription object. + + :param subscription_link: The link to the new subscription. + :type subscription_link: str """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Operation]'} + 'subscription_link': {'key': 'subscriptionLink', 'type': 'str'}, } - def __init__(self, *args, **kwargs): - - super(OperationPaged, self).__init__(*args, **kwargs) + def __init__(self, **kwargs): + super(SubscriptionCreationResult, self).__init__(**kwargs) + self.subscription_link = kwargs.get('subscription_link', None) diff --git a/src/subscription/azext_subscription/subscription/models/subscription_definition_paged.py b/src/subscription/azext_subscription/subscription/models/subscription_creation_result_py3.py similarity index 51% rename from src/subscription/azext_subscription/subscription/models/subscription_definition_paged.py rename to src/subscription/azext_subscription/subscription/models/subscription_creation_result_py3.py index 1f183fbd3e7..d5fd62e6878 100644 --- a/src/subscription/azext_subscription/subscription/models/subscription_definition_paged.py +++ b/src/subscription/azext_subscription/subscription/models/subscription_creation_result_py3.py @@ -9,19 +9,20 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.paging import Paged +from msrest.serialization import Model -class SubscriptionDefinitionPaged(Paged): - """ - A paging container for iterating over a list of :class:`SubscriptionDefinition ` object +class SubscriptionCreationResult(Model): + """The created subscription object. + + :param subscription_link: The link to the new subscription. + :type subscription_link: str """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SubscriptionDefinition]'} + 'subscription_link': {'key': 'subscriptionLink', 'type': 'str'}, } - def __init__(self, *args, **kwargs): - - super(SubscriptionDefinitionPaged, self).__init__(*args, **kwargs) + def __init__(self, *, subscription_link: str=None, **kwargs) -> None: + super(SubscriptionCreationResult, self).__init__(**kwargs) + self.subscription_link = subscription_link diff --git a/src/subscription/azext_subscription/subscription/models/subscription_definition.py b/src/subscription/azext_subscription/subscription/models/subscription_definition.py deleted file mode 100644 index 07da90b8302..00000000000 --- a/src/subscription/azext_subscription/subscription/models/subscription_definition.py +++ /dev/null @@ -1,63 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class SubscriptionDefinition(Model): - """The subscription definition used to create the subscription. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar subscription_id: The ID of the subscription. - :vartype subscription_id: str - :param subscription_display_name: The display name of the subscription. - :type subscription_display_name: str - :param offer_type: The offer type of the subscription. For example, - MS-AZR-0017P (EnterpriseAgreement) and MS-AZR-0148P (EnterpriseAgreement - devTest) are available. - :type offer_type: str - :param etag: The etag the subscription definition. - :type etag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'subscription_id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'subscription_id': {'key': 'properties.subscriptionId', 'type': 'str'}, - 'subscription_display_name': {'key': 'properties.subscriptionDisplayName', 'type': 'str'}, - 'offer_type': {'key': 'properties.offerType', 'type': 'str'}, - 'etag': {'key': 'properties.etag', 'type': 'str'}, - } - - def __init__(self, subscription_display_name=None, offer_type=None, etag=None): - self.id = None - self.name = None - self.type = None - self.subscription_id = None - self.subscription_display_name = subscription_display_name - self.offer_type = offer_type - self.etag = etag diff --git a/src/subscription/azext_subscription/subscription/models/subscription_operation.py b/src/subscription/azext_subscription/subscription/models/subscription_operation.py new file mode 100644 index 00000000000..fe6c6ca2271 --- /dev/null +++ b/src/subscription/azext_subscription/subscription/models/subscription_operation.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +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) diff --git a/src/subscription/azext_subscription/subscription/models/subscription_operation_list_result.py b/src/subscription/azext_subscription/subscription/models/subscription_operation_list_result.py new file mode 100644 index 00000000000..0badcdcba5a --- /dev/null +++ b/src/subscription/azext_subscription/subscription/models/subscription_operation_list_result.py @@ -0,0 +1,28 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +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) diff --git a/src/subscription/azext_subscription/subscription/models/subscription_operation_list_result_py3.py b/src/subscription/azext_subscription/subscription/models/subscription_operation_list_result_py3.py new file mode 100644 index 00000000000..19ed87ef03f --- /dev/null +++ b/src/subscription/azext_subscription/subscription/models/subscription_operation_list_result_py3.py @@ -0,0 +1,28 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +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 diff --git a/src/subscription/azext_subscription/subscription/models/subscription_operation_py3.py b/src/subscription/azext_subscription/subscription/models/subscription_operation_py3.py new file mode 100644 index 00000000000..7f06c48b38e --- /dev/null +++ b/src/subscription/azext_subscription/subscription/models/subscription_operation_py3.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +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 diff --git a/src/subscription/azext_subscription/subscription/models/subscription_policies.py b/src/subscription/azext_subscription/subscription/models/subscription_policies.py index 58f9751348f..2d6c5bbc349 100644 --- a/src/subscription/azext_subscription/subscription/models/subscription_policies.py +++ b/src/subscription/azext_subscription/subscription/models/subscription_policies.py @@ -43,7 +43,8 @@ class SubscriptionPolicies(Model): 'spending_limit': {'key': 'spendingLimit', 'type': 'SpendingLimit'}, } - def __init__(self): + def __init__(self, **kwargs): + super(SubscriptionPolicies, self).__init__(**kwargs) self.location_placement_id = None self.quota_id = None self.spending_limit = None diff --git a/src/subscription/azext_subscription/subscription/models/subscription_policies_py3.py b/src/subscription/azext_subscription/subscription/models/subscription_policies_py3.py new file mode 100644 index 00000000000..3597539f707 --- /dev/null +++ b/src/subscription/azext_subscription/subscription/models/subscription_policies_py3.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class SubscriptionPolicies(Model): + """Subscription policies. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar location_placement_id: The subscription location placement ID. The + ID indicates which regions are visible for a subscription. For example, a + subscription with a location placement Id of Public_2014-09-01 has access + to Azure public regions. + :vartype location_placement_id: str + :ivar quota_id: The subscription quota ID. + :vartype quota_id: str + :ivar spending_limit: The subscription spending limit. Possible values + include: 'On', 'Off', 'CurrentPeriodOff' + :vartype spending_limit: str or + ~azure.mgmt.subscription.models.SpendingLimit + """ + + _validation = { + 'location_placement_id': {'readonly': True}, + 'quota_id': {'readonly': True}, + 'spending_limit': {'readonly': True}, + } + + _attribute_map = { + 'location_placement_id': {'key': 'locationPlacementId', 'type': 'str'}, + 'quota_id': {'key': 'quotaId', 'type': 'str'}, + 'spending_limit': {'key': 'spendingLimit', 'type': 'SpendingLimit'}, + } + + def __init__(self, **kwargs) -> None: + super(SubscriptionPolicies, self).__init__(**kwargs) + self.location_placement_id = None + self.quota_id = None + self.spending_limit = None diff --git a/src/subscription/azext_subscription/subscription/models/subscription_py3.py b/src/subscription/azext_subscription/subscription/models/subscription_py3.py new file mode 100644 index 00000000000..e7b0830a878 --- /dev/null +++ b/src/subscription/azext_subscription/subscription/models/subscription_py3.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class Subscription(Model): + """Subscription information. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The fully qualified ID for the subscription. For example, + /subscriptions/00000000-0000-0000-0000-000000000000. + :vartype id: str + :ivar subscription_id: The subscription ID. + :vartype subscription_id: str + :ivar display_name: The subscription display name. + :vartype display_name: str + :ivar state: The subscription state. Possible values are Enabled, Warned, + PastDue, Disabled, and Deleted. Possible values include: 'Enabled', + 'Warned', 'PastDue', 'Disabled', 'Deleted' + :vartype state: str or ~azure.mgmt.subscription.models.SubscriptionState + :param subscription_policies: The subscription policies. + :type subscription_policies: + ~azure.mgmt.subscription.models.SubscriptionPolicies + :param authorization_source: The authorization source of the request. + Valid values are one or more combinations of Legacy, RoleBased, Bypassed, + Direct and Management. For example, 'Legacy, RoleBased'. + :type authorization_source: str + """ + + _validation = { + 'id': {'readonly': True}, + 'subscription_id': {'readonly': True}, + 'display_name': {'readonly': True}, + 'state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'state': {'key': 'state', 'type': 'SubscriptionState'}, + 'subscription_policies': {'key': 'subscriptionPolicies', 'type': 'SubscriptionPolicies'}, + 'authorization_source': {'key': 'authorizationSource', 'type': 'str'}, + } + + def __init__(self, *, subscription_policies=None, authorization_source: str=None, **kwargs) -> None: + super(Subscription, self).__init__(**kwargs) + self.id = None + self.subscription_id = None + self.display_name = None + self.state = None + self.subscription_policies = subscription_policies + self.authorization_source = authorization_source diff --git a/src/subscription/azext_subscription/subscription/models/tenant_id_description.py b/src/subscription/azext_subscription/subscription/models/tenant_id_description.py index 4ff09fcd06c..dc4ddc3edde 100644 --- a/src/subscription/azext_subscription/subscription/models/tenant_id_description.py +++ b/src/subscription/azext_subscription/subscription/models/tenant_id_description.py @@ -36,6 +36,7 @@ class TenantIdDescription(Model): 'tenant_id': {'key': 'tenantId', 'type': 'str'}, } - def __init__(self): + def __init__(self, **kwargs): + super(TenantIdDescription, self).__init__(**kwargs) self.id = None self.tenant_id = None diff --git a/src/subscription/azext_subscription/subscription/models/tenant_id_description_py3.py b/src/subscription/azext_subscription/subscription/models/tenant_id_description_py3.py new file mode 100644 index 00000000000..3b1103d1b9d --- /dev/null +++ b/src/subscription/azext_subscription/subscription/models/tenant_id_description_py3.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class TenantIdDescription(Model): + """Tenant Id information. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The fully qualified ID of the tenant. For example, + /tenants/00000000-0000-0000-0000-000000000000. + :vartype id: str + :ivar tenant_id: The tenant ID. For example, + 00000000-0000-0000-0000-000000000000. + :vartype tenant_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(TenantIdDescription, self).__init__(**kwargs) + self.id = None + self.tenant_id = None diff --git a/src/subscription/azext_subscription/subscription/operations/__init__.py b/src/subscription/azext_subscription/subscription/operations/__init__.py index bd84d2adb13..8c27fcc434f 100644 --- a/src/subscription/azext_subscription/subscription/operations/__init__.py +++ b/src/subscription/azext_subscription/subscription/operations/__init__.py @@ -9,14 +9,16 @@ # regenerated. # -------------------------------------------------------------------------- -from .subscription_definitions_operation_metadata_operations import SubscriptionDefinitionsOperationMetadataOperations -from .subscription_definitions_operations import SubscriptionDefinitionsOperations +from .operations import Operations +from .subscription_operations import SubscriptionOperations +from .subscription_factory_operations import SubscriptionFactoryOperations from .subscriptions_operations import SubscriptionsOperations from .tenants_operations import TenantsOperations __all__ = [ - 'SubscriptionDefinitionsOperationMetadataOperations', - 'SubscriptionDefinitionsOperations', + 'Operations', + 'SubscriptionOperations', + 'SubscriptionFactoryOperations', 'SubscriptionsOperations', 'TenantsOperations', ] diff --git a/src/subscription/azext_subscription/subscription/operations/operations.py b/src/subscription/azext_subscription/subscription/operations/operations.py new file mode 100644 index 00000000000..d0ed66a6990 --- /dev/null +++ b/src/subscription/azext_subscription/subscription/operations/operations.py @@ -0,0 +1,88 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class Operations(object): + """Operations operations. + + :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 2015-06-01. Constant value: "2018-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-03-01-preview" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all of the available Microsoft.Subscription API operations. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: OperationListResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.subscription.models.OperationListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # 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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, 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('OperationListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Subscription/operations'} diff --git a/src/subscription/azext_subscription/subscription/operations/subscription_definitions_operation_metadata_operations.py b/src/subscription/azext_subscription/subscription/operations/subscription_definitions_operation_metadata_operations.py deleted file mode 100644 index 2054c64dcf6..00000000000 --- a/src/subscription/azext_subscription/subscription/operations/subscription_definitions_operation_metadata_operations.py +++ /dev/null @@ -1,96 +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 .. import models - - -class SubscriptionDefinitionsOperationMetadataOperations(object): - """SubscriptionDefinitionsOperationMetadataOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. - :ivar api_version: Version of the API to be used with the client request. Current version is 2015-06-01. Constant value: "2017-11-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2017-11-01-preview" - - self.config = config - - def list( - self, custom_headers=None, raw=False, **operation_config): - """Lists all of the available Microsoft.Subscription API operations. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Operation - :rtype: - ~azure.mgmt.subscription.models.OperationPaged[~azure.mgmt.subscription.models.Operation] - :raises: - :class:`ErrorResponseException` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = '/providers/Microsoft.Subscription/operations' - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - return response - - # Deserialize response - deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized diff --git a/src/subscription/azext_subscription/subscription/operations/subscription_definitions_operations.py b/src/subscription/azext_subscription/subscription/operations/subscription_definitions_operations.py deleted file mode 100644 index 66855a56187..00000000000 --- a/src/subscription/azext_subscription/subscription/operations/subscription_definitions_operations.py +++ /dev/null @@ -1,313 +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 msrestazure.azure_operation import AzureOperationPoller - -from .. import models - - -class SubscriptionDefinitionsOperations(object): - """SubscriptionDefinitionsOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. - :ivar api_version: Version of the API to be used with the client request. Current version is 2015-06-01. Constant value: "2017-11-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2017-11-01-preview" - - self.config = config - - def create( - self, subscription_definition_name, body, custom_headers=None, raw=False, **operation_config): - """Create an Azure subscription definition. - - :param subscription_definition_name: The name of the Azure - subscription definition. - :type subscription_definition_name: str - :param body: The subscription definition creation. - :type body: ~azure.mgmt.subscription.models.SubscriptionDefinition - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :return: An instance of AzureOperationPoller that returns - SubscriptionDefinition or ClientRawResponse if raw=true - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.subscription.models.SubscriptionDefinition] - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = '/providers/Microsoft.Subscription/subscriptionDefinitions/{subscriptionDefinitionName}' - path_format_arguments = { - 'subscriptionDefinitionName': self._serialize.url("subscription_definition_name", subscription_definition_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['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, 'SubscriptionDefinition') - - # Construct and send request - def long_running_send(): - - request = self._client.put(url, query_parameters) - return self._client.send( - request, header_parameters, body_content, **operation_config) - - def get_long_running_status(status_link, headers=None): - - request = self._client.get(status_link) - if headers: - request.headers.update(headers) - return self._client.send( - request, header_parameters, **operation_config) - - def get_long_running_output(response): - - 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('SubscriptionDefinition', 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 - - if raw: - response = long_running_send() - return get_long_running_output(response) - - long_running_operation_timeout = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - return AzureOperationPoller( - long_running_send, get_long_running_output, - get_long_running_status, long_running_operation_timeout) - - def get( - self, subscription_definition_name, custom_headers=None, raw=False, **operation_config): - """Get an Azure subscription definition. - - :param subscription_definition_name: The name of the Azure - subscription definition. - :type subscription_definition_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: SubscriptionDefinition or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.subscription.models.SubscriptionDefinition or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = '/providers/Microsoft.Subscription/subscriptionDefinitions/{subscriptionDefinitionName}' - path_format_arguments = { - 'subscriptionDefinitionName': self._serialize.url("subscription_definition_name", subscription_definition_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['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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **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('SubscriptionDefinition', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def list( - self, custom_headers=None, raw=False, **operation_config): - """List an Azure subscription definition by subscriptionId. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SubscriptionDefinition - :rtype: - ~azure.mgmt.subscription.models.SubscriptionDefinitionPaged[~azure.mgmt.subscription.models.SubscriptionDefinition] - :raises: - :class:`ErrorResponseException` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = '/providers/Microsoft.Subscription/subscriptionDefinitions' - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send( - request, header_parameters, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - return response - - # Deserialize response - deserialized = models.SubscriptionDefinitionPaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.SubscriptionDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - - def get_operation_status( - self, operation_id, custom_headers=None, raw=False, **operation_config): - """Retrieves the status of the subscription definition PUT operation. The - URI of this API is returned in the Location field of the response - header. - - :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: SubscriptionDefinition or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.subscription.models.SubscriptionDefinition or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - # Construct URL - url = '/providers/Microsoft.Subscription/subscriptionOperations/{operationId}' - 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['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 and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) - - if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None - header_dict = {} - - if response.status_code == 200: - deserialized = self._deserialize('SubscriptionDefinition', 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 diff --git a/src/subscription/azext_subscription/subscription/operations/subscription_factory_operations.py b/src/subscription/azext_subscription/subscription/operations/subscription_factory_operations.py new file mode 100644 index 00000000000..a210f0d22ca --- /dev/null +++ b/src/subscription/azext_subscription/subscription/operations/subscription_factory_operations.py @@ -0,0 +1,147 @@ +# 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. + + :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 2015-06-01. Constant value: "2018-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-03-01-preview" + + 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['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) + response = self._client.send( + request, header_parameters, body_content, 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/src/subscription/azext_subscription/subscription/operations/subscription_operations.py b/src/subscription/azext_subscription/subscription/operations/subscription_operations.py new file mode 100644 index 00000000000..055d3109fa0 --- /dev/null +++ b/src/subscription/azext_subscription/subscription/operations/subscription_operations.py @@ -0,0 +1,91 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class SubscriptionOperations(object): + """SubscriptionOperations operations. + + :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 2015-06-01. Constant value: "2018-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-03-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. + + :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 + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # 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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, 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('SubscriptionOperationListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Subscription/subscriptionOperations'} diff --git a/src/subscription/azext_subscription/subscription/operations/subscriptions_operations.py b/src/subscription/azext_subscription/subscription/operations/subscriptions_operations.py index a1afbc3fb4b..c42bd53d4d3 100644 --- a/src/subscription/azext_subscription/subscription/operations/subscriptions_operations.py +++ b/src/subscription/azext_subscription/subscription/operations/subscriptions_operations.py @@ -22,7 +22,7 @@ class SubscriptionsOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. :ivar api_version: The API version to use for the operation. Constant value: "2016-06-01". """ @@ -61,7 +61,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions/{subscriptionId}/locations' + url = self.list_locations.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str') } @@ -88,7 +88,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -106,6 +106,7 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list_locations.metadata = {'url': '/subscriptions/{subscriptionId}/locations'} def get( self, subscription_id, custom_headers=None, raw=False, **operation_config): @@ -124,7 +125,7 @@ def get( :raises: :class:`CloudError` """ # Construct URL - url = '/subscriptions/{subscriptionId}' + url = self.get.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str') } @@ -146,7 +147,7 @@ def get( # Construct and send request request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, **operation_config) + response = self._client.send(request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -163,6 +164,7 @@ def get( return client_raw_response return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}'} def list( self, custom_headers=None, raw=False, **operation_config): @@ -182,7 +184,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/subscriptions' + url = self.list.metadata['url'] # Construct parameters query_parameters = {} @@ -205,7 +207,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -223,3 +225,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list.metadata = {'url': '/subscriptions'} diff --git a/src/subscription/azext_subscription/subscription/operations/tenants_operations.py b/src/subscription/azext_subscription/subscription/operations/tenants_operations.py index c5c440db15c..e3d96b6c6a8 100644 --- a/src/subscription/azext_subscription/subscription/operations/tenants_operations.py +++ b/src/subscription/azext_subscription/subscription/operations/tenants_operations.py @@ -22,7 +22,7 @@ class TenantsOperations(object): :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. - :param deserializer: An objec model deserializer. + :param deserializer: An object model deserializer. :ivar api_version: The API version to use for the operation. Constant value: "2016-06-01". """ @@ -55,7 +55,7 @@ def internal_paging(next_link=None, raw=False): if not next_link: # Construct URL - url = '/tenants' + url = self.list.metadata['url'] # Construct parameters query_parameters = {} @@ -78,7 +78,7 @@ def internal_paging(next_link=None, raw=False): # Construct and send request request = self._client.get(url, query_parameters) response = self._client.send( - request, header_parameters, **operation_config) + request, header_parameters, stream=False, **operation_config) if response.status_code not in [200]: exp = CloudError(response) @@ -96,3 +96,4 @@ def internal_paging(next_link=None, raw=False): return client_raw_response return deserialized + list.metadata = {'url': '/tenants'} diff --git a/src/subscription/azext_subscription/subscription/subscription_client.py b/src/subscription/azext_subscription/subscription/subscription_client.py index 0d1abe155ee..b4ad84e9e72 100644 --- a/src/subscription/azext_subscription/subscription/subscription_client.py +++ b/src/subscription/azext_subscription/subscription/subscription_client.py @@ -13,8 +13,9 @@ from msrest import Serializer, Deserializer from msrestazure import AzureConfiguration from .version import VERSION -from .operations.subscription_definitions_operation_metadata_operations import SubscriptionDefinitionsOperationMetadataOperations -from .operations.subscription_definitions_operations import SubscriptionDefinitionsOperations +from .operations.operations import Operations +from .operations.subscription_operations import SubscriptionOperations +from .operations.subscription_factory_operations import SubscriptionFactoryOperations from .operations.subscriptions_operations import SubscriptionsOperations from .operations.tenants_operations import TenantsOperations from . import models @@ -53,10 +54,12 @@ class SubscriptionClient(object): :ivar config: Configuration for client. :vartype config: SubscriptionClientConfiguration - :ivar subscription_definitions_operation_metadata: SubscriptionDefinitionsOperationMetadata operations - :vartype subscription_definitions_operation_metadata: azure.mgmt.subscription.operations.SubscriptionDefinitionsOperationMetadataOperations - :ivar subscription_definitions: SubscriptionDefinitions operations - :vartype subscription_definitions: azure.mgmt.subscription.operations.SubscriptionDefinitionsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.subscription.operations.Operations + :ivar subscription_operations: SubscriptionOperations operations + :vartype subscription_operations: azure.mgmt.subscription.operations.SubscriptionOperations + :ivar subscription_factory: SubscriptionFactory operations + :vartype subscription_factory: azure.mgmt.subscription.operations.SubscriptionFactoryOperations :ivar subscriptions: Subscriptions operations :vartype subscriptions: azure.mgmt.subscription.operations.SubscriptionsOperations :ivar tenants: Tenants operations @@ -78,9 +81,11 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) - self.subscription_definitions_operation_metadata = SubscriptionDefinitionsOperationMetadataOperations( + self.operations = Operations( self._client, self.config, self._serialize, self._deserialize) - self.subscription_definitions = SubscriptionDefinitionsOperations( + self.subscription_operations = SubscriptionOperations( + self._client, self.config, self._serialize, self._deserialize) + self.subscription_factory = SubscriptionFactoryOperations( self._client, self.config, self._serialize, self._deserialize) self.subscriptions = SubscriptionsOperations( self._client, self.config, self._serialize, self._deserialize) diff --git a/src/subscription/azext_subscription/subscription/version.py b/src/subscription/azext_subscription/subscription/version.py index fb0159ed93d..c995f7836ce 100644 --- a/src/subscription/azext_subscription/subscription/version.py +++ b/src/subscription/azext_subscription/subscription/version.py @@ -9,4 +9,4 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.1.0" +VERSION = "0.2.0" diff --git a/src/subscription/azext_subscription/tests/latest/recordings/test_create_subscription.yaml b/src/subscription/azext_subscription/tests/latest/recordings/test_create_subscription.yaml new file mode 100644 index 00000000000..07226a1ab05 --- /dev/null +++ b/src/subscription/azext_subscription/tests/latest/recordings/test_create_subscription.yaml @@ -0,0 +1,253 @@ +interactions: +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.0 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.24 azure-mgmt-billing/0.2.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/providers/Microsoft.Billing/enrollmentAccounts?api-version=2018-03-01-preview + response: + body: {string: '{"value":[{"id":"/providers/Microsoft.Billing/enrollmentAccounts/cdf813b6-bdc2-4df5-b150-00ccfd7580e2","name":"cdf813b6-bdc2-4df5-b150-00ccfd7580e2","properties":{"principalName":"billtest608777@live.com","offerTypes":["MS-AZR-0017P"]},"type":"Microsoft.Billing/enrollmentAccounts"}]}'} + headers: + api-supported-versions: [2018-03-01-preview] + cache-control: [no-cache] + content-length: ['284'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 29 Mar 2018 18:53:32 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-aspnet-version: [4.0.30319] + x-content-type-options: [nosniff] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +- request: + body: '{"offerType": "MS-AZR-0148P"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['29'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.6.0 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.24 azure-mgmt-subscription/0.2.0 Azure-SDK-For-Python] + accept-language: [en-US] + method: POST + uri: https://management.azure.com/providers/Microsoft.Billing/enrollmentAccounts/cdf813b6-bdc2-4df5-b150-00ccfd7580e2/providers/Microsoft.Subscription/createSubscription?api-version=2018-03-01-preview + response: + body: {string: '{}'} + headers: + api-supported-versions: ['2017-11-01-preview, 2018-03-01-preview'] + cache-control: [no-cache] + content-length: ['2'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 29 Mar 2018 18:53:42 GMT'] + expires: ['-1'] + location: ['https://management.azure.com/providers/Microsoft.Subscription/subscriptionOperations/887d0d11-69ed-40ad-8842-176d69e948f9?api-version=2018-03-01-preview'] + pragma: [no-cache] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-aspnet-version: [4.0.30319] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-tenant-writes: ['1199'] + x-powered-by: [ASP.NET] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python/3.6.0 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.24 azure-mgmt-subscription/0.2.0 Azure-SDK-For-Python] + method: GET + uri: https://management.azure.com/providers/Microsoft.Subscription/subscriptionOperations/887d0d11-69ed-40ad-8842-176d69e948f9?api-version=2018-03-01-preview + response: + body: {string: '{}'} + headers: + api-supported-versions: ['2017-11-01-preview, 2018-03-01-preview'] + cache-control: [no-cache] + content-length: ['2'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 29 Mar 2018 18:53:54 GMT'] + expires: ['-1'] + location: ['https://management.azure.com/providers/Microsoft.Subscription/subscriptionOperations/887d0d11-69ed-40ad-8842-176d69e948f9?api-version=2018-03-01-preview'] + pragma: [no-cache] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-aspnet-version: [4.0.30319] + x-content-type-options: [nosniff] + x-powered-by: [ASP.NET] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python/3.6.0 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.24 azure-mgmt-subscription/0.2.0 Azure-SDK-For-Python] + method: GET + uri: https://management.azure.com/providers/Microsoft.Subscription/subscriptionOperations/887d0d11-69ed-40ad-8842-176d69e948f9?api-version=2018-03-01-preview + response: + body: {string: '{}'} + headers: + api-supported-versions: ['2017-11-01-preview, 2018-03-01-preview'] + cache-control: [no-cache] + content-length: ['2'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 29 Mar 2018 18:54:05 GMT'] + expires: ['-1'] + location: ['https://management.azure.com/providers/Microsoft.Subscription/subscriptionOperations/887d0d11-69ed-40ad-8842-176d69e948f9?api-version=2018-03-01-preview'] + pragma: [no-cache] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-aspnet-version: [4.0.30319] + x-content-type-options: [nosniff] + x-powered-by: [ASP.NET] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python/3.6.0 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.24 azure-mgmt-subscription/0.2.0 Azure-SDK-For-Python] + method: GET + uri: https://management.azure.com/providers/Microsoft.Subscription/subscriptionOperations/887d0d11-69ed-40ad-8842-176d69e948f9?api-version=2018-03-01-preview + response: + body: {string: '{}'} + headers: + api-supported-versions: ['2017-11-01-preview, 2018-03-01-preview'] + cache-control: [no-cache] + content-length: ['2'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 29 Mar 2018 18:54:18 GMT'] + expires: ['-1'] + location: ['https://management.azure.com/providers/Microsoft.Subscription/subscriptionOperations/887d0d11-69ed-40ad-8842-176d69e948f9?api-version=2018-03-01-preview'] + pragma: [no-cache] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-aspnet-version: [4.0.30319] + x-content-type-options: [nosniff] + x-powered-by: [ASP.NET] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python/3.6.0 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.24 azure-mgmt-subscription/0.2.0 Azure-SDK-For-Python] + method: GET + uri: https://management.azure.com/providers/Microsoft.Subscription/subscriptionOperations/887d0d11-69ed-40ad-8842-176d69e948f9?api-version=2018-03-01-preview + response: + body: {string: '{}'} + headers: + api-supported-versions: ['2017-11-01-preview, 2018-03-01-preview'] + cache-control: [no-cache] + content-length: ['2'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 29 Mar 2018 18:54:29 GMT'] + expires: ['-1'] + location: ['https://management.azure.com/providers/Microsoft.Subscription/subscriptionOperations/887d0d11-69ed-40ad-8842-176d69e948f9?api-version=2018-03-01-preview'] + pragma: [no-cache] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-aspnet-version: [4.0.30319] + x-content-type-options: [nosniff] + x-powered-by: [ASP.NET] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python/3.6.0 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.24 azure-mgmt-subscription/0.2.0 Azure-SDK-For-Python] + method: GET + uri: https://management.azure.com/providers/Microsoft.Subscription/subscriptionOperations/887d0d11-69ed-40ad-8842-176d69e948f9?api-version=2018-03-01-preview + response: + body: {string: '{}'} + headers: + api-supported-versions: ['2017-11-01-preview, 2018-03-01-preview'] + cache-control: [no-cache] + content-length: ['2'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 29 Mar 2018 18:54:41 GMT'] + expires: ['-1'] + location: ['https://management.azure.com/providers/Microsoft.Subscription/subscriptionOperations/887d0d11-69ed-40ad-8842-176d69e948f9?api-version=2018-03-01-preview'] + pragma: [no-cache] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-aspnet-version: [4.0.30319] + x-content-type-options: [nosniff] + x-powered-by: [ASP.NET] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python/3.6.0 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.24 azure-mgmt-subscription/0.2.0 Azure-SDK-For-Python] + method: GET + uri: https://management.azure.com/providers/Microsoft.Subscription/subscriptionOperations/887d0d11-69ed-40ad-8842-176d69e948f9?api-version=2018-03-01-preview + response: + body: {string: '{}'} + headers: + api-supported-versions: ['2017-11-01-preview, 2018-03-01-preview'] + cache-control: [no-cache] + content-length: ['2'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 29 Mar 2018 18:54:52 GMT'] + expires: ['-1'] + location: ['https://management.azure.com/providers/Microsoft.Subscription/subscriptionOperations/887d0d11-69ed-40ad-8842-176d69e948f9?api-version=2018-03-01-preview'] + pragma: [no-cache] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-aspnet-version: [4.0.30319] + x-content-type-options: [nosniff] + x-powered-by: [ASP.NET] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python/3.6.0 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.24 azure-mgmt-subscription/0.2.0 Azure-SDK-For-Python] + method: GET + uri: https://management.azure.com/providers/Microsoft.Subscription/subscriptionOperations/887d0d11-69ed-40ad-8842-176d69e948f9?api-version=2018-03-01-preview + response: + body: {string: '{"subscriptionLink":"/subscriptions/ee7f81f1-7865-423d-84ab-4cd12456c664"}'} + headers: + api-supported-versions: ['2017-11-01-preview, 2018-03-01-preview'] + cache-control: [no-cache] + content-length: ['74'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 29 Mar 2018 18:55:04 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Microsoft-IIS/8.5] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-aspnet-version: [4.0.30319] + x-content-type-options: [nosniff] + x-powered-by: [ASP.NET] + status: {code: 200, message: OK} +version: 1 diff --git a/src/subscription/azext_subscription/tests/latest/recordings/test_create_subscription_definitions.yaml b/src/subscription/azext_subscription/tests/latest/recordings/test_create_subscription_definitions.yaml deleted file mode 100644 index 8962bc8fe3d..00000000000 --- a/src/subscription/azext_subscription/tests/latest/recordings/test_create_subscription_definitions.yaml +++ /dev/null @@ -1,155 +0,0 @@ -interactions: -- request: - body: null - headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - CommandName: [subscriptiondefinition list] - Connection: [keep-alive] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.19 - msrest_azure/0.4.18 azure-mgmt-subscription/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.21] - accept-language: [en-US] - method: GET - uri: https://management.azure.com/providers/Microsoft.Subscription/subscriptionDefinitions?api-version=2017-11-01-preview - response: - body: {string: '{"value":[{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/1e4333cd-c2a7-484c-bcb3-1875333cda2c","name":"1e4333cd-c2a7-484c-bcb3-1875333cda2c","properties":{"etag":"ufjPyg==","subscriptionDisplayName":"My - New Sub From PS","subscriptionId":"142ac143-af82-4306-97f0-7139f5f069da","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/MyCliSub","name":"MyCliSub","properties":{"etag":"ed0rxw==","subscriptionDisplayName":"MyCliSub","subscriptionId":"99640677-f394-4f42-a8a6-87cfdb7c0115","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/MyProdSubDef99","name":"MyProdSubDef99","properties":{"etag":"HlRr6g==","subscriptionDisplayName":"MyProdSubDef99","subscriptionId":"cefe2134-b409-4642-b030-bd7a8f107e84","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/MyProdSubscription","name":"MyProdSubscription","properties":{"etag":"MfjP0w==","subscriptionDisplayName":"MyProdSubscription","subscriptionId":"86869d42-1782-4337-98b0-c905fb937d46","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/MyTestSubDef1","name":"MyTestSubDef1","properties":{"etag":"NqYHYg==","subscriptionDisplayName":"MyTestSubDef1","subscriptionId":"368425df-b536-4f42-b1ba-64613cfcc4b5","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/cc564ad5-bb20-4c02-acf2-414e818cd3a3","name":"cc564ad5-bb20-4c02-acf2-414e818cd3a3","properties":{"etag":"siiV2A==","subscriptionDisplayName":"cc564ad5-bb20-4c02-acf2-414e818cd3a3","subscriptionId":"bf3f7279-f418-465c-a1ef-f6cafae4847b","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/cli7rpvvswzwddyfs5wub3l6","name":"cli7rpvvswzwddyfs5wub3l6","properties":{"etag":"g3g7JA==","subscriptionDisplayName":"cli7rpvvswzwddyfs5wub3l6","subscriptionId":"92af979c-678d-45e0-9e02-861c57ae1af3","offerType":"MS-AZR-0148P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/e2esubprod1","name":"e2esubprod1","properties":{"etag":"To8acg==","subscriptionDisplayName":"mye2esubprod1","subscriptionId":"430ed244-e513-4b13-b113-e877158ed7f5","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/e2esubprod6","name":"e2esubprod6","properties":{"etag":"YRP88g==","subscriptionDisplayName":"e2esubprod6","subscriptionId":"a21087f6-05f2-4be3-a831-185aad424df6","offerType":"MS-AZR-0148P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/e2esubprod7","name":"e2esubprod7","properties":{"etag":"DqdLvg==","subscriptionDisplayName":"e2esubprod7","subscriptionId":"519fce51-f304-4f10-9d03-777b7c47c8f0","offerType":"MS-AZR-0148P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/jlianTestProdPowerShell510","name":"jlianTestProdPowerShell510","properties":{"etag":"s4i+KA==","subscriptionDisplayName":"jlianTestProdPowerShell510","subscriptionId":"b35bb54b-3fc4-45e4-a567-a92af11b6ecb","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/jlianTestProdSub","name":"jlianTestProdSub","properties":{"etag":"7E0urw==","subscriptionDisplayName":"jlianTestProdSub","subscriptionId":"6867bab6-09ff-4dce-b789-e298924a630a","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/ps4631","name":"ps4631","properties":{"etag":"vg0lUA==","subscriptionDisplayName":"ps4631","subscriptionId":"6384690c-8764-4369-91d0-763132b9269e","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/subat201711271230","name":"subat201711271230","properties":{"etag":"VoDLkA==","subscriptionDisplayName":"Subat201711271230","subscriptionId":"5571f36c-bacb-4b1d-bff1-ca1418d142af","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/%7B%7D","name":"{}","properties":{"etag":"Dl7eYQ==","subscriptionDisplayName":"{}","subscriptionId":"46ca9650-740a-49c4-bafd-2626203b38a0","offerType":"MS-AZR-0148P"},"type":"Microsoft.Subscription/subscriptionDefinitions"}]}'} - headers: - cache-control: [no-cache] - content-length: ['4931'] - content-type: [application/json; charset=utf-8] - date: ['Fri, 15 Dec 2017 18:43:12 GMT'] - expires: ['-1'] - pragma: [no-cache] - server: [Microsoft-IIS/8.5] - strict-transport-security: [max-age=31536000; includeSubDomains] - transfer-encoding: [chunked] - vary: [Accept-Encoding] - x-aspnet-version: [4.0.30319] - x-content-type-options: [nosniff] - x-powered-by: [ASP.NET] - status: {code: 200, message: OK} -- request: - body: 'b''{"properties": {"subscriptionDisplayName": "cli000001", "offerType": - "MS-AZR-0148P"}}''' - headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - CommandName: [subscriptiondefinition create] - Connection: [keep-alive] - Content-Length: ['100'] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.19 - msrest_azure/0.4.18 azure-mgmt-subscription/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.21] - accept-language: [en-US] - method: PUT - uri: https://management.azure.com/providers/Microsoft.Subscription/subscriptionDefinitions/cli000001?api-version=2017-11-01-preview - response: - body: {string: '{}'} - headers: - cache-control: [no-cache] - content-length: ['2'] - content-type: [application/json; charset=utf-8] - date: ['Fri, 15 Dec 2017 18:43:21 GMT'] - expires: ['-1'] - location: ['https://management.azure.com/providers/Microsoft.Subscription/subscriptionOperations/9bb6bad2-f835-417d-b426-367a25f4185f?api-version=2017-11-01-preview'] - pragma: [no-cache] - server: [Microsoft-IIS/8.5] - strict-transport-security: [max-age=31536000; includeSubDomains] - x-aspnet-version: [4.0.30319] - x-content-type-options: [nosniff] - x-ms-ratelimit-remaining-tenant-resource-requests: ['499'] - x-powered-by: [ASP.NET] - status: {code: 202, message: Accepted} -- request: - body: null - headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - CommandName: [subscriptiondefinition create] - Connection: [keep-alive] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.19 - msrest_azure/0.4.18 azure-mgmt-subscription/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.21] - accept-language: [en-US] - method: GET - uri: https://management.azure.com/providers/Microsoft.Subscription/subscriptionOperations/9bb6bad2-f835-417d-b426-367a25f4185f?api-version=2017-11-01-preview - response: - body: {string: '{}'} - headers: - cache-control: [no-cache] - content-length: ['2'] - content-type: [application/json; charset=utf-8] - date: ['Fri, 15 Dec 2017 18:44:22 GMT'] - expires: ['-1'] - location: ['https://management.azure.com/providers/Microsoft.Subscription/subscriptionOperations/9bb6bad2-f835-417d-b426-367a25f4185f?api-version=2017-11-01-preview'] - pragma: [no-cache] - server: [Microsoft-IIS/8.5] - strict-transport-security: [max-age=31536000; includeSubDomains] - x-aspnet-version: [4.0.30319] - x-content-type-options: [nosniff] - x-powered-by: [ASP.NET] - status: {code: 202, message: Accepted} -- request: - body: null - headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - CommandName: [subscriptiondefinition create] - Connection: [keep-alive] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.19 - msrest_azure/0.4.18 azure-mgmt-subscription/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.21] - accept-language: [en-US] - method: GET - uri: https://management.azure.com/providers/Microsoft.Subscription/subscriptionOperations/9bb6bad2-f835-417d-b426-367a25f4185f?api-version=2017-11-01-preview - response: - body: {string: '{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/cli000001","name":"cli000001","properties":{"etag":"lyWUtw==","subscriptionDisplayName":"cli000001","subscriptionId":"c8acd3e6-fe6a-49a7-83dd-74c04d4e0784","offerType":"MS-AZR-0148P"},"type":"Microsoft.Subscription/subscriptionDefinitions"}'} - headers: - cache-control: [no-cache] - content-length: ['350'] - content-type: [application/json; charset=utf-8] - date: ['Fri, 15 Dec 2017 18:45:23 GMT'] - expires: ['-1'] - pragma: [no-cache] - server: [Microsoft-IIS/8.5] - strict-transport-security: [max-age=31536000; includeSubDomains] - transfer-encoding: [chunked] - vary: [Accept-Encoding] - x-aspnet-version: [4.0.30319] - x-content-type-options: [nosniff] - x-powered-by: [ASP.NET] - status: {code: 200, message: OK} -- request: - body: null - headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - CommandName: [subscriptiondefinition list] - Connection: [keep-alive] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.19 - msrest_azure/0.4.18 azure-mgmt-subscription/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.21] - accept-language: [en-US] - method: GET - uri: https://management.azure.com/providers/Microsoft.Subscription/subscriptionDefinitions?api-version=2017-11-01-preview - response: - body: {string: '{"value":[{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/1e4333cd-c2a7-484c-bcb3-1875333cda2c","name":"1e4333cd-c2a7-484c-bcb3-1875333cda2c","properties":{"etag":"ufjPyg==","subscriptionDisplayName":"My - New Sub From PS","subscriptionId":"142ac143-af82-4306-97f0-7139f5f069da","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/MyCliSub","name":"MyCliSub","properties":{"etag":"ed0rxw==","subscriptionDisplayName":"MyCliSub","subscriptionId":"99640677-f394-4f42-a8a6-87cfdb7c0115","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/MyProdSubDef99","name":"MyProdSubDef99","properties":{"etag":"HlRr6g==","subscriptionDisplayName":"MyProdSubDef99","subscriptionId":"cefe2134-b409-4642-b030-bd7a8f107e84","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/MyProdSubscription","name":"MyProdSubscription","properties":{"etag":"MfjP0w==","subscriptionDisplayName":"MyProdSubscription","subscriptionId":"86869d42-1782-4337-98b0-c905fb937d46","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/MyTestSubDef1","name":"MyTestSubDef1","properties":{"etag":"NqYHYg==","subscriptionDisplayName":"MyTestSubDef1","subscriptionId":"368425df-b536-4f42-b1ba-64613cfcc4b5","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/cc564ad5-bb20-4c02-acf2-414e818cd3a3","name":"cc564ad5-bb20-4c02-acf2-414e818cd3a3","properties":{"etag":"siiV2A==","subscriptionDisplayName":"cc564ad5-bb20-4c02-acf2-414e818cd3a3","subscriptionId":"bf3f7279-f418-465c-a1ef-f6cafae4847b","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/cli000001","name":"cli000001","properties":{"etag":"lyWUtw==","subscriptionDisplayName":"cli000001","subscriptionId":"c8acd3e6-fe6a-49a7-83dd-74c04d4e0784","offerType":"MS-AZR-0148P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/cli7rpvvswzwddyfs5wub3l6","name":"cli7rpvvswzwddyfs5wub3l6","properties":{"etag":"g3g7JA==","subscriptionDisplayName":"cli7rpvvswzwddyfs5wub3l6","subscriptionId":"92af979c-678d-45e0-9e02-861c57ae1af3","offerType":"MS-AZR-0148P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/e2esubprod1","name":"e2esubprod1","properties":{"etag":"To8acg==","subscriptionDisplayName":"mye2esubprod1","subscriptionId":"430ed244-e513-4b13-b113-e877158ed7f5","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/e2esubprod6","name":"e2esubprod6","properties":{"etag":"YRP88g==","subscriptionDisplayName":"e2esubprod6","subscriptionId":"a21087f6-05f2-4be3-a831-185aad424df6","offerType":"MS-AZR-0148P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/e2esubprod7","name":"e2esubprod7","properties":{"etag":"DqdLvg==","subscriptionDisplayName":"e2esubprod7","subscriptionId":"519fce51-f304-4f10-9d03-777b7c47c8f0","offerType":"MS-AZR-0148P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/jlianTestProdPowerShell510","name":"jlianTestProdPowerShell510","properties":{"etag":"s4i+KA==","subscriptionDisplayName":"jlianTestProdPowerShell510","subscriptionId":"b35bb54b-3fc4-45e4-a567-a92af11b6ecb","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/jlianTestProdSub","name":"jlianTestProdSub","properties":{"etag":"7E0urw==","subscriptionDisplayName":"jlianTestProdSub","subscriptionId":"6867bab6-09ff-4dce-b789-e298924a630a","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/ps4631","name":"ps4631","properties":{"etag":"vg0lUA==","subscriptionDisplayName":"ps4631","subscriptionId":"6384690c-8764-4369-91d0-763132b9269e","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/subat201711271230","name":"subat201711271230","properties":{"etag":"VoDLkA==","subscriptionDisplayName":"Subat201711271230","subscriptionId":"5571f36c-bacb-4b1d-bff1-ca1418d142af","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/%7B%7D","name":"{}","properties":{"etag":"Dl7eYQ==","subscriptionDisplayName":"{}","subscriptionId":"46ca9650-740a-49c4-bafd-2626203b38a0","offerType":"MS-AZR-0148P"},"type":"Microsoft.Subscription/subscriptionDefinitions"}]}'} - headers: - cache-control: [no-cache] - content-length: ['5282'] - content-type: [application/json; charset=utf-8] - date: ['Fri, 15 Dec 2017 18:45:30 GMT'] - expires: ['-1'] - pragma: [no-cache] - server: [Microsoft-IIS/8.5] - strict-transport-security: [max-age=31536000; includeSubDomains] - transfer-encoding: [chunked] - vary: [Accept-Encoding] - x-aspnet-version: [4.0.30319] - x-content-type-options: [nosniff] - x-powered-by: [ASP.NET] - status: {code: 200, message: OK} -version: 1 diff --git a/src/subscription/azext_subscription/tests/latest/recordings/test_list_subscription_definitions.yaml b/src/subscription/azext_subscription/tests/latest/recordings/test_list_subscription_definitions.yaml deleted file mode 100644 index 1676c4274d1..00000000000 --- a/src/subscription/azext_subscription/tests/latest/recordings/test_list_subscription_definitions.yaml +++ /dev/null @@ -1,33 +0,0 @@ -interactions: -- request: - body: null - headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - CommandName: [subscriptiondefinition list] - Connection: [keep-alive] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.19 - msrest_azure/0.4.18 azure-mgmt-subscription/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.21] - accept-language: [en-US] - method: GET - uri: https://management.azure.com/providers/Microsoft.Subscription/subscriptionDefinitions?api-version=2017-11-01-preview - response: - body: {string: '{"value":[{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/1e4333cd-c2a7-484c-bcb3-1875333cda2c","name":"1e4333cd-c2a7-484c-bcb3-1875333cda2c","properties":{"etag":"ufjPyg==","subscriptionDisplayName":"My - New Sub From PS","subscriptionId":"142ac143-af82-4306-97f0-7139f5f069da","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/MyCliSub","name":"MyCliSub","properties":{"etag":"ed0rxw==","subscriptionDisplayName":"MyCliSub","subscriptionId":"99640677-f394-4f42-a8a6-87cfdb7c0115","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/MyProdSubDef99","name":"MyProdSubDef99","properties":{"etag":"HlRr6g==","subscriptionDisplayName":"MyProdSubDef99","subscriptionId":"cefe2134-b409-4642-b030-bd7a8f107e84","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/MyProdSubscription","name":"MyProdSubscription","properties":{"etag":"MfjP0w==","subscriptionDisplayName":"MyProdSubscription","subscriptionId":"86869d42-1782-4337-98b0-c905fb937d46","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/MyTestSubDef1","name":"MyTestSubDef1","properties":{"etag":"NqYHYg==","subscriptionDisplayName":"MyTestSubDef1","subscriptionId":"368425df-b536-4f42-b1ba-64613cfcc4b5","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/cc564ad5-bb20-4c02-acf2-414e818cd3a3","name":"cc564ad5-bb20-4c02-acf2-414e818cd3a3","properties":{"etag":"siiV2A==","subscriptionDisplayName":"cc564ad5-bb20-4c02-acf2-414e818cd3a3","subscriptionId":"bf3f7279-f418-465c-a1ef-f6cafae4847b","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/e2esubprod1","name":"e2esubprod1","properties":{"etag":"To8acg==","subscriptionDisplayName":"mye2esubprod1","subscriptionId":"430ed244-e513-4b13-b113-e877158ed7f5","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/e2esubprod6","name":"e2esubprod6","properties":{"etag":"YRP88g==","subscriptionDisplayName":"e2esubprod6","subscriptionId":"a21087f6-05f2-4be3-a831-185aad424df6","offerType":"MS-AZR-0148P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/e2esubprod7","name":"e2esubprod7","properties":{"etag":"DqdLvg==","subscriptionDisplayName":"e2esubprod7","subscriptionId":"519fce51-f304-4f10-9d03-777b7c47c8f0","offerType":"MS-AZR-0148P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/jlianTestProdPowerShell510","name":"jlianTestProdPowerShell510","properties":{"etag":"s4i+KA==","subscriptionDisplayName":"jlianTestProdPowerShell510","subscriptionId":"b35bb54b-3fc4-45e4-a567-a92af11b6ecb","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/jlianTestProdSub","name":"jlianTestProdSub","properties":{"etag":"7E0urw==","subscriptionDisplayName":"jlianTestProdSub","subscriptionId":"6867bab6-09ff-4dce-b789-e298924a630a","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/ps4631","name":"ps4631","properties":{"etag":"vg0lUA==","subscriptionDisplayName":"ps4631","subscriptionId":"6384690c-8764-4369-91d0-763132b9269e","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/subat201711271230","name":"subat201711271230","properties":{"etag":"VoDLkA==","subscriptionDisplayName":"Subat201711271230","subscriptionId":"5571f36c-bacb-4b1d-bff1-ca1418d142af","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"}]}'} - headers: - cache-control: [no-cache] - content-length: ['4291'] - content-type: [application/json; charset=utf-8] - date: ['Fri, 15 Dec 2017 18:09:48 GMT'] - expires: ['-1'] - pragma: [no-cache] - server: [Microsoft-IIS/8.5] - strict-transport-security: [max-age=31536000; includeSubDomains] - transfer-encoding: [chunked] - vary: [Accept-Encoding] - x-aspnet-version: [4.0.30319] - x-content-type-options: [nosniff] - x-powered-by: [ASP.NET] - status: {code: 200, message: OK} -version: 1 diff --git a/src/subscription/azext_subscription/tests/latest/recordings/test_show_subscription_definitions.yaml b/src/subscription/azext_subscription/tests/latest/recordings/test_show_subscription_definitions.yaml deleted file mode 100644 index a6e05b11497..00000000000 --- a/src/subscription/azext_subscription/tests/latest/recordings/test_show_subscription_definitions.yaml +++ /dev/null @@ -1,64 +0,0 @@ -interactions: -- request: - body: null - headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - CommandName: [subscriptiondefinition list] - Connection: [keep-alive] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.19 - msrest_azure/0.4.18 azure-mgmt-subscription/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.21] - accept-language: [en-US] - method: GET - uri: https://management.azure.com/providers/Microsoft.Subscription/subscriptionDefinitions?api-version=2017-11-01-preview - response: - body: {string: '{"value":[{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/1e4333cd-c2a7-484c-bcb3-1875333cda2c","name":"1e4333cd-c2a7-484c-bcb3-1875333cda2c","properties":{"etag":"ufjPyg==","subscriptionDisplayName":"My - New Sub From PS","subscriptionId":"142ac143-af82-4306-97f0-7139f5f069da","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/MyCliSub","name":"MyCliSub","properties":{"etag":"ed0rxw==","subscriptionDisplayName":"MyCliSub","subscriptionId":"99640677-f394-4f42-a8a6-87cfdb7c0115","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/MyProdSubDef99","name":"MyProdSubDef99","properties":{"etag":"HlRr6g==","subscriptionDisplayName":"MyProdSubDef99","subscriptionId":"cefe2134-b409-4642-b030-bd7a8f107e84","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/MyProdSubscription","name":"MyProdSubscription","properties":{"etag":"MfjP0w==","subscriptionDisplayName":"MyProdSubscription","subscriptionId":"86869d42-1782-4337-98b0-c905fb937d46","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/MyTestSubDef1","name":"MyTestSubDef1","properties":{"etag":"NqYHYg==","subscriptionDisplayName":"MyTestSubDef1","subscriptionId":"368425df-b536-4f42-b1ba-64613cfcc4b5","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/cc564ad5-bb20-4c02-acf2-414e818cd3a3","name":"cc564ad5-bb20-4c02-acf2-414e818cd3a3","properties":{"etag":"siiV2A==","subscriptionDisplayName":"cc564ad5-bb20-4c02-acf2-414e818cd3a3","subscriptionId":"bf3f7279-f418-465c-a1ef-f6cafae4847b","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/cli3zvjknts6runuzx2fqabo","name":"cli3zvjknts6runuzx2fqabo","properties":{"etag":"lyWUtw==","subscriptionDisplayName":"cli3zvjknts6runuzx2fqabo","subscriptionId":"c8acd3e6-fe6a-49a7-83dd-74c04d4e0784","offerType":"MS-AZR-0148P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/cli7rpvvswzwddyfs5wub3l6","name":"cli7rpvvswzwddyfs5wub3l6","properties":{"etag":"g3g7JA==","subscriptionDisplayName":"cli7rpvvswzwddyfs5wub3l6","subscriptionId":"92af979c-678d-45e0-9e02-861c57ae1af3","offerType":"MS-AZR-0148P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/e2esubprod1","name":"e2esubprod1","properties":{"etag":"To8acg==","subscriptionDisplayName":"mye2esubprod1","subscriptionId":"430ed244-e513-4b13-b113-e877158ed7f5","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/e2esubprod6","name":"e2esubprod6","properties":{"etag":"YRP88g==","subscriptionDisplayName":"e2esubprod6","subscriptionId":"a21087f6-05f2-4be3-a831-185aad424df6","offerType":"MS-AZR-0148P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/e2esubprod7","name":"e2esubprod7","properties":{"etag":"DqdLvg==","subscriptionDisplayName":"e2esubprod7","subscriptionId":"519fce51-f304-4f10-9d03-777b7c47c8f0","offerType":"MS-AZR-0148P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/jlianTestProdPowerShell510","name":"jlianTestProdPowerShell510","properties":{"etag":"s4i+KA==","subscriptionDisplayName":"jlianTestProdPowerShell510","subscriptionId":"b35bb54b-3fc4-45e4-a567-a92af11b6ecb","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/jlianTestProdSub","name":"jlianTestProdSub","properties":{"etag":"7E0urw==","subscriptionDisplayName":"jlianTestProdSub","subscriptionId":"6867bab6-09ff-4dce-b789-e298924a630a","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/ps4631","name":"ps4631","properties":{"etag":"vg0lUA==","subscriptionDisplayName":"ps4631","subscriptionId":"6384690c-8764-4369-91d0-763132b9269e","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/subat201711271230","name":"subat201711271230","properties":{"etag":"VoDLkA==","subscriptionDisplayName":"Subat201711271230","subscriptionId":"5571f36c-bacb-4b1d-bff1-ca1418d142af","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"},{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/%7B%7D","name":"{}","properties":{"etag":"Dl7eYQ==","subscriptionDisplayName":"{}","subscriptionId":"46ca9650-740a-49c4-bafd-2626203b38a0","offerType":"MS-AZR-0148P"},"type":"Microsoft.Subscription/subscriptionDefinitions"}]}'} - headers: - cache-control: [no-cache] - content-length: ['5282'] - content-type: [application/json; charset=utf-8] - date: ['Sat, 16 Dec 2017 00:25:10 GMT'] - expires: ['-1'] - pragma: [no-cache] - server: [Microsoft-IIS/8.5] - strict-transport-security: [max-age=31536000; includeSubDomains] - transfer-encoding: [chunked] - vary: [Accept-Encoding] - x-aspnet-version: [4.0.30319] - x-content-type-options: [nosniff] - x-powered-by: [ASP.NET] - status: {code: 200, message: OK} -- request: - body: null - headers: - Accept: [application/json] - Accept-Encoding: ['gzip, deflate'] - CommandName: [subscriptiondefinition show] - Connection: [keep-alive] - Content-Type: [application/json; charset=utf-8] - User-Agent: [python/3.6.3 (Windows-10-10.0.16299-SP0) requests/2.18.4 msrest/0.4.19 - msrest_azure/0.4.18 azure-mgmt-subscription/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.21] - accept-language: [en-US] - method: GET - uri: https://management.azure.com/providers/Microsoft.Subscription/subscriptionDefinitions/1e4333cd-c2a7-484c-bcb3-1875333cda2c?api-version=2017-11-01-preview - response: - body: {string: '{"id":"/providers/Microsoft.Subscription/subscriptionDefinitions/1e4333cd-c2a7-484c-bcb3-1875333cda2c","name":"1e4333cd-c2a7-484c-bcb3-1875333cda2c","properties":{"etag":"ufjPyg==","subscriptionDisplayName":"My - New Sub From PS","subscriptionId":"142ac143-af82-4306-97f0-7139f5f069da","offerType":"MS-AZR-0017P"},"type":"Microsoft.Subscription/subscriptionDefinitions"}'} - headers: - cache-control: [no-cache] - content-length: ['368'] - content-type: [application/json; charset=utf-8] - date: ['Sat, 16 Dec 2017 00:25:12 GMT'] - expires: ['-1'] - pragma: [no-cache] - server: [Microsoft-IIS/8.5] - strict-transport-security: [max-age=31536000; includeSubDomains] - transfer-encoding: [chunked] - vary: [Accept-Encoding] - x-aspnet-version: [4.0.30319] - x-content-type-options: [nosniff] - x-powered-by: [ASP.NET] - status: {code: 200, message: OK} -version: 1 diff --git a/src/subscription/azext_subscription/tests/latest/test_subscription_commands.py b/src/subscription/azext_subscription/tests/latest/test_subscription_commands.py new file mode 100644 index 00000000000..8417f1bc94b --- /dev/null +++ b/src/subscription/azext_subscription/tests/latest/test_subscription_commands.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long +# pylint: disable=too-few-public-methods + +from azure.cli.testsdk import ScenarioTest + + +class AzureSubscriptionScenarioTest(ScenarioTest): + def test_create_subscription(self): + enrollment_accounts = self.cmd('billing enrollment-account list').get_output_in_json() + result = self.cmd('account create --enrollment-account-name {} --offer-type MS-AZR-0148P'.format(enrollment_accounts[0].name)).get_output_in_json() + self.assertIsNotNone(result) + self.assertIsNotNone(result.subscription_link) diff --git a/src/subscription/azext_subscription/tests/latest/test_subscription_definition_commands.py b/src/subscription/azext_subscription/tests/latest/test_subscription_definition_commands.py deleted file mode 100644 index 0c50e59e164..00000000000 --- a/src/subscription/azext_subscription/tests/latest/test_subscription_definition_commands.py +++ /dev/null @@ -1,36 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - -# pylint: disable=line-too-long - -from azure.cli.testsdk import ScenarioTest - - -class AzureSubscriptionDefinitionScenarioTest(ScenarioTest): - def test_list_subscription_definitions(self): - sub_def_list = self.cmd('account subscription-definition list').get_output_in_json() - self.assertGreater(len(sub_def_list), 0) - self.assertIsNotNone(sub_def_list[0]) - self.assertIsNotNone(sub_def_list[0]['name']) - self.assertIsNotNone(sub_def_list[0]['subscriptionId']) - self.assertIsNotNone(sub_def_list[0]['subscriptionDisplayName']) - - def test_show_subscription_definitions(self): - first_sub_def = self.cmd('account subscription-definition list').get_output_in_json()[0] - self.assertIsNotNone(first_sub_def) - self.assertIsNotNone(first_sub_def['name']) - sub_def = self.cmd('account subscription-definition show -n {}'.format(first_sub_def['name'])).get_output_in_json() - self.assertIsNotNone(sub_def) - self.assertEqual(sub_def['name'], first_sub_def['name']) - - def test_create_subscription_definitions(self): - sub_def_list_count_before = len(self.cmd('account subscription-definition list').get_output_in_json()) - def_name = self.create_random_name(prefix='cli', length=24) - sub_def = self.cmd('account subscription-definition create -n {} --offer-type MS-AZR-0148P'.format(def_name)).get_output_in_json() - sub_def_list_count_after = len(self.cmd('account subscription-definition list').get_output_in_json()) - self.assertIsNotNone(sub_def) - self.assertEqual(def_name, sub_def['name']) - self.assertEqual(def_name, sub_def['subscriptionDisplayName']) - self.assertEqual(sub_def_list_count_after, sub_def_list_count_before + 1) diff --git a/src/subscription/setup.py b/src/subscription/setup.py index b03304e4c1c..ca53bd43607 100644 --- a/src/subscription/setup.py +++ b/src/subscription/setup.py @@ -8,7 +8,7 @@ from codecs import open from setuptools import setup, find_packages -VERSION = "0.1.0" +VERSION = "0.1.1" CLASSIFIERS = [ 'Development Status :: 4 - Beta', @@ -29,8 +29,8 @@ setup( name='subscription', version=VERSION, - description='An Azure CLI Extension to manage Subscription Definitions', - long_description='An Azure CLI Extension to manage Subscription Definitions', + description='Support for subscription management preview.', + long_description='Support for subscription management preview.', license='MIT', author='Wilco Bauwer', author_email='wilcob@microsoft.com',