Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Generated from a65461546a2e2b7d3391cda3ecbe437938540d32
update
  • Loading branch information
AutorestCI committed Aug 20, 2019
commit 3921aeb4ad2cd97516aa0a7fe0d72c9500fac649
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@
'SkuRestriction',
'SplitRequest',
'SubscriptionScopeProperties',
'ReservationOrderResponsePaged',
'ReservationResponsePaged',
'ReservationOrderResponsePaged',
'OperationResponsePaged',
'ReservationStatusCode',
'ErrorResponseCode',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <azure.mgmt.reservations.models.ReservationOrderResponse>` object
A paging container for iterating over a list of :class:`ReservationResponse <azure.mgmt.reservations.models.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 <azure.mgmt.reservations.models.ReservationResponse>` object
A paging container for iterating over a list of :class:`ReservationOrderResponse <azure.mgmt.reservations.models.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 <azure.mgmt.reservations.models.OperationResponse>` object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
]
Original file line number Diff line number Diff line change
Expand Up @@ -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<Properties> 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<azure.mgmt.reservations.models.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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Properties> 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<azure.mgmt.reservations.models.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)
Expand Down