Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR] reservations/resource-manager #2695

Merged
merged 4 commits into from
Jun 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
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
22 changes: 22 additions & 0 deletions azure-mgmt-reservations/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,28 @@
Release History
===============

0.2.0 (2018-06-12)
++++++++++++++++++

**Notes**

* Changed Update Reservation API
- Added optional InstanceFlexibility parameter
* Support for InstanceFlexibility
* Support for ReservedResourceType (VirtualMachines, SqlDatabases, SuseLinux)
* Upgrade to rest api version 2018-06-01

**Breaking change**

* Updated Get Catalog API
- Added required parameter 'reserved_resource_type'
- Added optional parameter 'location'
* Updated Catalog model
- Renamed property 'capabilities' to 'sku_properties'
- Removed properties 'size' and 'tier'
* Updated ReservationProperties model
- Removed property 'kind'

0.1.0 (2017-11-03)
++++++++++++++++++

Expand Down
8 changes: 5 additions & 3 deletions azure-mgmt-reservations/README.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Microsoft Azure SDK for Python
==============================

This is the Microsoft Azure Reservations Management Client Library.
This is the Microsoft Azure Reservations Client Library.

Azure Resource Manager (ARM) is the next generation of management APIs that
replace the old Azure Service Management (ASM).

This package has been tested with Python 2.7, 3.3, 3.4, 3.5 and 3.6.
This package has been tested with Python 2.7, 3.4, 3.5 and 3.6.

For the older Azure Service Management (ASM) libraries, see
`azure-servicemanagement-legacy <https://pypi.python.org/pypi/azure-servicemanagement-legacy>`__ library.
Expand Down Expand Up @@ -36,7 +36,9 @@ If you see azure==0.11.0 (or any version below 1.0), uninstall it first:
Usage
=====

no examples yet
For code examples, see `Reservations
<https://docs.microsoft.com/python/api/overview/azure/>`__
on docs.microsoft.com.


Provide Feedback
Expand Down
6 changes: 5 additions & 1 deletion azure-mgmt-reservations/azure/mgmt/reservations/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0
# 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.
# --------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0
# 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.service_client import ServiceClient
from msrest.service_client import SDKClient
from msrest import Serializer, Deserializer
from msrestazure import AzureConfiguration
from .version import VERSION
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_operation import AzureOperationPoller
from msrest.polling import LROPoller, NoPolling
from msrestazure.polling.arm_polling import ARMPolling
import uuid
from .operations.reservation_order_operations import ReservationOrderOperations
from .operations.reservation_operations import ReservationOperations
Expand Down Expand Up @@ -39,24 +44,24 @@ def __init__(

super(AzureReservationAPIConfiguration, self).__init__(base_url)

self.add_user_agent('azurereservationapi/{}'.format(VERSION))
self.add_user_agent('azure-mgmt-reservations/{}'.format(VERSION))
self.add_user_agent('Azure-SDK-For-Python')

self.credentials = credentials


class AzureReservationAPI(object):
class AzureReservationAPI(SDKClient):
"""This API describe Azure Reservation
:ivar config: Configuration for client.
:vartype config: AzureReservationAPIConfiguration
:ivar reservation_order: ReservationOrder operations
:vartype reservation_order: reservations.operations.ReservationOrderOperations
:vartype reservation_order: azure.mgmt.reservations.operations.ReservationOrderOperations
:ivar reservation: Reservation operations
:vartype reservation: reservations.operations.ReservationOperations
:vartype reservation: azure.mgmt.reservations.operations.ReservationOperations
:ivar operation: Operation operations
:vartype operation: reservations.operations.OperationOperations
:vartype operation: azure.mgmt.reservations.operations.OperationOperations
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
Expand All @@ -68,10 +73,10 @@ def __init__(
self, credentials, base_url=None):

self.config = AzureReservationAPIConfiguration(credentials, base_url)
self._client = ServiceClient(self.config.credentials, self.config)
super(AzureReservationAPI, self).__init__(self.config.credentials, self.config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '2017-11-01'
self.api_version = '2018-06-01'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

Expand All @@ -83,26 +88,31 @@ def __init__(
self._client, self.config, self._serialize, self._deserialize)

def get_catalog(
self, subscription_id, custom_headers=None, raw=False, **operation_config):
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
specified Azure subscription.
:param subscription_id: Id of the subscription
:type subscription_id: str
:param reserved_resource_type: The type of the resource for which the
skus should be provided.
:type reserved_resource_type: str
:param location: Filters the skus based on the location specified in
this parameter. This can be an azure region or global
:type location: 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<msrest:optionsforoperations>`.
:return: list of :class:`Catalog <reservations.models.Catalog>` or
:class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if
raw=true
:rtype: list of :class:`Catalog <reservations.models.Catalog>` or
:class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
:raises: :class:`ErrorException<reservations.models.ErrorException>`
:return: list or ClientRawResponse if raw=true
:rtype: list[~azure.mgmt.reservations.models.Catalog] or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorException<azure.mgmt.reservations.models.ErrorException>`
"""
# Construct URL
url = '/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/catalogs'
url = self.get_catalog.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str')
}
Expand All @@ -111,6 +121,9 @@ def get_catalog(
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
query_parameters['reservedResourceType'] = self._serialize.query("reserved_resource_type", reserved_resource_type, 'str')
if location is not None:
query_parameters['location'] = self._serialize.query("location", location, 'str')

# Construct headers
header_parameters = {}
Expand All @@ -124,7 +137,7 @@ def get_catalog(

# 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]:
raise models.ErrorException(self._deserialize, response)
Expand All @@ -139,6 +152,7 @@ def get_catalog(
return client_raw_response

return deserialized
get_catalog.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/catalogs'}

def get_applied_reservation_list(
self, subscription_id, custom_headers=None, raw=False, **operation_config):
Expand All @@ -153,17 +167,14 @@ def get_applied_reservation_list(
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: :class:`AppliedReservations
<reservations.models.AppliedReservations>` or
:class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>` if
raw=true
:rtype: :class:`AppliedReservations
<reservations.models.AppliedReservations>` or
:class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
:raises: :class:`ErrorException<reservations.models.ErrorException>`
:return: AppliedReservations or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.reservations.models.AppliedReservations or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorException<azure.mgmt.reservations.models.ErrorException>`
"""
# Construct URL
url = '/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/appliedReservations'
url = self.get_applied_reservation_list.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("subscription_id", subscription_id, 'str')
}
Expand All @@ -185,7 +196,7 @@ def get_applied_reservation_list(

# 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]:
raise models.ErrorException(self._deserialize, response)
Expand All @@ -200,3 +211,4 @@ def get_applied_reservation_list(
return client_raw_response

return deserialized
get_applied_reservation_list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/appliedReservations'}
75 changes: 52 additions & 23 deletions azure-mgmt-reservations/azure/mgmt/reservations/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,39 +1,66 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0
# 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 .sku_name import SkuName
from .sku_capability import SkuCapability
from .sku_restriction import SkuRestriction
from .catalog import Catalog
from .extended_status_info import ExtendedStatusInfo
from .reservation_split_properties import ReservationSplitProperties
from .reservation_merge_properties import ReservationMergeProperties
from .reservation_properties import ReservationProperties
from .reservation_response import ReservationResponse
from .reservation_order_response import ReservationOrderResponse
from .merge_request import MergeRequest
from .patch import Patch
from .split_request import SplitRequest
from .extended_error_info import ExtendedErrorInfo
from .error import Error, ErrorException
from .applied_reservation_list import AppliedReservationList
from .applied_reservations import AppliedReservations
from .operation_display import OperationDisplay
from .operation_response import OperationResponse
try:
from .sku_name_py3 import SkuName
from .sku_property_py3 import SkuProperty
from .sku_restriction_py3 import SkuRestriction
from .catalog_py3 import Catalog
from .extended_status_info_py3 import ExtendedStatusInfo
from .reservation_split_properties_py3 import ReservationSplitProperties
from .reservation_merge_properties_py3 import ReservationMergeProperties
from .reservation_properties_py3 import ReservationProperties
from .reservation_response_py3 import ReservationResponse
from .reservation_order_response_py3 import ReservationOrderResponse
from .merge_request_py3 import MergeRequest
from .patch_py3 import Patch
from .split_request_py3 import SplitRequest
from .extended_error_info_py3 import ExtendedErrorInfo
from .error_py3 import Error, ErrorException
from .applied_reservation_list_py3 import AppliedReservationList
from .applied_reservations_py3 import AppliedReservations
from .operation_display_py3 import OperationDisplay
from .operation_response_py3 import OperationResponse
except (SyntaxError, ImportError):
from .sku_name import SkuName
from .sku_property import SkuProperty
from .sku_restriction import SkuRestriction
from .catalog import Catalog
from .extended_status_info import ExtendedStatusInfo
from .reservation_split_properties import ReservationSplitProperties
from .reservation_merge_properties import ReservationMergeProperties
from .reservation_properties import ReservationProperties
from .reservation_response import ReservationResponse
from .reservation_order_response import ReservationOrderResponse
from .merge_request import MergeRequest
from .patch import Patch
from .split_request import SplitRequest
from .extended_error_info import ExtendedErrorInfo
from .error import Error, ErrorException
from .applied_reservation_list import AppliedReservationList
from .applied_reservations import AppliedReservations
from .operation_display import OperationDisplay
from .operation_response import OperationResponse
from .reservation_order_response_paged import ReservationOrderResponsePaged
from .reservation_response_paged import ReservationResponsePaged
from .operation_response_paged import OperationResponsePaged
from .azure_reservation_api_enums import (
Kind,
ReservedResourceType,
InstanceFlexibility,
AppliedScopeType,
)

__all__ = [
'SkuName',
'SkuCapability',
'SkuProperty',
'SkuRestriction',
'Catalog',
'ExtendedStatusInfo',
Expand All @@ -54,5 +81,7 @@
'ReservationOrderResponsePaged',
'ReservationResponsePaged',
'OperationResponsePaged',
'Kind',
'ReservedResourceType',
'InstanceFlexibility',
'AppliedScopeType',
]
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0
# 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.
# --------------------------------------------------------------------------
Expand All @@ -12,7 +16,7 @@ class AppliedReservationList(Model):
"""AppliedReservationList.

:param value:
:type value: list of str
:type value: list[str]
:param next_link: Url to get the next page of reservations
:type next_link: str
"""
Expand All @@ -22,6 +26,7 @@ class AppliedReservationList(Model):
'next_link': {'key': 'nextLink', 'type': 'str'},
}

def __init__(self, value=None, next_link=None):
self.value = value
self.next_link = next_link
def __init__(self, **kwargs):
super(AppliedReservationList, self).__init__(**kwargs)
self.value = kwargs.get('value', None)
self.next_link = kwargs.get('next_link', None)
Loading