From 04a540d1d8555818708b9c9bf78b337852cd83a7 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 5 Oct 2022 01:55:16 +0000 Subject: [PATCH] CodeGen from PR 20905 in Azure/azure-rest-api-specs [Reservations][S360] Fixing reservation property by adding swapProperties (#20905) --- .../azure-mgmt-reservations/_meta.json | 10 +- .../azure/mgmt/reservations/_metadata.json | 126 ------------------ .../azure/mgmt/reservations/_version.py | 2 +- .../mgmt/reservations/models/__init__.py | 4 + .../mgmt/reservations/models/_models_py3.py | 89 +++++++++++++ 5 files changed, 99 insertions(+), 132 deletions(-) delete mode 100644 sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_metadata.json diff --git a/sdk/reservations/azure-mgmt-reservations/_meta.json b/sdk/reservations/azure-mgmt-reservations/_meta.json index 7a54fbb17e24..78824c352ded 100644 --- a/sdk/reservations/azure-mgmt-reservations/_meta.json +++ b/sdk/reservations/azure-mgmt-reservations/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.8.4", + "autorest": "3.9.2", "use": [ - "@autorest/python@6.1.5", - "@autorest/modelerfour@4.23.5" + "@autorest/python@6.1.9", + "@autorest/modelerfour@4.24.3" ], - "commit": "f70b7953f5d54889cc1825b37ad938342ca93a2e", + "commit": "c89befd8a843fed07b64d20b29047e8c2728478f", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/reservations/resource-manager/readme.md --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.1.5 --use=@autorest/modelerfour@4.23.5 --version=3.8.4 --version-tolerant=False", + "autorest_command": "autorest specification/reservations/resource-manager/readme.md --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.1.9 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/reservations/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_metadata.json b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_metadata.json deleted file mode 100644 index 5b4db5eff99c..000000000000 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_metadata.json +++ /dev/null @@ -1,126 +0,0 @@ -{ - "chosen_version": "", - "total_api_version_list": ["2020-10-25", "2022-03-01"], - "client": { - "name": "AzureReservationAPI", - "filename": "_azure_reservation_api", - "description": "This API describe Azure Reservation.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AzureReservationAPIConfiguration\"], \"._operations_mixin\": [\"AzureReservationAPIOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AzureReservationAPIConfiguration\"], \"._operations_mixin\": [\"AzureReservationAPIOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - } - }, - "constant": { - }, - "call": "credential", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version=None, # type: Optional[str]", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "reservation": "ReservationOperations", - "reservation_order": "ReservationOrderOperations", - "operation": "OperationOperations", - "calculate_exchange": "CalculateExchangeOperations", - "exchange": "ExchangeOperations", - "quota": "QuotaOperations", - "quota_request_status": "QuotaRequestStatusOperations" - }, - "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"List\", \"Optional\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"List\", \"Optional\"]}}}", - "operations": { - "get_catalog" : { - "sync": { - "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 publisher_id=None, # type: Optional[str]\n offer_id=None, # type: Optional[str]\n plan_id=None, # type: Optional[str]\n **kwargs # type: Any\n):\n # type: (...) -\u003e List[\"_models.Catalog\"]\n", - "doc": "\"\"\"Get the regions and skus that are available for RI purchase for the specified Azure\nsubscription.\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 Default value is None.\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. Default value is None.\n:type location: str\n:param publisher_id: Publisher id used to get the third party products. Default value is None.\n:type publisher_id: str\n:param offer_id: Offer id used to get the third party products. Default value is None.\n:type offer_id: str\n:param plan_id: Plan id used to get the third party products. Default value is None.\n:type plan_id: str\n:keyword api_version: Api Version. Default value is \"2022-03-01\". Note that overriding this\n default value may result in unsupported behavior.\n:paramtype api_version: 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\"\"\"" - }, - "async": { - "coroutine": true, - "signature": "async def get_catalog(\n self,\n subscription_id: str,\n reserved_resource_type: Optional[str] = None,\n location: Optional[str] = None,\n publisher_id: Optional[str] = None,\n offer_id: Optional[str] = None,\n plan_id: Optional[str] = None,\n **kwargs: Any\n) -\u003e List[\"_models.Catalog\"]:\n", - "doc": "\"\"\"Get the regions and skus that are available for RI purchase for the specified Azure\nsubscription.\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 Default value is None.\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. Default value is None.\n:type location: str\n:param publisher_id: Publisher id used to get the third party products. Default value is None.\n:type publisher_id: str\n:param offer_id: Offer id used to get the third party products. Default value is None.\n:type offer_id: str\n:param plan_id: Plan id used to get the third party products. Default value is None.\n:type plan_id: str\n:keyword api_version: Api Version. Default value is \"2022-03-01\". Note that overriding this\n default value may result in unsupported behavior.\n:paramtype api_version: 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\"\"\"" - }, - "call": "subscription_id, reserved_resource_type, location, publisher_id, offer_id, plan_id" - }, - "get_applied_reservation_list" : { - "sync": { - "signature": "def get_applied_reservation_list(\n self,\n subscription_id, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.AppliedReservations\"\n", - "doc": "\"\"\"Get list of applicable ``Reservation``\\ s.\n\nGet applicable ``Reservation``\\ s that are applied to this subscription or a resource group\nunder this subscription.\n\n:param subscription_id: Id of the subscription.\n:type subscription_id: str\n:keyword api_version: Api Version. Default value is \"2022-03-01\". Note that overriding this\n default value may result in unsupported behavior.\n:paramtype api_version: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: AppliedReservations, or the result of cls(response)\n:rtype: ~azure.mgmt.reservations.models.AppliedReservations\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "async": { - "coroutine": true, - "signature": "async def get_applied_reservation_list(\n self,\n subscription_id: str,\n **kwargs: Any\n) -\u003e \"_models.AppliedReservations\":\n", - "doc": "\"\"\"Get list of applicable ``Reservation``\\ s.\n\nGet applicable ``Reservation``\\ s that are applied to this subscription or a resource group\nunder this subscription.\n\n:param subscription_id: Id of the subscription.\n:type subscription_id: str\n:keyword api_version: Api Version. Default value is \"2022-03-01\". Note that overriding this\n default value may result in unsupported behavior.\n:paramtype api_version: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: AppliedReservations, or the result of cls(response)\n:rtype: ~azure.mgmt.reservations.models.AppliedReservations\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" - }, - "call": "subscription_id" - } - } - } -} \ No newline at end of file diff --git a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_version.py b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_version.py index 83f24ab50946..e5754a47ce68 100644 --- a/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_version.py +++ b/sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.1.0" +VERSION = "1.0.0b1" 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 ac1cc9edac36..ac59b4404301 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 @@ -8,6 +8,7 @@ from ._models_py3 import AppliedReservationList from ._models_py3 import AppliedReservations +from ._models_py3 import AppliedScopeProperties from ._models_py3 import AvailableScopeProperties from ._models_py3 import AvailableScopeRequest from ._models_py3 import AvailableScopeRequestProperties @@ -82,6 +83,7 @@ from ._models_py3 import ReservationResponse from ._models_py3 import ReservationSplitProperties from ._models_py3 import ReservationSummary +from ._models_py3 import ReservationSwapProperties from ._models_py3 import ReservationToExchange from ._models_py3 import ReservationToPurchaseCalculateExchange from ._models_py3 import ReservationToPurchaseExchange @@ -130,6 +132,7 @@ __all__ = [ "AppliedReservationList", "AppliedReservations", + "AppliedScopeProperties", "AvailableScopeProperties", "AvailableScopeRequest", "AvailableScopeRequestProperties", @@ -204,6 +207,7 @@ "ReservationResponse", "ReservationSplitProperties", "ReservationSummary", + "ReservationSwapProperties", "ReservationToExchange", "ReservationToPurchaseCalculateExchange", "ReservationToPurchaseExchange", 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 90725a0fddfb..c5d91a9d1621 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 @@ -89,6 +89,47 @@ def __init__(self, *, reservation_order_ids: Optional["_models.AppliedReservatio self.reservation_order_ids = reservation_order_ids +class AppliedScopeProperties(_serialization.Model): + """AppliedScopeProperties. + + :ivar tenant_id: Tenant ID of the applied scope type. + :vartype tenant_id: str + :ivar management_group_id: Management group ID of the format + /providers/Microsoft.Management/managementGroups/{managementGroupId}. + :vartype management_group_id: str + :ivar display_name: Management group display name. + :vartype display_name: str + """ + + _attribute_map = { + "tenant_id": {"key": "tenantId", "type": "str"}, + "management_group_id": {"key": "managementGroupId", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + } + + def __init__( + self, + *, + tenant_id: Optional[str] = None, + management_group_id: Optional[str] = None, + display_name: Optional[str] = None, + **kwargs + ): + """ + :keyword tenant_id: Tenant ID of the applied scope type. + :paramtype tenant_id: str + :keyword management_group_id: Management group ID of the format + /providers/Microsoft.Management/managementGroups/{managementGroupId}. + :paramtype management_group_id: str + :keyword display_name: Management group display name. + :paramtype display_name: str + """ + super().__init__(**kwargs) + self.tenant_id = tenant_id + self.management_group_id = management_group_id + self.display_name = display_name + + class AvailableScopeProperties(_serialization.Model): """AvailableScopeProperties. @@ -3280,6 +3321,10 @@ class ReservationsProperties(_serialization.Model): # pylint: disable=too-many- :vartype split_properties: ~azure.mgmt.reservations.models.ReservationSplitProperties :ivar merge_properties: :vartype merge_properties: ~azure.mgmt.reservations.models.ReservationMergeProperties + :ivar swap_properties: + :vartype swap_properties: ~azure.mgmt.reservations.models.ReservationSwapProperties + :ivar applied_scope_properties: + :vartype applied_scope_properties: ~azure.mgmt.reservations.models.AppliedScopeProperties :ivar billing_scope_id: Subscription that will be charged for purchasing Reservation. :vartype billing_scope_id: str :ivar renew: Setting this to true will automatically purchase a new reservation on the @@ -3337,6 +3382,8 @@ class ReservationsProperties(_serialization.Model): # pylint: disable=too-many- "purchase_date": {"key": "purchaseDate", "type": "date"}, "split_properties": {"key": "splitProperties", "type": "ReservationSplitProperties"}, "merge_properties": {"key": "mergeProperties", "type": "ReservationMergeProperties"}, + "swap_properties": {"key": "swapProperties", "type": "ReservationSwapProperties"}, + "applied_scope_properties": {"key": "appliedScopeProperties", "type": "AppliedScopeProperties"}, "billing_scope_id": {"key": "billingScopeId", "type": "str"}, "renew": {"key": "renew", "type": "bool"}, "renew_source": {"key": "renewSource", "type": "str"}, @@ -3369,6 +3416,8 @@ def __init__( # pylint: disable=too-many-locals purchase_date: Optional[datetime.date] = None, split_properties: Optional["_models.ReservationSplitProperties"] = None, merge_properties: Optional["_models.ReservationMergeProperties"] = None, + swap_properties: Optional["_models.ReservationSwapProperties"] = None, + applied_scope_properties: Optional["_models.AppliedScopeProperties"] = None, billing_scope_id: Optional[str] = None, renew: bool = False, renew_source: Optional[str] = None, @@ -3426,6 +3475,10 @@ def __init__( # pylint: disable=too-many-locals :paramtype split_properties: ~azure.mgmt.reservations.models.ReservationSplitProperties :keyword merge_properties: :paramtype merge_properties: ~azure.mgmt.reservations.models.ReservationMergeProperties + :keyword swap_properties: + :paramtype swap_properties: ~azure.mgmt.reservations.models.ReservationSwapProperties + :keyword applied_scope_properties: + :paramtype applied_scope_properties: ~azure.mgmt.reservations.models.AppliedScopeProperties :keyword billing_scope_id: Subscription that will be charged for purchasing Reservation. :paramtype billing_scope_id: str :keyword renew: Setting this to true will automatically purchase a new reservation on the @@ -3466,6 +3519,8 @@ def __init__( # pylint: disable=too-many-locals self.purchase_date = purchase_date self.split_properties = split_properties self.merge_properties = merge_properties + self.swap_properties = swap_properties + self.applied_scope_properties = applied_scope_properties self.billing_scope_id = billing_scope_id self.renew = renew self.renew_source = renew_source @@ -3560,6 +3615,40 @@ def __init__(self, **kwargs): self.processing_count = None +class ReservationSwapProperties(_serialization.Model): + """ReservationSwapProperties. + + :ivar swap_source: Resource Id of the Source Reservation that gets swapped. Format of the + resource Id is + /providers/microsoft.capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + :vartype swap_source: str + :ivar swap_destination: Reservation Resource Id that the original resource gets swapped to. + Format of the resource Id is + /providers/microsoft.capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + :vartype swap_destination: str + """ + + _attribute_map = { + "swap_source": {"key": "swapSource", "type": "str"}, + "swap_destination": {"key": "swapDestination", "type": "str"}, + } + + def __init__(self, *, swap_source: Optional[str] = None, swap_destination: Optional[str] = None, **kwargs): + """ + :keyword swap_source: Resource Id of the Source Reservation that gets swapped. Format of the + resource Id is + /providers/microsoft.capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + :paramtype swap_source: str + :keyword swap_destination: Reservation Resource Id that the original resource gets swapped to. + Format of the resource Id is + /providers/microsoft.capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + :paramtype swap_destination: str + """ + super().__init__(**kwargs) + self.swap_source = swap_source + self.swap_destination = swap_destination + + class ReservationToExchange(_serialization.Model): """Reservation refund details.