From 781cbad7b66ffa2c3825e4e08c581041c3c49923 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 19 Aug 2019 22:32:32 +0000 Subject: [PATCH 1/3] Generated from ea7847bd3538ded2d30c5c436a3f9f0464637d90 update --- .../reservations/_azure_reservation_api.py | 10 +- .../mgmt/reservations/models/__init__.py | 11 +- .../azure/mgmt/reservations/models/_models.py | 53 +++++++++ .../mgmt/reservations/models/_models_py3.py | 53 +++++++++ .../mgmt/reservations/models/_paged_models.py | 16 +-- .../mgmt/reservations/operations/__init__.py | 4 +- .../operations/_reservation_operations.py | 101 ++++++++++++++++++ 7 files changed, 232 insertions(+), 16 deletions(-) diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_azure_reservation_api.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_azure_reservation_api.py index 2690f14925a4..6ab028aba5b9 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_azure_reservation_api.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_azure_reservation_api.py @@ -14,8 +14,8 @@ from ._configuration import AzureReservationAPIConfiguration from .operations import AzureReservationAPIOperationsMixin -from .operations import ReservationOrderOperations from .operations import ReservationOperations +from .operations import ReservationOrderOperations from .operations import OperationOperations from . import models @@ -26,10 +26,10 @@ class AzureReservationAPI(AzureReservationAPIOperationsMixin, SDKClient): :ivar config: Configuration for client. :vartype config: AzureReservationAPIConfiguration - :ivar reservation_order: ReservationOrder operations - :vartype reservation_order: azure.mgmt.reservations.operations.ReservationOrderOperations :ivar reservation: Reservation operations :vartype reservation: azure.mgmt.reservations.operations.ReservationOperations + :ivar reservation_order: ReservationOrder operations + :vartype reservation_order: azure.mgmt.reservations.operations.ReservationOrderOperations :ivar operation: Operation operations :vartype operation: azure.mgmt.reservations.operations.OperationOperations @@ -50,9 +50,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) - self.reservation_order = ReservationOrderOperations( - self._client, self.config, self._serialize, self._deserialize) self.reservation = ReservationOperations( self._client, self.config, self._serialize, self._deserialize) + self.reservation_order = ReservationOrderOperations( + self._client, self.config, self._serialize, self._deserialize) self.operation = OperationOperations( self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/__init__.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/__init__.py index b39117a29eca..c84f41407bff 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/__init__.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/__init__.py @@ -25,6 +25,7 @@ from ._models_py3 import OperationResponse from ._models_py3 import Patch from ._models_py3 import PatchPropertiesRenewProperties + from ._models_py3 import Properties from ._models_py3 import PurchaseRequest from ._models_py3 import PurchaseRequestPropertiesReservedResourceProperties from ._models_py3 import RenewPropertiesResponse @@ -35,10 +36,12 @@ from ._models_py3 import ReservationProperties from ._models_py3 import ReservationResponse from ._models_py3 import ReservationSplitProperties + from ._models_py3 import ScopeProperties from ._models_py3 import SkuName from ._models_py3 import SkuProperty from ._models_py3 import SkuRestriction from ._models_py3 import SplitRequest + from ._models_py3 import SubscriptionScopeProperties except (SyntaxError, ImportError): from ._models import AppliedReservationList from ._models import AppliedReservations @@ -55,6 +58,7 @@ from ._models import OperationResponse from ._models import Patch from ._models import PatchPropertiesRenewProperties + from ._models import Properties from ._models import PurchaseRequest from ._models import PurchaseRequestPropertiesReservedResourceProperties from ._models import RenewPropertiesResponse @@ -65,10 +69,12 @@ from ._models import ReservationProperties from ._models import ReservationResponse from ._models import ReservationSplitProperties + from ._models import ScopeProperties from ._models import SkuName from ._models import SkuProperty from ._models import SkuRestriction from ._models import SplitRequest + from ._models import SubscriptionScopeProperties from ._paged_models import OperationResponsePaged from ._paged_models import ReservationOrderResponsePaged from ._paged_models import ReservationResponsePaged @@ -97,6 +103,7 @@ 'OperationResponse', 'Patch', 'PatchPropertiesRenewProperties', + 'Properties', 'PurchaseRequest', 'PurchaseRequestPropertiesReservedResourceProperties', 'RenewPropertiesResponse', @@ -107,12 +114,14 @@ 'ReservationProperties', 'ReservationResponse', 'ReservationSplitProperties', + 'ScopeProperties', 'SkuName', 'SkuProperty', 'SkuRestriction', 'SplitRequest', - 'ReservationOrderResponsePaged', + 'SubscriptionScopeProperties', 'ReservationResponsePaged', + 'ReservationOrderResponsePaged', 'OperationResponsePaged', 'ReservationStatusCode', 'ErrorResponseCode', diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_models.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_models.py index 2161867ff374..adddc3a84f61 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_models.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_models.py @@ -451,6 +451,23 @@ def __init__(self, **kwargs): self.purchase_properties = kwargs.get('purchase_properties', None) +class Properties(Model): + """Properties. + + :param properties: + :type properties: + ~azure.mgmt.reservations.models.SubscriptionScopeProperties + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'SubscriptionScopeProperties'}, + } + + def __init__(self, **kwargs): + super(Properties, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + class PurchaseRequest(Model): """PurchaseRequest. @@ -891,6 +908,26 @@ def __init__(self, **kwargs): self.split_source = kwargs.get('split_source', None) +class ScopeProperties(Model): + """ScopeProperties. + + :param scope: + :type scope: str + :param valid: + :type valid: bool + """ + + _attribute_map = { + 'scope': {'key': 'scope', 'type': 'str'}, + 'valid': {'key': 'valid', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(ScopeProperties, self).__init__(**kwargs) + self.scope = kwargs.get('scope', None) + self.valid = kwargs.get('valid', None) + + class SkuName(Model): """SkuName. @@ -974,3 +1011,19 @@ def __init__(self, **kwargs): super(SplitRequest, self).__init__(**kwargs) self.quantities = kwargs.get('quantities', None) self.reservation_id = kwargs.get('reservation_id', None) + + +class SubscriptionScopeProperties(Model): + """SubscriptionScopeProperties. + + :param scopes: + :type scopes: list[~azure.mgmt.reservations.models.ScopeProperties] + """ + + _attribute_map = { + 'scopes': {'key': 'scopes', 'type': '[ScopeProperties]'}, + } + + def __init__(self, **kwargs): + super(SubscriptionScopeProperties, self).__init__(**kwargs) + self.scopes = kwargs.get('scopes', None) diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_models_py3.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_models_py3.py index c6805f2a529f..2e5a69a1d141 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_models_py3.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_models_py3.py @@ -451,6 +451,23 @@ def __init__(self, *, purchase_properties=None, **kwargs) -> None: self.purchase_properties = purchase_properties +class Properties(Model): + """Properties. + + :param properties: + :type properties: + ~azure.mgmt.reservations.models.SubscriptionScopeProperties + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'SubscriptionScopeProperties'}, + } + + def __init__(self, *, properties=None, **kwargs) -> None: + super(Properties, self).__init__(**kwargs) + self.properties = properties + + class PurchaseRequest(Model): """PurchaseRequest. @@ -891,6 +908,26 @@ def __init__(self, *, split_destinations=None, split_source: str=None, **kwargs) self.split_source = split_source +class ScopeProperties(Model): + """ScopeProperties. + + :param scope: + :type scope: str + :param valid: + :type valid: bool + """ + + _attribute_map = { + 'scope': {'key': 'scope', 'type': 'str'}, + 'valid': {'key': 'valid', 'type': 'bool'}, + } + + def __init__(self, *, scope: str=None, valid: bool=None, **kwargs) -> None: + super(ScopeProperties, self).__init__(**kwargs) + self.scope = scope + self.valid = valid + + class SkuName(Model): """SkuName. @@ -974,3 +1011,19 @@ def __init__(self, *, quantities=None, reservation_id: str=None, **kwargs) -> No super(SplitRequest, self).__init__(**kwargs) self.quantities = quantities self.reservation_id = reservation_id + + +class SubscriptionScopeProperties(Model): + """SubscriptionScopeProperties. + + :param scopes: + :type scopes: list[~azure.mgmt.reservations.models.ScopeProperties] + """ + + _attribute_map = { + 'scopes': {'key': 'scopes', 'type': '[ScopeProperties]'}, + } + + def __init__(self, *, scopes=None, **kwargs) -> None: + super(SubscriptionScopeProperties, self).__init__(**kwargs) + self.scopes = scopes diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_paged_models.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_paged_models.py index e9745f273406..270f73ab46b4 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_paged_models.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_paged_models.py @@ -12,32 +12,32 @@ from msrest.paging import Paged -class ReservationOrderResponsePaged(Paged): +class ReservationResponsePaged(Paged): """ - A paging container for iterating over a list of :class:`ReservationOrderResponse ` object + A paging container for iterating over a list of :class:`ReservationResponse ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ReservationOrderResponse]'} + 'current_page': {'key': 'value', 'type': '[ReservationResponse]'} } def __init__(self, *args, **kwargs): - super(ReservationOrderResponsePaged, self).__init__(*args, **kwargs) -class ReservationResponsePaged(Paged): + super(ReservationResponsePaged, self).__init__(*args, **kwargs) +class ReservationOrderResponsePaged(Paged): """ - A paging container for iterating over a list of :class:`ReservationResponse ` object + A paging container for iterating over a list of :class:`ReservationOrderResponse ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ReservationResponse]'} + 'current_page': {'key': 'value', 'type': '[ReservationOrderResponse]'} } def __init__(self, *args, **kwargs): - super(ReservationResponsePaged, self).__init__(*args, **kwargs) + super(ReservationOrderResponsePaged, self).__init__(*args, **kwargs) class OperationResponsePaged(Paged): """ A paging container for iterating over a list of :class:`OperationResponse ` object diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/__init__.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/__init__.py index 0052075a8bfd..851e7c22617c 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/__init__.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/__init__.py @@ -9,14 +9,14 @@ # regenerated. # -------------------------------------------------------------------------- -from ._reservation_order_operations import ReservationOrderOperations from ._reservation_operations import ReservationOperations +from ._reservation_order_operations import ReservationOrderOperations from ._operation_operations import OperationOperations from ._azure_reservation_api_operations import AzureReservationAPIOperationsMixin __all__ = [ - 'ReservationOrderOperations', 'ReservationOperations', + 'ReservationOrderOperations', 'OperationOperations', 'AzureReservationAPIOperationsMixin', ] diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_reservation_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_reservation_operations.py index d3bafdb65aed..8245463ec8d5 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_reservation_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_reservation_operations.py @@ -41,6 +41,107 @@ def __init__(self, client, config, serializer, deserializer): self.config = config + def _availablescopes_initial( + self, reservation_order_id, reservation_id, body, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.availablescopes.metadata['url'] + path_format_arguments = { + 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), + 'reservationId': self._serialize.url("reservation_id", reservation_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(body, '[str]') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Properties', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def availablescopes( + self, reservation_order_id, reservation_id, body, custom_headers=None, raw=False, polling=True, **operation_config): + """Get Avaialble Scopes for `Reservation`. + + Get Avaialble Scopes for `Reservation`. + . + + :param reservation_order_id: Order Id of the reservation + :type reservation_order_id: str + :param reservation_id: Id of the Reservation Item + :type reservation_id: str + :param body: + :type body: list[str] + :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 Properties or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.reservations.models.Properties] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.reservations.models.Properties]] + :raises: + :class:`ErrorException` + """ + raw_result = self._availablescopes_initial( + reservation_order_id=reservation_order_id, + reservation_id=reservation_id, + body=body, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('Properties', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + availablescopes.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/availablescopes'} + + def _split_initial( self, reservation_order_id, quantities=None, reservation_id=None, custom_headers=None, raw=False, **operation_config): body = models.SplitRequest(quantities=quantities, reservation_id=reservation_id) From 2a4e89d872e0d277f93f8ea4e575c6ab5e709e82 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 20 Aug 2019 16:22:00 +0000 Subject: [PATCH 2/3] Generated from ecb712b6e6535b86e9283f57a1a65d63c3cbb04a update --- .../reservations/_azure_reservation_api.py | 10 +- .../mgmt/reservations/models/__init__.py | 2 +- .../mgmt/reservations/models/_paged_models.py | 16 +-- .../mgmt/reservations/operations/__init__.py | 4 +- .../_azure_reservation_api_operations.py | 101 ++++++++++++++++++ .../operations/_reservation_operations.py | 101 ------------------ 6 files changed, 117 insertions(+), 117 deletions(-) diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_azure_reservation_api.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_azure_reservation_api.py index 6ab028aba5b9..2690f14925a4 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_azure_reservation_api.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_azure_reservation_api.py @@ -14,8 +14,8 @@ from ._configuration import AzureReservationAPIConfiguration from .operations import AzureReservationAPIOperationsMixin -from .operations import ReservationOperations from .operations import ReservationOrderOperations +from .operations import ReservationOperations from .operations import OperationOperations from . import models @@ -26,10 +26,10 @@ class AzureReservationAPI(AzureReservationAPIOperationsMixin, SDKClient): :ivar config: Configuration for client. :vartype config: AzureReservationAPIConfiguration - :ivar reservation: Reservation operations - :vartype reservation: azure.mgmt.reservations.operations.ReservationOperations :ivar reservation_order: ReservationOrder operations :vartype reservation_order: azure.mgmt.reservations.operations.ReservationOrderOperations + :ivar reservation: Reservation operations + :vartype reservation: azure.mgmt.reservations.operations.ReservationOperations :ivar operation: Operation operations :vartype operation: azure.mgmt.reservations.operations.OperationOperations @@ -50,9 +50,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) - self.reservation = ReservationOperations( - self._client, self.config, self._serialize, self._deserialize) self.reservation_order = ReservationOrderOperations( self._client, self.config, self._serialize, self._deserialize) + self.reservation = ReservationOperations( + self._client, self.config, self._serialize, self._deserialize) self.operation = OperationOperations( self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/__init__.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/__init__.py index c84f41407bff..a8992f3fed49 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/__init__.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/__init__.py @@ -120,8 +120,8 @@ 'SkuRestriction', 'SplitRequest', 'SubscriptionScopeProperties', - 'ReservationResponsePaged', 'ReservationOrderResponsePaged', + 'ReservationResponsePaged', 'OperationResponsePaged', 'ReservationStatusCode', 'ErrorResponseCode', diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_paged_models.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_paged_models.py index 270f73ab46b4..e9745f273406 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_paged_models.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_paged_models.py @@ -12,32 +12,32 @@ from msrest.paging import Paged -class ReservationResponsePaged(Paged): +class ReservationOrderResponsePaged(Paged): """ - A paging container for iterating over a list of :class:`ReservationResponse ` object + A paging container for iterating over a list of :class:`ReservationOrderResponse ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ReservationResponse]'} + 'current_page': {'key': 'value', 'type': '[ReservationOrderResponse]'} } def __init__(self, *args, **kwargs): - super(ReservationResponsePaged, self).__init__(*args, **kwargs) -class ReservationOrderResponsePaged(Paged): + super(ReservationOrderResponsePaged, self).__init__(*args, **kwargs) +class ReservationResponsePaged(Paged): """ - A paging container for iterating over a list of :class:`ReservationOrderResponse ` object + A paging container for iterating over a list of :class:`ReservationResponse ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ReservationOrderResponse]'} + 'current_page': {'key': 'value', 'type': '[ReservationResponse]'} } def __init__(self, *args, **kwargs): - super(ReservationOrderResponsePaged, self).__init__(*args, **kwargs) + super(ReservationResponsePaged, self).__init__(*args, **kwargs) class OperationResponsePaged(Paged): """ A paging container for iterating over a list of :class:`OperationResponse ` object diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/__init__.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/__init__.py index 851e7c22617c..0052075a8bfd 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/__init__.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/__init__.py @@ -9,14 +9,14 @@ # regenerated. # -------------------------------------------------------------------------- -from ._reservation_operations import ReservationOperations from ._reservation_order_operations import ReservationOrderOperations +from ._reservation_operations import ReservationOperations from ._operation_operations import OperationOperations from ._azure_reservation_api_operations import AzureReservationAPIOperationsMixin __all__ = [ - 'ReservationOperations', 'ReservationOrderOperations', + 'ReservationOperations', 'OperationOperations', 'AzureReservationAPIOperationsMixin', ] diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_azure_reservation_api_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_azure_reservation_api_operations.py index 2042cafecbd2..b2f67e9d3a56 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_azure_reservation_api_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_azure_reservation_api_operations.py @@ -18,6 +18,107 @@ class AzureReservationAPIOperationsMixin(object): + + def _get_item_availablescopes_initial( + self, reservation_order_id, reservation_id, body, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.get_item_availablescopes.metadata['url'] + path_format_arguments = { + 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), + 'reservationId': self._serialize.url("reservation_id", reservation_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(body, '[str]') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Properties', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get_item_availablescopes( + self, reservation_order_id, reservation_id, body, custom_headers=None, raw=False, polling=True, **operation_config): + """Get Avaialble Scopes for `Reservation`. + + Get Avaialble Scopes for `Reservation`. + . + + :param reservation_order_id: Order Id of the reservation + :type reservation_order_id: str + :param reservation_id: Id of the Reservation Item + :type reservation_id: str + :param body: + :type body: list[str] + :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 Properties or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.reservations.models.Properties] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.reservations.models.Properties]] + :raises: + :class:`ErrorException` + """ + raw_result = self._get_item_availablescopes_initial( + reservation_order_id=reservation_order_id, + reservation_id=reservation_id, + body=body, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('Properties', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + get_item_availablescopes.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/availablescopes'} + def get_catalog( self, subscription_id, reserved_resource_type, location=None, custom_headers=None, raw=False, **operation_config): """Get the regions and skus that are available for RI purchase for the diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_reservation_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_reservation_operations.py index 8245463ec8d5..d3bafdb65aed 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_reservation_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_reservation_operations.py @@ -41,107 +41,6 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def _availablescopes_initial( - self, reservation_order_id, reservation_id, body, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.availablescopes.metadata['url'] - path_format_arguments = { - 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), - 'reservationId': self._serialize.url("reservation_id", reservation_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(body, '[str]') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('Properties', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def availablescopes( - self, reservation_order_id, reservation_id, body, custom_headers=None, raw=False, polling=True, **operation_config): - """Get Avaialble Scopes for `Reservation`. - - Get Avaialble Scopes for `Reservation`. - . - - :param reservation_order_id: Order Id of the reservation - :type reservation_order_id: str - :param reservation_id: Id of the Reservation Item - :type reservation_id: str - :param body: - :type body: list[str] - :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 Properties or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.reservations.models.Properties] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.reservations.models.Properties]] - :raises: - :class:`ErrorException` - """ - raw_result = self._availablescopes_initial( - reservation_order_id=reservation_order_id, - reservation_id=reservation_id, - body=body, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - deserialized = self._deserialize('Properties', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - availablescopes.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/availablescopes'} - - def _split_initial( self, reservation_order_id, quantities=None, reservation_id=None, custom_headers=None, raw=False, **operation_config): body = models.SplitRequest(quantities=quantities, reservation_id=reservation_id) From 3921aeb4ad2cd97516aa0a7fe0d72c9500fac649 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 20 Aug 2019 16:26:39 +0000 Subject: [PATCH 3/3] Generated from a65461546a2e2b7d3391cda3ecbe437938540d32 update --- .../reservations/_azure_reservation_api.py | 10 +- .../mgmt/reservations/models/__init__.py | 2 +- .../mgmt/reservations/models/_paged_models.py | 16 +-- .../mgmt/reservations/operations/__init__.py | 4 +- .../_azure_reservation_api_operations.py | 101 ------------------ .../operations/_reservation_operations.py | 101 ++++++++++++++++++ 6 files changed, 117 insertions(+), 117 deletions(-) diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_azure_reservation_api.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_azure_reservation_api.py index 2690f14925a4..6ab028aba5b9 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_azure_reservation_api.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_azure_reservation_api.py @@ -14,8 +14,8 @@ from ._configuration import AzureReservationAPIConfiguration from .operations import AzureReservationAPIOperationsMixin -from .operations import ReservationOrderOperations from .operations import ReservationOperations +from .operations import ReservationOrderOperations from .operations import OperationOperations from . import models @@ -26,10 +26,10 @@ class AzureReservationAPI(AzureReservationAPIOperationsMixin, SDKClient): :ivar config: Configuration for client. :vartype config: AzureReservationAPIConfiguration - :ivar reservation_order: ReservationOrder operations - :vartype reservation_order: azure.mgmt.reservations.operations.ReservationOrderOperations :ivar reservation: Reservation operations :vartype reservation: azure.mgmt.reservations.operations.ReservationOperations + :ivar reservation_order: ReservationOrder operations + :vartype reservation_order: azure.mgmt.reservations.operations.ReservationOrderOperations :ivar operation: Operation operations :vartype operation: azure.mgmt.reservations.operations.OperationOperations @@ -50,9 +50,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) - self.reservation_order = ReservationOrderOperations( - self._client, self.config, self._serialize, self._deserialize) self.reservation = ReservationOperations( self._client, self.config, self._serialize, self._deserialize) + self.reservation_order = ReservationOrderOperations( + self._client, self.config, self._serialize, self._deserialize) self.operation = OperationOperations( self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/__init__.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/__init__.py index a8992f3fed49..c84f41407bff 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/__init__.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/__init__.py @@ -120,8 +120,8 @@ 'SkuRestriction', 'SplitRequest', 'SubscriptionScopeProperties', - 'ReservationOrderResponsePaged', 'ReservationResponsePaged', + 'ReservationOrderResponsePaged', 'OperationResponsePaged', 'ReservationStatusCode', 'ErrorResponseCode', diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_paged_models.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_paged_models.py index e9745f273406..270f73ab46b4 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_paged_models.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/_paged_models.py @@ -12,32 +12,32 @@ from msrest.paging import Paged -class ReservationOrderResponsePaged(Paged): +class ReservationResponsePaged(Paged): """ - A paging container for iterating over a list of :class:`ReservationOrderResponse ` object + A paging container for iterating over a list of :class:`ReservationResponse ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ReservationOrderResponse]'} + 'current_page': {'key': 'value', 'type': '[ReservationResponse]'} } def __init__(self, *args, **kwargs): - super(ReservationOrderResponsePaged, self).__init__(*args, **kwargs) -class ReservationResponsePaged(Paged): + super(ReservationResponsePaged, self).__init__(*args, **kwargs) +class ReservationOrderResponsePaged(Paged): """ - A paging container for iterating over a list of :class:`ReservationResponse ` object + A paging container for iterating over a list of :class:`ReservationOrderResponse ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ReservationResponse]'} + 'current_page': {'key': 'value', 'type': '[ReservationOrderResponse]'} } def __init__(self, *args, **kwargs): - super(ReservationResponsePaged, self).__init__(*args, **kwargs) + super(ReservationOrderResponsePaged, self).__init__(*args, **kwargs) class OperationResponsePaged(Paged): """ A paging container for iterating over a list of :class:`OperationResponse ` object diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/__init__.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/__init__.py index 0052075a8bfd..851e7c22617c 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/__init__.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/__init__.py @@ -9,14 +9,14 @@ # regenerated. # -------------------------------------------------------------------------- -from ._reservation_order_operations import ReservationOrderOperations from ._reservation_operations import ReservationOperations +from ._reservation_order_operations import ReservationOrderOperations from ._operation_operations import OperationOperations from ._azure_reservation_api_operations import AzureReservationAPIOperationsMixin __all__ = [ - 'ReservationOrderOperations', 'ReservationOperations', + 'ReservationOrderOperations', 'OperationOperations', 'AzureReservationAPIOperationsMixin', ] diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_azure_reservation_api_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_azure_reservation_api_operations.py index b2f67e9d3a56..2042cafecbd2 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_azure_reservation_api_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_azure_reservation_api_operations.py @@ -18,107 +18,6 @@ class AzureReservationAPIOperationsMixin(object): - - def _get_item_availablescopes_initial( - self, reservation_order_id, reservation_id, body, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.get_item_availablescopes.metadata['url'] - path_format_arguments = { - 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), - 'reservationId': self._serialize.url("reservation_id", reservation_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(body, '[str]') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('Properties', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - def get_item_availablescopes( - self, reservation_order_id, reservation_id, body, custom_headers=None, raw=False, polling=True, **operation_config): - """Get Avaialble Scopes for `Reservation`. - - Get Avaialble Scopes for `Reservation`. - . - - :param reservation_order_id: Order Id of the reservation - :type reservation_order_id: str - :param reservation_id: Id of the Reservation Item - :type reservation_id: str - :param body: - :type body: list[str] - :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 Properties or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.reservations.models.Properties] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.reservations.models.Properties]] - :raises: - :class:`ErrorException` - """ - raw_result = self._get_item_availablescopes_initial( - reservation_order_id=reservation_order_id, - reservation_id=reservation_id, - body=body, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - deserialized = self._deserialize('Properties', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - get_item_availablescopes.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/availablescopes'} - def get_catalog( self, subscription_id, reserved_resource_type, location=None, custom_headers=None, raw=False, **operation_config): """Get the regions and skus that are available for RI purchase for the diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_reservation_operations.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_reservation_operations.py index d3bafdb65aed..3a8db3c6f2c8 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_reservation_operations.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/operations/_reservation_operations.py @@ -41,6 +41,107 @@ def __init__(self, client, config, serializer, deserializer): self.config = config + def _available_scopes_initial( + self, reservation_order_id, reservation_id, body, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.available_scopes.metadata['url'] + path_format_arguments = { + 'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'), + 'reservationId': self._serialize.url("reservation_id", reservation_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(body, '[str]') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Properties', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def available_scopes( + self, reservation_order_id, reservation_id, body, custom_headers=None, raw=False, polling=True, **operation_config): + """Get Available Scopes for `Reservation`. + + Get Available Scopes for `Reservation`. + . + + :param reservation_order_id: Order Id of the reservation + :type reservation_order_id: str + :param reservation_id: Id of the Reservation Item + :type reservation_id: str + :param body: + :type body: list[str] + :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 Properties or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.reservations.models.Properties] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.reservations.models.Properties]] + :raises: + :class:`ErrorException` + """ + raw_result = self._available_scopes_initial( + reservation_order_id=reservation_order_id, + reservation_id=reservation_id, + body=body, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('Properties', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + available_scopes.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/availableScopes'} + + def _split_initial( self, reservation_order_id, quantities=None, reservation_id=None, custom_headers=None, raw=False, **operation_config): body = models.SplitRequest(quantities=quantities, reservation_id=reservation_id)