Skip to content

Commit e6e1c32

Browse files
author
SDKAuto
committed
CodeGen from PR 14849 in Azure/azure-rest-api-specs
Merge 6500ba577e9952aff67f5948dbefc658fc902c1b into c36887c
1 parent 94225f2 commit e6e1c32

19 files changed

+1680
-230
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"autorest": "3.4.2",
2+
"autorest": "3.4.5",
33
"use": [
4-
"@autorest/[email protected].0",
5-
"@autorest/[email protected].1"
4+
"@autorest/[email protected].4",
5+
"@autorest/[email protected].2"
66
],
7-
"commit": "aac59eea2fb1c142fd371c9c1886f33713e494a2",
7+
"commit": "5ac63c64effa4ce13e6498cfc8caa0d6767771b5",
88
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
9-
"autorest_command": "autorest specification/reservations/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/[email protected].0 --use=@autorest/[email protected].1 --version=3.4.2",
9+
"autorest_command": "autorest specification/reservations/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/[email protected].4 --use=@autorest/[email protected].2 --version=3.4.5",
1010
"readme": "specification/reservations/resource-manager/readme.md"
1111
}

sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_metadata.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"chosen_version": "",
3-
"total_api_version_list": ["2020-10-01-preview", "2020-10-25"],
3+
"total_api_version_list": ["2020-10-25", "2021-07-01"],
44
"client": {
55
"name": "AzureReservationAPI",
66
"filename": "_azure_reservation_api",
@@ -100,12 +100,12 @@
100100
"operations": {
101101
"get_catalog" : {
102102
"sync": {
103-
"signature": "def get_catalog(\n self,\n subscription_id, # type: str\n reserved_resource_type, # type: str\n location=None, # type: Optional[str]\n **kwargs # type: Any\n):\n",
103+
"signature": "def get_catalog(\n self,\n subscription_id, # type: str\n reserved_resource_type=None, # type: Optional[str]\n location=None, # type: Optional[str]\n **kwargs # type: Any\n):\n",
104104
"doc": "\"\"\"Get the regions and skus that are available for RI purchase for the specified Azure subscription.\n\nGet the regions and skus that are available for RI purchase for the specified Azure\nsubscription.\n\n:param subscription_id: Id of the subscription.\n:type subscription_id: str\n:param reserved_resource_type: The type of the resource for which the skus should be provided.\n:type reserved_resource_type: str\n:param location: Filters the skus based on the location specified in this parameter. This can\n be an azure region or global.\n:type location: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: list of Catalog, or the result of cls(response)\n:rtype: list[~azure.mgmt.reservations.models.Catalog]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\""
105105
},
106106
"async": {
107107
"coroutine": true,
108-
"signature": "async def get_catalog(\n self,\n subscription_id: str,\n reserved_resource_type: str,\n location: Optional[str] = None,\n **kwargs: Any\n) -\u003e List[\"_models.Catalog\"]:\n",
108+
"signature": "async def get_catalog(\n self,\n subscription_id: str,\n reserved_resource_type: Optional[str] = None,\n location: Optional[str] = None,\n **kwargs: Any\n) -\u003e List[\"_models.Catalog\"]:\n",
109109
"doc": "\"\"\"Get the regions and skus that are available for RI purchase for the specified Azure subscription.\n\nGet the regions and skus that are available for RI purchase for the specified Azure\nsubscription.\n\n:param subscription_id: Id of the subscription.\n:type subscription_id: str\n:param reserved_resource_type: The type of the resource for which the skus should be provided.\n:type reserved_resource_type: str\n:param location: Filters the skus based on the location specified in this parameter. This can\n be an azure region or global.\n:type location: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: list of Catalog, or the result of cls(response)\n:rtype: list[~azure.mgmt.reservations.models.Catalog]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\""
110110
},
111111
"call": "subscription_id, reserved_resource_type, location"

sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
VERSION = "1.0.0"
9+
VERSION = "1.0.0b1"

sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_azure_reservation_api_operations.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class AzureReservationAPIOperationsMixin:
2323
async def get_catalog(
2424
self,
2525
subscription_id: str,
26-
reserved_resource_type: str,
26+
reserved_resource_type: Optional[str] = None,
2727
location: Optional[str] = None,
2828
**kwargs: Any
2929
) -> List["_models.Catalog"]:
@@ -49,7 +49,7 @@ async def get_catalog(
4949
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
5050
}
5151
error_map.update(kwargs.pop('error_map', {}))
52-
api_version = "2020-10-01-preview"
52+
api_version = "2021-07-01"
5353
accept = "application/json"
5454

5555
# Construct URL
@@ -62,7 +62,8 @@ async def get_catalog(
6262
# Construct parameters
6363
query_parameters = {} # type: Dict[str, Any]
6464
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
65-
query_parameters['reservedResourceType'] = self._serialize.query("reserved_resource_type", reserved_resource_type, 'str')
65+
if reserved_resource_type is not None:
66+
query_parameters['reservedResourceType'] = self._serialize.query("reserved_resource_type", reserved_resource_type, 'str')
6667
if location is not None:
6768
query_parameters['location'] = self._serialize.query("location", location, 'str')
6869

@@ -109,7 +110,7 @@ async def get_applied_reservation_list(
109110
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
110111
}
111112
error_map.update(kwargs.pop('error_map', {}))
112-
api_version = "2020-10-01-preview"
113+
api_version = "2021-07-01"
113114
accept = "application/json"
114115

115116
# Construct URL

sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_calculate_exchange_operations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ async def _post_initial(
5252
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
5353
}
5454
error_map.update(kwargs.pop('error_map', {}))
55-
api_version = "2020-10-01-preview"
55+
api_version = "2021-07-01"
5656
content_type = kwargs.pop("content_type", "application/json")
5757
accept = "application/json"
5858

sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_exchange_operations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ async def _post_initial(
5252
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
5353
}
5454
error_map.update(kwargs.pop('error_map', {}))
55-
api_version = "2020-10-01-preview"
55+
api_version = "2021-07-01"
5656
content_type = kwargs.pop("content_type", "application/json")
5757
accept = "application/json"
5858

sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_operation_operations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def list(
5959
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
6060
}
6161
error_map.update(kwargs.pop('error_map', {}))
62-
api_version = "2020-10-01-preview"
62+
api_version = "2021-07-01"
6363
accept = "application/json"
6464

6565
def prepare_request(next_link=None):

sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_reservation_operations.py

Lines changed: 106 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ async def _available_scopes_initial(
5555
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
5656
}
5757
error_map.update(kwargs.pop('error_map', {}))
58-
api_version = "2020-10-01-preview"
58+
api_version = "2021-07-01"
5959
content_type = kwargs.pop("content_type", "application/json")
6060
accept = "application/json"
6161

@@ -179,7 +179,7 @@ async def _split_initial(
179179
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
180180
}
181181
error_map.update(kwargs.pop('error_map', {}))
182-
api_version = "2020-10-01-preview"
182+
api_version = "2021-07-01"
183183
content_type = kwargs.pop("content_type", "application/json")
184184
accept = "application/json"
185185

@@ -299,7 +299,7 @@ async def _merge_initial(
299299
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
300300
}
301301
error_map.update(kwargs.pop('error_map', {}))
302-
api_version = "2020-10-01-preview"
302+
api_version = "2021-07-01"
303303
content_type = kwargs.pop("content_type", "application/json")
304304
accept = "application/json"
305305

@@ -430,7 +430,7 @@ def list(
430430
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
431431
}
432432
error_map.update(kwargs.pop('error_map', {}))
433-
api_version = "2020-10-01-preview"
433+
api_version = "2021-07-01"
434434
accept = "application/json"
435435

436436
def prepare_request(next_link=None):
@@ -508,7 +508,7 @@ async def get(
508508
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
509509
}
510510
error_map.update(kwargs.pop('error_map', {}))
511-
api_version = "2020-10-01-preview"
511+
api_version = "2021-07-01"
512512
accept = "application/json"
513513

514514
# Construct URL
@@ -558,7 +558,7 @@ async def _update_initial(
558558
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
559559
}
560560
error_map.update(kwargs.pop('error_map', {}))
561-
api_version = "2020-10-01-preview"
561+
api_version = "2021-07-01"
562562
content_type = kwargs.pop("content_type", "application/json")
563563
accept = "application/json"
564564

@@ -697,7 +697,7 @@ def list_revisions(
697697
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
698698
}
699699
error_map.update(kwargs.pop('error_map', {}))
700-
api_version = "2020-10-01-preview"
700+
api_version = "2021-07-01"
701701
accept = "application/json"
702702

703703
def prepare_request(next_link=None):
@@ -748,3 +748,102 @@ async def get_next(next_link=None):
748748
get_next, extract_data
749749
)
750750
list_revisions.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/revisions'} # type: ignore
751+
752+
def list_all(
753+
self,
754+
filter: Optional[str] = None,
755+
orderby: Optional[str] = None,
756+
refresh_summary: Optional[str] = None,
757+
skiptoken: Optional[float] = None,
758+
selected_state: Optional[str] = None,
759+
take: Optional[float] = None,
760+
**kwargs: Any
761+
) -> AsyncIterable["_models.ReservationsListResult"]:
762+
"""List the reservations and the roll up counts of reservations group by provisioning states that
763+
the user has access to in the current tenant.
764+
765+
:param filter: May be used to filter by reservation properties. The filter supports 'eq', 'or',
766+
and 'and'. It does not currently support 'ne', 'gt', 'le', 'ge', or 'not'. Reservation
767+
properties include sku/name, properties/{appliedScopeType, archived, displayName,
768+
displayProvisioningState, effectiveDateTime, expiryDate, provisioningState, quantity, renew,
769+
reservedResourceType, term, userFriendlyAppliedScopeType, userFriendlyRenewState}.
770+
:type filter: str
771+
:param orderby: May be used to sort order by reservation properties.
772+
:type orderby: str
773+
:param refresh_summary: To indicate whether to refresh the roll up counts of the reservations
774+
group by provisioning states.
775+
:type refresh_summary: str
776+
:param skiptoken: The number of reservations to skip from the list before returning results.
777+
:type skiptoken: float
778+
:param selected_state: The selected provisioning state.
779+
:type selected_state: str
780+
:param take: To number of reservations to return.
781+
:type take: float
782+
:keyword callable cls: A custom type or function that will be passed the direct response
783+
:return: An iterator like instance of either ReservationsListResult or the result of cls(response)
784+
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.reservations.models.ReservationsListResult]
785+
:raises: ~azure.core.exceptions.HttpResponseError
786+
"""
787+
cls = kwargs.pop('cls', None) # type: ClsType["_models.ReservationsListResult"]
788+
error_map = {
789+
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
790+
}
791+
error_map.update(kwargs.pop('error_map', {}))
792+
api_version = "2021-07-01"
793+
accept = "application/json"
794+
795+
def prepare_request(next_link=None):
796+
# Construct headers
797+
header_parameters = {} # type: Dict[str, Any]
798+
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
799+
800+
if not next_link:
801+
# Construct URL
802+
url = self.list_all.metadata['url'] # type: ignore
803+
# Construct parameters
804+
query_parameters = {} # type: Dict[str, Any]
805+
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
806+
if filter is not None:
807+
query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')
808+
if orderby is not None:
809+
query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str')
810+
if refresh_summary is not None:
811+
query_parameters['refreshSummary'] = self._serialize.query("refresh_summary", refresh_summary, 'str')
812+
if skiptoken is not None:
813+
query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'float')
814+
if selected_state is not None:
815+
query_parameters['selectedState'] = self._serialize.query("selected_state", selected_state, 'str')
816+
if take is not None:
817+
query_parameters['take'] = self._serialize.query("take", take, 'float')
818+
819+
request = self._client.get(url, query_parameters, header_parameters)
820+
else:
821+
url = next_link
822+
query_parameters = {} # type: Dict[str, Any]
823+
request = self._client.get(url, query_parameters, header_parameters)
824+
return request
825+
826+
async def extract_data(pipeline_response):
827+
deserialized = self._deserialize('ReservationsListResult', pipeline_response)
828+
list_of_elem = deserialized.value
829+
if cls:
830+
list_of_elem = cls(list_of_elem)
831+
return deserialized.next_link or None, AsyncList(list_of_elem)
832+
833+
async def get_next(next_link=None):
834+
request = prepare_request(next_link)
835+
836+
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
837+
response = pipeline_response.http_response
838+
839+
if response.status_code not in [200]:
840+
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
841+
map_error(status_code=response.status_code, response=response, error_map=error_map)
842+
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
843+
844+
return pipeline_response
845+
846+
return AsyncItemPaged(
847+
get_next, extract_data
848+
)
849+
list_all.metadata = {'url': '/providers/Microsoft.Capacity/reservations'} # type: ignore

0 commit comments

Comments
 (0)