diff --git a/azure-mgmt-subscription/HISTORY.rst b/azure-mgmt-subscription/HISTORY.rst index 6571b7645be1..e4de8b31d01b 100644 --- a/azure-mgmt-subscription/HISTORY.rst +++ b/azure-mgmt-subscription/HISTORY.rst @@ -3,6 +3,11 @@ Release History =============== +0.2.0 (2018-04-01) +++++++++++++++++++ + +* Add subscription creation API + 0.1.0 (2017-12-11) ++++++++++++++++++ diff --git a/azure-mgmt-subscription/azure/mgmt/subscription/models/__init__.py b/azure-mgmt-subscription/azure/mgmt/subscription/models/__init__.py index 6611f4ef8fb7..714aff9a52e8 100644 --- a/azure-mgmt-subscription/azure/mgmt/subscription/models/__init__.py +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/models/ad_principal.py b/azure-mgmt-subscription/azure/mgmt/subscription/models/ad_principal.py new file mode 100644 index 000000000000..8063b8341622 --- /dev/null +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/models/ad_principal_py3.py b/azure-mgmt-subscription/azure/mgmt/subscription/models/ad_principal_py3.py new file mode 100644 index 000000000000..8c6466a671f9 --- /dev/null +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/models/error_response.py b/azure-mgmt-subscription/azure/mgmt/subscription/models/error_response.py index 2cc2d8d68514..b3d490a49503 100644 --- a/azure-mgmt-subscription/azure/mgmt/subscription/models/error_response.py +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/models/error_response_py3.py b/azure-mgmt-subscription/azure/mgmt/subscription/models/error_response_py3.py new file mode 100644 index 000000000000..5504940d6873 --- /dev/null +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/models/location.py b/azure-mgmt-subscription/azure/mgmt/subscription/models/location.py index ee2afd412c6b..691616984d27 100644 --- a/azure-mgmt-subscription/azure/mgmt/subscription/models/location.py +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/models/location_py3.py b/azure-mgmt-subscription/azure/mgmt/subscription/models/location_py3.py new file mode 100644 index 000000000000..40af216a6647 --- /dev/null +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/models/operation.py b/azure-mgmt-subscription/azure/mgmt/subscription/models/operation.py index d9088e03cfde..c07607304e25 100644 --- a/azure-mgmt-subscription/azure/mgmt/subscription/models/operation.py +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/models/operation_display.py b/azure-mgmt-subscription/azure/mgmt/subscription/models/operation_display.py index 405bad34fa1a..990aaa272913 100644 --- a/azure-mgmt-subscription/azure/mgmt/subscription/models/operation_display.py +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/models/operation_display_py3.py b/azure-mgmt-subscription/azure/mgmt/subscription/models/operation_display_py3.py new file mode 100644 index 000000000000..7f6ba3c819db --- /dev/null +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/models/operation_list_result.py b/azure-mgmt-subscription/azure/mgmt/subscription/models/operation_list_result.py new file mode 100644 index 000000000000..1833b37c8c70 --- /dev/null +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/models/operation_list_result_py3.py b/azure-mgmt-subscription/azure/mgmt/subscription/models/operation_list_result_py3.py new file mode 100644 index 000000000000..573e35ed80c1 --- /dev/null +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/models/operation_py3.py b/azure-mgmt-subscription/azure/mgmt/subscription/models/operation_py3.py new file mode 100644 index 000000000000..e6823f8d5618 --- /dev/null +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/models/subscription.py b/azure-mgmt-subscription/azure/mgmt/subscription/models/subscription.py index 363a487bbd2b..0af82c0632b4 100644 --- a/azure-mgmt-subscription/azure/mgmt/subscription/models/subscription.py +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/models/subscription_client_enums.py b/azure-mgmt-subscription/azure/mgmt/subscription/models/subscription_client_enums.py index edfce74d4f8a..95601304f532 100644 --- a/azure-mgmt-subscription/azure/mgmt/subscription/models/subscription_client_enums.py +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/models/subscription_creation_parameters.py b/azure-mgmt-subscription/azure/mgmt/subscription/models/subscription_creation_parameters.py new file mode 100644 index 000000000000..da5f3a437e47 --- /dev/null +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/models/subscription_creation_parameters_py3.py b/azure-mgmt-subscription/azure/mgmt/subscription/models/subscription_creation_parameters_py3.py new file mode 100644 index 000000000000..3f9693014ab4 --- /dev/null +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/models/operation_paged.py b/azure-mgmt-subscription/azure/mgmt/subscription/models/subscription_creation_result.py similarity index 52% rename from azure-mgmt-subscription/azure/mgmt/subscription/models/operation_paged.py rename to azure-mgmt-subscription/azure/mgmt/subscription/models/subscription_creation_result.py index 4427c2811b17..754c0a8ee258 100644 --- a/azure-mgmt-subscription/azure/mgmt/subscription/models/operation_paged.py +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/models/subscription_definition_paged.py b/azure-mgmt-subscription/azure/mgmt/subscription/models/subscription_creation_result_py3.py similarity index 51% rename from azure-mgmt-subscription/azure/mgmt/subscription/models/subscription_definition_paged.py rename to azure-mgmt-subscription/azure/mgmt/subscription/models/subscription_creation_result_py3.py index 1f183fbd3e75..d5fd62e68787 100644 --- a/azure-mgmt-subscription/azure/mgmt/subscription/models/subscription_definition_paged.py +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/models/subscription_definition.py b/azure-mgmt-subscription/azure/mgmt/subscription/models/subscription_definition.py deleted file mode 100644 index 07da90b83024..000000000000 --- a/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/models/subscription_operation.py b/azure-mgmt-subscription/azure/mgmt/subscription/models/subscription_operation.py new file mode 100644 index 000000000000..fe6c6ca2271d --- /dev/null +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/models/subscription_operation_list_result.py b/azure-mgmt-subscription/azure/mgmt/subscription/models/subscription_operation_list_result.py new file mode 100644 index 000000000000..0badcdcba5a6 --- /dev/null +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/models/subscription_operation_list_result_py3.py b/azure-mgmt-subscription/azure/mgmt/subscription/models/subscription_operation_list_result_py3.py new file mode 100644 index 000000000000..19ed87ef03f5 --- /dev/null +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/models/subscription_operation_py3.py b/azure-mgmt-subscription/azure/mgmt/subscription/models/subscription_operation_py3.py new file mode 100644 index 000000000000..7f06c48b38e2 --- /dev/null +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/models/subscription_policies.py b/azure-mgmt-subscription/azure/mgmt/subscription/models/subscription_policies.py index 58f9751348fe..2d6c5bbc3497 100644 --- a/azure-mgmt-subscription/azure/mgmt/subscription/models/subscription_policies.py +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/models/subscription_policies_py3.py b/azure-mgmt-subscription/azure/mgmt/subscription/models/subscription_policies_py3.py new file mode 100644 index 000000000000..3597539f7076 --- /dev/null +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/models/subscription_py3.py b/azure-mgmt-subscription/azure/mgmt/subscription/models/subscription_py3.py new file mode 100644 index 000000000000..e7b0830a8782 --- /dev/null +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/models/tenant_id_description.py b/azure-mgmt-subscription/azure/mgmt/subscription/models/tenant_id_description.py index 4ff09fcd06c5..dc4ddc3edde9 100644 --- a/azure-mgmt-subscription/azure/mgmt/subscription/models/tenant_id_description.py +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/models/tenant_id_description_py3.py b/azure-mgmt-subscription/azure/mgmt/subscription/models/tenant_id_description_py3.py new file mode 100644 index 000000000000..3b1103d1b9dd --- /dev/null +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/operations/__init__.py b/azure-mgmt-subscription/azure/mgmt/subscription/operations/__init__.py index bd84d2adb137..8c27fcc434fa 100644 --- a/azure-mgmt-subscription/azure/mgmt/subscription/operations/__init__.py +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/operations/operations.py b/azure-mgmt-subscription/azure/mgmt/subscription/operations/operations.py new file mode 100644 index 000000000000..d0ed66a69906 --- /dev/null +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/operations/subscription_definitions_operation_metadata_operations.py b/azure-mgmt-subscription/azure/mgmt/subscription/operations/subscription_definitions_operation_metadata_operations.py deleted file mode 100644 index 2054c64dcf6d..000000000000 --- a/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/operations/subscription_definitions_operations.py b/azure-mgmt-subscription/azure/mgmt/subscription/operations/subscription_definitions_operations.py deleted file mode 100644 index 66855a561870..000000000000 --- a/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/operations/subscription_factory_operations.py b/azure-mgmt-subscription/azure/mgmt/subscription/operations/subscription_factory_operations.py new file mode 100644 index 000000000000..a210f0d22ca8 --- /dev/null +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/operations/subscription_operations.py b/azure-mgmt-subscription/azure/mgmt/subscription/operations/subscription_operations.py new file mode 100644 index 000000000000..055d3109fa0f --- /dev/null +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/operations/subscriptions_operations.py b/azure-mgmt-subscription/azure/mgmt/subscription/operations/subscriptions_operations.py index a1afbc3fb4bf..c42bd53d4d38 100644 --- a/azure-mgmt-subscription/azure/mgmt/subscription/operations/subscriptions_operations.py +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/operations/tenants_operations.py b/azure-mgmt-subscription/azure/mgmt/subscription/operations/tenants_operations.py index c5c440db15c6..e3d96b6c6a8b 100644 --- a/azure-mgmt-subscription/azure/mgmt/subscription/operations/tenants_operations.py +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/subscription_client.py b/azure-mgmt-subscription/azure/mgmt/subscription/subscription_client.py index 0d1abe155ee5..b4ad84e9e72b 100644 --- a/azure-mgmt-subscription/azure/mgmt/subscription/subscription_client.py +++ b/azure-mgmt-subscription/azure/mgmt/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/azure-mgmt-subscription/azure/mgmt/subscription/version.py b/azure-mgmt-subscription/azure/mgmt/subscription/version.py index e0ec669828cb..9bd1dfac7ecb 100644 --- a/azure-mgmt-subscription/azure/mgmt/subscription/version.py +++ b/azure-mgmt-subscription/azure/mgmt/subscription/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.1.0" +VERSION = "0.2.0" diff --git a/azure-mgmt-subscription/build.json b/azure-mgmt-subscription/build.json new file mode 100644 index 000000000000..14c6bc03ba0d --- /dev/null +++ b/azure-mgmt-subscription/build.json @@ -0,0 +1,667 @@ +{ + "autorest": [ + { + "resolvedInfo": null, + "packageMetadata": { + "name": "@microsoft.azure/autorest-core", + "version": "2.0.4259", + "engines": { + "node": ">=7.10.0" + }, + "dependencies": {}, + "optionalDependencies": {}, + "devDependencies": { + "@types/commonmark": "^0.27.0", + "@types/js-yaml": "^3.10.0", + "@types/jsonpath": "^0.1.29", + "@types/node": "^8.0.53", + "@types/source-map": "0.5.0", + "@types/yargs": "^8.0.2", + "@types/z-schema": "^3.16.31", + "dts-generator": "^2.1.0", + "mocha": "^4.0.1", + "mocha-typescript": "^1.1.7", + "shx": "0.2.2", + "static-link": "^0.2.3", + "vscode-jsonrpc": "^3.3.1" + }, + "bundleDependencies": false, + "peerDependencies": {}, + "deprecated": false, + "_resolved": "/tmp/.autorest/@microsoft.azure_autorest-core@2.0.4259/node_modules/@microsoft.azure/autorest-core", + "_integrity": null, + "_shasum": "d7d762d9e7ed3b5c097aeb8d9a5804d768adee6a", + "_shrinkwrap": null, + "bin": { + "autorest-core": "./dist/app.js", + "autorest-language-service": "dist/language-service/language-service.js" + }, + "_id": "@microsoft.azure/autorest-core@2.0.4259", + "_from": "file:/tmp/.autorest/@microsoft.azure_autorest-core@2.0.4259/node_modules/@microsoft.azure/autorest-core", + "_requested": { + "type": "directory", + "where": "/tmp/.autorest/@microsoft.azure_autorest-core@2.0.4259/node_modules/@microsoft.azure/autorest-core", + "raw": "/tmp/.autorest/@microsoft.azure_autorest-core@2.0.4259/node_modules/@microsoft.azure/autorest-core", + "rawSpec": "/tmp/.autorest/@microsoft.azure_autorest-core@2.0.4259/node_modules/@microsoft.azure/autorest-core", + "saveSpec": "file:/tmp/.autorest/@microsoft.azure_autorest-core@2.0.4259/node_modules/@microsoft.azure/autorest-core", + "fetchSpec": "/tmp/.autorest/@microsoft.azure_autorest-core@2.0.4259/node_modules/@microsoft.azure/autorest-core" + }, + "_spec": "/tmp/.autorest/@microsoft.azure_autorest-core@2.0.4259/node_modules/@microsoft.azure/autorest-core", + "_where": "/tmp/.autorest/@microsoft.azure_autorest-core@2.0.4259/node_modules/@microsoft.azure/autorest-core" + }, + "extensionManager": { + "installationPath": "/tmp/.autorest", + "sharedLock": { + "name": "/tmp/.autorest", + "exclusiveLock": { + "name": "_tmp_.autorest.exclusive-lock", + "options": { + "port": 5245, + "host": "2130716018", + "exclusive": true + }, + "pipe": "/tmp/pipe__tmp_.autorest.exclusive-lock:5245" + }, + "busyLock": { + "name": "_tmp_.autorest.busy-lock", + "options": { + "port": 46071, + "host": "2130735832", + "exclusive": true + }, + "pipe": "/tmp/pipe__tmp_.autorest.busy-lock:46071" + }, + "personalLock": { + "name": "_tmp_.autorest.9461.87243551275.personal-lock", + "options": { + "port": 47556, + "host": "2130710431", + "exclusive": true + }, + "pipe": "/tmp/pipe__tmp_.autorest.9461.87243551275.personal-lock:47556" + }, + "file": "/tmp/_tmp_.autorest.lock" + }, + "dotnetPath": "/root/.dotnet" + }, + "installationPath": "/tmp/.autorest" + }, + { + "resolvedInfo": null, + "packageMetadata": { + "name": "@microsoft.azure/autorest.modeler", + "version": "2.0.21", + "dependencies": { + "dotnet-2.0.0": "^1.3.2" + }, + "optionalDependencies": {}, + "devDependencies": { + "coffee-script": "^1.11.1", + "dotnet-sdk-2.0.0": "^1.1.1", + "gulp": "^3.9.1", + "gulp-filter": "^5.0.0", + "gulp-line-ending-corrector": "^1.0.1", + "iced-coffee-script": "^108.0.11", + "marked": "^0.3.6", + "marked-terminal": "^2.0.0", + "moment": "^2.17.1", + "run-sequence": "*", + "shx": "^0.2.2", + "through2-parallel": "^0.1.3", + "yargs": "^8.0.2", + "yarn": "^1.0.2" + }, + "bundleDependencies": false, + "peerDependencies": {}, + "deprecated": false, + "_resolved": "/tmp/.autorest/@microsoft.azure_autorest.modeler@2.0.21/node_modules/@microsoft.azure/autorest.modeler", + "_integrity": null, + "_shasum": "3ce7d3939124b31830be15e5de99b9b7768afb90", + "_shrinkwrap": null, + "bin": null, + "_id": "@microsoft.azure/autorest.modeler@2.0.21", + "_from": "file:/tmp/.autorest/@microsoft.azure_autorest.modeler@2.0.21/node_modules/@microsoft.azure/autorest.modeler", + "_requested": { + "type": "directory", + "where": "/tmp/.autorest/@microsoft.azure_autorest.modeler@2.0.21/node_modules/@microsoft.azure/autorest.modeler", + "raw": "/tmp/.autorest/@microsoft.azure_autorest.modeler@2.0.21/node_modules/@microsoft.azure/autorest.modeler", + "rawSpec": "/tmp/.autorest/@microsoft.azure_autorest.modeler@2.0.21/node_modules/@microsoft.azure/autorest.modeler", + "saveSpec": "file:/tmp/.autorest/@microsoft.azure_autorest.modeler@2.0.21/node_modules/@microsoft.azure/autorest.modeler", + "fetchSpec": "/tmp/.autorest/@microsoft.azure_autorest.modeler@2.0.21/node_modules/@microsoft.azure/autorest.modeler" + }, + "_spec": "/tmp/.autorest/@microsoft.azure_autorest.modeler@2.0.21/node_modules/@microsoft.azure/autorest.modeler", + "_where": "/tmp/.autorest/@microsoft.azure_autorest.modeler@2.0.21/node_modules/@microsoft.azure/autorest.modeler" + }, + "extensionManager": { + "installationPath": "/tmp/.autorest", + "sharedLock": { + "name": "/tmp/.autorest", + "exclusiveLock": { + "name": "_tmp_.autorest.exclusive-lock", + "options": { + "port": 5245, + "host": "2130716018", + "exclusive": true + }, + "pipe": "/tmp/pipe__tmp_.autorest.exclusive-lock:5245" + }, + "busyLock": { + "name": "_tmp_.autorest.busy-lock", + "options": { + "port": 46071, + "host": "2130735832", + "exclusive": true + }, + "pipe": "/tmp/pipe__tmp_.autorest.busy-lock:46071" + }, + "personalLock": { + "name": "_tmp_.autorest.9461.87243551275.personal-lock", + "options": { + "port": 47556, + "host": "2130710431", + "exclusive": true + }, + "pipe": "/tmp/pipe__tmp_.autorest.9461.87243551275.personal-lock:47556" + }, + "file": "/tmp/_tmp_.autorest.lock" + }, + "dotnetPath": "/root/.dotnet" + }, + "installationPath": "/tmp/.autorest" + }, + { + "resolvedInfo": null, + "packageMetadata": { + "name": "@microsoft.azure/autorest.modeler", + "version": "2.3.44", + "dependencies": { + "dotnet-2.0.0": "^1.4.4" + }, + "optionalDependencies": {}, + "devDependencies": { + "@microsoft.azure/autorest.testserver": "2.3.17", + "autorest": "^2.0.4225", + "coffee-script": "^1.11.1", + "dotnet-sdk-2.0.0": "^1.4.4", + "gulp": "^3.9.1", + "gulp-filter": "^5.0.0", + "gulp-line-ending-corrector": "^1.0.1", + "iced-coffee-script": "^108.0.11", + "marked": "^0.3.6", + "marked-terminal": "^2.0.0", + "moment": "^2.17.1", + "run-sequence": "*", + "shx": "^0.2.2", + "through2-parallel": "^0.1.3", + "yargs": "^8.0.2", + "yarn": "^1.0.2" + }, + "bundleDependencies": false, + "peerDependencies": {}, + "deprecated": false, + "_resolved": "/tmp/.autorest/@microsoft.azure_autorest.modeler@2.3.44/node_modules/@microsoft.azure/autorest.modeler", + "_integrity": null, + "_shasum": "9b5a880a77467be33a77f002f03230d3ccc21266", + "_shrinkwrap": null, + "bin": null, + "_id": "@microsoft.azure/autorest.modeler@2.3.44", + "_from": "file:/tmp/.autorest/@microsoft.azure_autorest.modeler@2.3.44/node_modules/@microsoft.azure/autorest.modeler", + "_requested": { + "type": "directory", + "where": "/tmp/.autorest/@microsoft.azure_autorest.modeler@2.3.44/node_modules/@microsoft.azure/autorest.modeler", + "raw": "/tmp/.autorest/@microsoft.azure_autorest.modeler@2.3.44/node_modules/@microsoft.azure/autorest.modeler", + "rawSpec": "/tmp/.autorest/@microsoft.azure_autorest.modeler@2.3.44/node_modules/@microsoft.azure/autorest.modeler", + "saveSpec": "file:/tmp/.autorest/@microsoft.azure_autorest.modeler@2.3.44/node_modules/@microsoft.azure/autorest.modeler", + "fetchSpec": "/tmp/.autorest/@microsoft.azure_autorest.modeler@2.3.44/node_modules/@microsoft.azure/autorest.modeler" + }, + "_spec": "/tmp/.autorest/@microsoft.azure_autorest.modeler@2.3.44/node_modules/@microsoft.azure/autorest.modeler", + "_where": "/tmp/.autorest/@microsoft.azure_autorest.modeler@2.3.44/node_modules/@microsoft.azure/autorest.modeler" + }, + "extensionManager": { + "installationPath": "/tmp/.autorest", + "sharedLock": { + "name": "/tmp/.autorest", + "exclusiveLock": { + "name": "_tmp_.autorest.exclusive-lock", + "options": { + "port": 5245, + "host": "2130716018", + "exclusive": true + }, + "pipe": "/tmp/pipe__tmp_.autorest.exclusive-lock:5245" + }, + "busyLock": { + "name": "_tmp_.autorest.busy-lock", + "options": { + "port": 46071, + "host": "2130735832", + "exclusive": true + }, + "pipe": "/tmp/pipe__tmp_.autorest.busy-lock:46071" + }, + "personalLock": { + "name": "_tmp_.autorest.9461.87243551275.personal-lock", + "options": { + "port": 47556, + "host": "2130710431", + "exclusive": true + }, + "pipe": "/tmp/pipe__tmp_.autorest.9461.87243551275.personal-lock:47556" + }, + "file": "/tmp/_tmp_.autorest.lock" + }, + "dotnetPath": "/root/.dotnet" + }, + "installationPath": "/tmp/.autorest" + }, + { + "resolvedInfo": null, + "packageMetadata": { + "name": "@microsoft.azure/autorest.python", + "version": "2.1.40", + "dependencies": { + "dotnet-2.0.0": "^1.4.4" + }, + "optionalDependencies": {}, + "devDependencies": { + "@microsoft.azure/autorest.testserver": "^2.4.0", + "autorest": "^2.0.4203", + "coffee-script": "^1.11.1", + "dotnet-sdk-2.0.0": "^1.4.4", + "gulp": "^3.9.1", + "gulp-filter": "^5.0.0", + "gulp-line-ending-corrector": "^1.0.1", + "iced-coffee-script": "^108.0.11", + "marked": "^0.3.6", + "marked-terminal": "^2.0.0", + "moment": "^2.17.1", + "run-sequence": "*", + "shx": "^0.2.2", + "through2-parallel": "^0.1.3", + "yargs": "^8.0.2", + "yarn": "^1.0.2" + }, + "bundleDependencies": false, + "peerDependencies": {}, + "deprecated": false, + "_resolved": "/tmp/.autorest/@microsoft.azure_autorest.python@2.1.40/node_modules/@microsoft.azure/autorest.python", + "_integrity": null, + "_shasum": "9b3f08c892d725ac571b3a7dc8f781d76da64397", + "_shrinkwrap": null, + "bin": null, + "_id": "@microsoft.azure/autorest.python@2.1.40", + "_from": "file:/tmp/.autorest/@microsoft.azure_autorest.python@2.1.40/node_modules/@microsoft.azure/autorest.python", + "_requested": { + "type": "directory", + "where": "/tmp/.autorest/@microsoft.azure_autorest.python@2.1.40/node_modules/@microsoft.azure/autorest.python", + "raw": "/tmp/.autorest/@microsoft.azure_autorest.python@2.1.40/node_modules/@microsoft.azure/autorest.python", + "rawSpec": "/tmp/.autorest/@microsoft.azure_autorest.python@2.1.40/node_modules/@microsoft.azure/autorest.python", + "saveSpec": "file:/tmp/.autorest/@microsoft.azure_autorest.python@2.1.40/node_modules/@microsoft.azure/autorest.python", + "fetchSpec": "/tmp/.autorest/@microsoft.azure_autorest.python@2.1.40/node_modules/@microsoft.azure/autorest.python" + }, + "_spec": "/tmp/.autorest/@microsoft.azure_autorest.python@2.1.40/node_modules/@microsoft.azure/autorest.python", + "_where": "/tmp/.autorest/@microsoft.azure_autorest.python@2.1.40/node_modules/@microsoft.azure/autorest.python" + }, + "extensionManager": { + "installationPath": "/tmp/.autorest", + "sharedLock": { + "name": "/tmp/.autorest", + "exclusiveLock": { + "name": "_tmp_.autorest.exclusive-lock", + "options": { + "port": 5245, + "host": "2130716018", + "exclusive": true + }, + "pipe": "/tmp/pipe__tmp_.autorest.exclusive-lock:5245" + }, + "busyLock": { + "name": "_tmp_.autorest.busy-lock", + "options": { + "port": 46071, + "host": "2130735832", + "exclusive": true + }, + "pipe": "/tmp/pipe__tmp_.autorest.busy-lock:46071" + }, + "personalLock": { + "name": "_tmp_.autorest.9461.87243551275.personal-lock", + "options": { + "port": 47556, + "host": "2130710431", + "exclusive": true + }, + "pipe": "/tmp/pipe__tmp_.autorest.9461.87243551275.personal-lock:47556" + }, + "file": "/tmp/_tmp_.autorest.lock" + }, + "dotnetPath": "/root/.dotnet" + }, + "installationPath": "/tmp/.autorest" + }, + { + "resolvedInfo": null, + "packageMetadata": { + "name": "@microsoft.azure/autorest.python", + "version": "3.0.41", + "dependencies": { + "dotnet-2.0.0": "^1.4.4" + }, + "optionalDependencies": {}, + "devDependencies": { + "@microsoft.azure/autorest.testserver": "^2.4.0", + "autorest": "^2.0.4203", + "coffee-script": "^1.11.1", + "dotnet-sdk-2.0.0": "^1.4.4", + "gulp": "^3.9.1", + "gulp-filter": "^5.0.0", + "gulp-line-ending-corrector": "^1.0.1", + "iced-coffee-script": "^108.0.11", + "marked": "^0.3.6", + "marked-terminal": "^2.0.0", + "moment": "^2.17.1", + "run-sequence": "*", + "shx": "^0.2.2", + "through2-parallel": "^0.1.3", + "yargs": "^8.0.2", + "yarn": "^1.0.2" + }, + "bundleDependencies": false, + "peerDependencies": {}, + "deprecated": false, + "_resolved": "/tmp/.autorest/@microsoft.azure_autorest.python@3.0.41/node_modules/@microsoft.azure/autorest.python", + "_integrity": null, + "_shasum": "184d947713655b7e1fcc3b269466953b45d5bddf", + "_shrinkwrap": null, + "bin": null, + "_id": "@microsoft.azure/autorest.python@3.0.41", + "_from": "file:/tmp/.autorest/@microsoft.azure_autorest.python@3.0.41/node_modules/@microsoft.azure/autorest.python", + "_requested": { + "type": "directory", + "where": "/tmp/.autorest/@microsoft.azure_autorest.python@3.0.41/node_modules/@microsoft.azure/autorest.python", + "raw": "/tmp/.autorest/@microsoft.azure_autorest.python@3.0.41/node_modules/@microsoft.azure/autorest.python", + "rawSpec": "/tmp/.autorest/@microsoft.azure_autorest.python@3.0.41/node_modules/@microsoft.azure/autorest.python", + "saveSpec": "file:/tmp/.autorest/@microsoft.azure_autorest.python@3.0.41/node_modules/@microsoft.azure/autorest.python", + "fetchSpec": "/tmp/.autorest/@microsoft.azure_autorest.python@3.0.41/node_modules/@microsoft.azure/autorest.python" + }, + "_spec": "/tmp/.autorest/@microsoft.azure_autorest.python@3.0.41/node_modules/@microsoft.azure/autorest.python", + "_where": "/tmp/.autorest/@microsoft.azure_autorest.python@3.0.41/node_modules/@microsoft.azure/autorest.python" + }, + "extensionManager": { + "installationPath": "/tmp/.autorest", + "sharedLock": { + "name": "/tmp/.autorest", + "exclusiveLock": { + "name": "_tmp_.autorest.exclusive-lock", + "options": { + "port": 5245, + "host": "2130716018", + "exclusive": true + }, + "pipe": "/tmp/pipe__tmp_.autorest.exclusive-lock:5245" + }, + "busyLock": { + "name": "_tmp_.autorest.busy-lock", + "options": { + "port": 46071, + "host": "2130735832", + "exclusive": true + }, + "pipe": "/tmp/pipe__tmp_.autorest.busy-lock:46071" + }, + "personalLock": { + "name": "_tmp_.autorest.9461.87243551275.personal-lock", + "options": { + "port": 47556, + "host": "2130710431", + "exclusive": true + }, + "pipe": "/tmp/pipe__tmp_.autorest.9461.87243551275.personal-lock:47556" + }, + "file": "/tmp/_tmp_.autorest.lock" + }, + "dotnetPath": "/root/.dotnet" + }, + "installationPath": "/tmp/.autorest" + }, + { + "resolvedInfo": null, + "packageMetadata": { + "name": "@microsoft.azure/autorest.python", + "version": "3.0.42", + "dependencies": { + "dotnet-2.0.0": "^1.4.4" + }, + "optionalDependencies": {}, + "devDependencies": { + "@microsoft.azure/autorest.testserver": "^2.4.0", + "autorest": "^2.0.4203", + "coffee-script": "^1.11.1", + "dotnet-sdk-2.0.0": "^1.4.4", + "gulp": "^3.9.1", + "gulp-filter": "^5.0.0", + "gulp-line-ending-corrector": "^1.0.1", + "iced-coffee-script": "^108.0.11", + "marked": "^0.3.6", + "marked-terminal": "^2.0.0", + "moment": "^2.17.1", + "run-sequence": "*", + "shx": "^0.2.2", + "through2-parallel": "^0.1.3", + "yargs": "^8.0.2", + "yarn": "^1.0.2" + }, + "bundleDependencies": false, + "peerDependencies": {}, + "deprecated": false, + "_resolved": "/tmp/.autorest/@microsoft.azure_autorest.python@3.0.42/node_modules/@microsoft.azure/autorest.python", + "_integrity": null, + "_shasum": "638e6014c114e93f2aab801ad7c157c3c4a14e33", + "_shrinkwrap": null, + "bin": null, + "_id": "@microsoft.azure/autorest.python@3.0.42", + "_from": "file:/tmp/.autorest/@microsoft.azure_autorest.python@3.0.42/node_modules/@microsoft.azure/autorest.python", + "_requested": { + "type": "directory", + "where": "/tmp/.autorest/@microsoft.azure_autorest.python@3.0.42/node_modules/@microsoft.azure/autorest.python", + "raw": "/tmp/.autorest/@microsoft.azure_autorest.python@3.0.42/node_modules/@microsoft.azure/autorest.python", + "rawSpec": "/tmp/.autorest/@microsoft.azure_autorest.python@3.0.42/node_modules/@microsoft.azure/autorest.python", + "saveSpec": "file:/tmp/.autorest/@microsoft.azure_autorest.python@3.0.42/node_modules/@microsoft.azure/autorest.python", + "fetchSpec": "/tmp/.autorest/@microsoft.azure_autorest.python@3.0.42/node_modules/@microsoft.azure/autorest.python" + }, + "_spec": "/tmp/.autorest/@microsoft.azure_autorest.python@3.0.42/node_modules/@microsoft.azure/autorest.python", + "_where": "/tmp/.autorest/@microsoft.azure_autorest.python@3.0.42/node_modules/@microsoft.azure/autorest.python" + }, + "extensionManager": { + "installationPath": "/tmp/.autorest", + "sharedLock": { + "name": "/tmp/.autorest", + "exclusiveLock": { + "name": "_tmp_.autorest.exclusive-lock", + "options": { + "port": 5245, + "host": "2130716018", + "exclusive": true + }, + "pipe": "/tmp/pipe__tmp_.autorest.exclusive-lock:5245" + }, + "busyLock": { + "name": "_tmp_.autorest.busy-lock", + "options": { + "port": 46071, + "host": "2130735832", + "exclusive": true + }, + "pipe": "/tmp/pipe__tmp_.autorest.busy-lock:46071" + }, + "personalLock": { + "name": "_tmp_.autorest.9461.87243551275.personal-lock", + "options": { + "port": 47556, + "host": "2130710431", + "exclusive": true + }, + "pipe": "/tmp/pipe__tmp_.autorest.9461.87243551275.personal-lock:47556" + }, + "file": "/tmp/_tmp_.autorest.lock" + }, + "dotnetPath": "/root/.dotnet" + }, + "installationPath": "/tmp/.autorest" + }, + { + "resolvedInfo": null, + "packageMetadata": { + "name": "@microsoft.azure/classic-openapi-validator", + "version": "1.0.10", + "dependencies": { + "dotnet-2.0.0": "^1.1.0" + }, + "optionalDependencies": {}, + "devDependencies": { + "dotnet-sdk-2.0.0": "^1.1.1" + }, + "bundleDependencies": false, + "peerDependencies": {}, + "deprecated": false, + "_resolved": "/tmp/.autorest/@microsoft.azure_classic-openapi-validator@1.0.10/node_modules/@microsoft.azure/classic-openapi-validator", + "_integrity": null, + "_shasum": "473760d3ca5ca1dbf65a735b311622e5f47e6059", + "_shrinkwrap": null, + "bin": null, + "_id": "@microsoft.azure/classic-openapi-validator@1.0.10", + "_from": "file:/tmp/.autorest/@microsoft.azure_classic-openapi-validator@1.0.10/node_modules/@microsoft.azure/classic-openapi-validator", + "_requested": { + "type": "directory", + "where": "/tmp/.autorest/@microsoft.azure_classic-openapi-validator@1.0.10/node_modules/@microsoft.azure/classic-openapi-validator", + "raw": "/tmp/.autorest/@microsoft.azure_classic-openapi-validator@1.0.10/node_modules/@microsoft.azure/classic-openapi-validator", + "rawSpec": "/tmp/.autorest/@microsoft.azure_classic-openapi-validator@1.0.10/node_modules/@microsoft.azure/classic-openapi-validator", + "saveSpec": "file:/tmp/.autorest/@microsoft.azure_classic-openapi-validator@1.0.10/node_modules/@microsoft.azure/classic-openapi-validator", + "fetchSpec": "/tmp/.autorest/@microsoft.azure_classic-openapi-validator@1.0.10/node_modules/@microsoft.azure/classic-openapi-validator" + }, + "_spec": "/tmp/.autorest/@microsoft.azure_classic-openapi-validator@1.0.10/node_modules/@microsoft.azure/classic-openapi-validator", + "_where": "/tmp/.autorest/@microsoft.azure_classic-openapi-validator@1.0.10/node_modules/@microsoft.azure/classic-openapi-validator" + }, + "extensionManager": { + "installationPath": "/tmp/.autorest", + "sharedLock": { + "name": "/tmp/.autorest", + "exclusiveLock": { + "name": "_tmp_.autorest.exclusive-lock", + "options": { + "port": 5245, + "host": "2130716018", + "exclusive": true + }, + "pipe": "/tmp/pipe__tmp_.autorest.exclusive-lock:5245" + }, + "busyLock": { + "name": "_tmp_.autorest.busy-lock", + "options": { + "port": 46071, + "host": "2130735832", + "exclusive": true + }, + "pipe": "/tmp/pipe__tmp_.autorest.busy-lock:46071" + }, + "personalLock": { + "name": "_tmp_.autorest.9461.87243551275.personal-lock", + "options": { + "port": 47556, + "host": "2130710431", + "exclusive": true + }, + "pipe": "/tmp/pipe__tmp_.autorest.9461.87243551275.personal-lock:47556" + }, + "file": "/tmp/_tmp_.autorest.lock" + }, + "dotnetPath": "/root/.dotnet" + }, + "installationPath": "/tmp/.autorest" + }, + { + "resolvedInfo": null, + "packageMetadata": { + "name": "@microsoft.azure/openapi-validator", + "version": "1.0.2", + "dependencies": { + "fs": "^0.0.1-security", + "js-yaml": "^3.8.4", + "jsonpath": "^0.2.11", + "vscode-jsonrpc": "^3.2.0" + }, + "optionalDependencies": {}, + "devDependencies": { + "@types/js-yaml": "^3.5.30", + "@types/jsonpath": "^0.1.29", + "@types/node": "^7.0.18", + "gulp": "3.9.1", + "gulp-clean": "0.3.2", + "gulp-dotnet-cli": "0.4.0", + "gulp-mocha": "4.3.1", + "gulp-run": "1.7.1", + "mocha": "3.2.0", + "mocha-typescript": "1.0.22", + "typescript": "2.3.3" + }, + "bundleDependencies": false, + "peerDependencies": {}, + "deprecated": false, + "_resolved": "/tmp/.autorest/@microsoft.azure_openapi-validator@1.0.2/node_modules/@microsoft.azure/openapi-validator", + "_integrity": null, + "_shasum": "352190e6dbb4a1d16587b39e589b9615d6e4aaaf", + "_shrinkwrap": null, + "bin": null, + "_id": "@microsoft.azure/openapi-validator@1.0.2", + "_from": "file:/tmp/.autorest/@microsoft.azure_openapi-validator@1.0.2/node_modules/@microsoft.azure/openapi-validator", + "_requested": { + "type": "directory", + "where": "/tmp/.autorest/@microsoft.azure_openapi-validator@1.0.2/node_modules/@microsoft.azure/openapi-validator", + "raw": "/tmp/.autorest/@microsoft.azure_openapi-validator@1.0.2/node_modules/@microsoft.azure/openapi-validator", + "rawSpec": "/tmp/.autorest/@microsoft.azure_openapi-validator@1.0.2/node_modules/@microsoft.azure/openapi-validator", + "saveSpec": "file:/tmp/.autorest/@microsoft.azure_openapi-validator@1.0.2/node_modules/@microsoft.azure/openapi-validator", + "fetchSpec": "/tmp/.autorest/@microsoft.azure_openapi-validator@1.0.2/node_modules/@microsoft.azure/openapi-validator" + }, + "_spec": "/tmp/.autorest/@microsoft.azure_openapi-validator@1.0.2/node_modules/@microsoft.azure/openapi-validator", + "_where": "/tmp/.autorest/@microsoft.azure_openapi-validator@1.0.2/node_modules/@microsoft.azure/openapi-validator" + }, + "extensionManager": { + "installationPath": "/tmp/.autorest", + "sharedLock": { + "name": "/tmp/.autorest", + "exclusiveLock": { + "name": "_tmp_.autorest.exclusive-lock", + "options": { + "port": 5245, + "host": "2130716018", + "exclusive": true + }, + "pipe": "/tmp/pipe__tmp_.autorest.exclusive-lock:5245" + }, + "busyLock": { + "name": "_tmp_.autorest.busy-lock", + "options": { + "port": 46071, + "host": "2130735832", + "exclusive": true + }, + "pipe": "/tmp/pipe__tmp_.autorest.busy-lock:46071" + }, + "personalLock": { + "name": "_tmp_.autorest.9461.87243551275.personal-lock", + "options": { + "port": 47556, + "host": "2130710431", + "exclusive": true + }, + "pipe": "/tmp/pipe__tmp_.autorest.9461.87243551275.personal-lock:47556" + }, + "file": "/tmp/_tmp_.autorest.lock" + }, + "dotnetPath": "/root/.dotnet" + }, + "installationPath": "/tmp/.autorest" + } + ], + "autorest_bootstrap": {} +} \ No newline at end of file diff --git a/azure-mgmt-subscription/tests/recordings/test_mgmt_subscription.test_create_subscription.yaml b/azure-mgmt-subscription/tests/recordings/test_mgmt_subscription.test_create_subscription.yaml new file mode 100644 index 000000000000..07226a1ab056 --- /dev/null +++ b/azure-mgmt-subscription/tests/recordings/test_mgmt_subscription.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/azure-mgmt-subscription/tests/test_mgmt_subscription.py b/azure-mgmt-subscription/tests/test_mgmt_subscription.py new file mode 100644 index 000000000000..c1046fec2f39 --- /dev/null +++ b/azure-mgmt-subscription/tests/test_mgmt_subscription.py @@ -0,0 +1,35 @@ +# 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. +#-------------------------------------------------------------------------- +import unittest + +import azure.mgmt.billing +import azure.mgmt.subscription +from testutils.common_recordingtestcase import record +from devtools_testutils import AzureMgmtTestCase + +class MgmtSubscriptionTest(AzureMgmtTestCase): + + def setUp(self): + super(MgmtSubscriptionTest, self).setUp() + self.subscription_client = self.create_basic_client(azure.mgmt.subscription.SubscriptionClient) + self.billing_client = self.create_mgmt_client(azure.mgmt.billing.BillingManagementClient) + + def test_create_subscription(self): + enrollment_accounts = list(self.billing_client.enrollment_accounts.list()) + self.assertTrue(len(enrollment_accounts) > 0) + creation_parameters = azure.mgmt.subscription.models.SubscriptionCreationParameters( + offer_type='MS-AZR-0148P') + creation_result = self.subscription_client.subscription_factory \ + .create_subscription_in_enrollment_account( + enrollment_accounts[0].name, + creation_parameters) + self.assertTrue(len(creation_result.result().subscription_link) > 0) + +#------------------------------------------------------------------------------ +if __name__ == '__main__': + unittest.main() diff --git a/swagger_to_sdk_config.json b/swagger_to_sdk_config.json index 26ef440a28b0..faea631defd6 100644 --- a/swagger_to_sdk_config.json +++ b/swagger_to_sdk_config.json @@ -27,13 +27,6 @@ "azure-keyvault/azure/keyvault/generated", "azure-keyvault/azure/keyvault/__init__.py" ] - }, - "subscription": { - "build_dir": "azure-mgmt-subscription", - "markdown": "specification/subscription/resource-manager/readme.md", - "autorest_options": { - "tag": "package-all-subscription" - } } } }