diff --git a/src/quota/HISTORY.rst b/src/quota/HISTORY.rst new file mode 100644 index 00000000000..1c139576ba0 --- /dev/null +++ b/src/quota/HISTORY.rst @@ -0,0 +1,8 @@ +.. :changelog: + +Release History +=============== + +0.1.0 +++++++ +* Initial release. diff --git a/src/quota/README.md b/src/quota/README.md new file mode 100644 index 00000000000..fd290e262e3 --- /dev/null +++ b/src/quota/README.md @@ -0,0 +1,104 @@ +# Azure CLI quota Extension # +This is the extension for quota + +### How to use ### +Install this extension using the below CLI command +``` +az extension add --name quota +``` + +### Included Features ### +#### quota #### +##### Create ##### +``` +az quota create --properties "{\\"name\\":{\\"value\\":\\"standardFSv2Family\\"},\\"limit\\":200}" \ + --resource-name "standardFSv2Family" \ + --scope "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Compute/locations/eastus" +``` +##### Create ##### +``` +az quota create --properties "{\\"name\\":{\\"value\\":\\"standardFSv2Family\\"},\\"limit\\":200}" \ + --resource-name "standardFSv2Family" \ + --scope "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Compute/locations/eastus" +``` +##### Create ##### +``` +az quota create \ + --properties "{\\"name\\":{\\"value\\":\\"TotalLowPriorityCores\\"},\\"limit\\":200,\\"resourceType\\":\\"lowPriority\\"}" \ + --resource-name "TotalLowPriorityCores" \ + --scope "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.MachineLearningServices/locations/eastus" +``` +##### Create ##### +``` +az quota create \ + --properties "{\\"name\\":{\\"value\\":\\"MinPublicIpInterNetworkPrefixLength\\"},\\"limit\\":200,\\"resourceType\\":\\"MinPublicIpInterNetworkPrefixLength\\"}" \ + --resource-name "MinPublicIpInterNetworkPrefixLength" \ + --scope "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Network/locations/eastus" +``` +##### Show ##### +``` +az quota show --resource-name "MinPublicIpInterNetworkPrefixLength" \ + --scope "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus" +``` +##### List ##### +``` +az quota list --scope "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus" +``` +##### List ##### +``` +az quota list --scope "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus" +``` +##### List ##### +``` +az quota list \ + --scope "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.MachineLearningServices/locations/eastus" +``` +##### Show ##### +``` +az quota show --resource-name "standardNDSFamily" \ + --scope "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus" +``` +##### Update ##### +``` +az quota update --properties "{\\"name\\":{\\"value\\":\\"standardFSv2Family\\"},\\"limit\\":200}" \ + --resource-name "standardFSv2Family" \ + --scope "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Compute/locations/eastus" +``` +##### Update ##### +``` +az quota update \ + --properties "{\\"name\\":{\\"value\\":\\"MinPublicIpInterNetworkPrefixLength\\"},\\"limit\\":200,\\"resourceType\\":\\"MinPublicIpInterNetworkPrefixLength\\"}" \ + --resource-name "MinPublicIpInterNetworkPrefixLength" \ + --scope "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Network/locations/eastus" +``` +#### quota quota-request-status #### +##### List ##### +``` +az quota quota-request-status list \ + --scope "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Compute/locations/eastus" +``` +##### Show ##### +``` +az quota quota-request-status show --id "2B5C8515-37D8-4B6A-879B-CD641A2CF605" \ + --scope "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus" +``` +##### Show ##### +``` +az quota quota-request-status show --id "2B5C8515-37D8-4B6A-879B-CD641A2CF605" \ + --scope "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus" +``` +##### Show ##### +``` +az quota quota-request-status show --id "2B5C8515-37D8-4B6A-879B-CD641A2CF605" \ + --scope "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Compute/locations/eastus" +``` +#### quota quota-resource-provider #### +##### List ##### +``` +az quota quota-resource-provider list +``` +#### quota operation #### +##### List ##### +``` +az quota operation list +``` \ No newline at end of file diff --git a/src/quota/azext_quota/__init__.py b/src/quota/azext_quota/__init__.py new file mode 100644 index 00000000000..2a2841bed35 --- /dev/null +++ b/src/quota/azext_quota/__init__.py @@ -0,0 +1,50 @@ +# -------------------------------------------------------------------------- +# 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 azure.cli.core import AzCommandsLoader +from azext_quota.generated._help import helps # pylint: disable=unused-import +try: + from azext_quota.manual._help import helps # pylint: disable=reimported +except ImportError: + pass + + +class AzureQuotaExtensionAPICommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + from azext_quota.generated._client_factory import cf_quota_cl + quota_custom = CliCommandType( + operations_tmpl='azext_quota.custom#{}', + client_factory=cf_quota_cl) + parent = super(AzureQuotaExtensionAPICommandsLoader, self) + parent.__init__(cli_ctx=cli_ctx, custom_command_type=quota_custom) + + def load_command_table(self, args): + from azext_quota.generated.commands import load_command_table + load_command_table(self, args) + try: + from azext_quota.manual.commands import load_command_table as load_command_table_manual + load_command_table_manual(self, args) + except ImportError: + pass + return self.command_table + + def load_arguments(self, command): + from azext_quota.generated._params import load_arguments + load_arguments(self, command) + try: + from azext_quota.manual._params import load_arguments as load_arguments_manual + load_arguments_manual(self, command) + except ImportError: + pass + + +COMMAND_LOADER_CLS = AzureQuotaExtensionAPICommandsLoader diff --git a/src/quota/azext_quota/action.py b/src/quota/azext_quota/action.py new file mode 100644 index 00000000000..d95d53bf711 --- /dev/null +++ b/src/quota/azext_quota/action.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=wildcard-import +# pylint: disable=unused-wildcard-import + +from .generated.action import * # noqa: F403 +try: + from .manual.action import * # noqa: F403 +except ImportError: + pass diff --git a/src/quota/azext_quota/azext_metadata.json b/src/quota/azext_quota/azext_metadata.json new file mode 100644 index 00000000000..cfc30c747c7 --- /dev/null +++ b/src/quota/azext_quota/azext_metadata.json @@ -0,0 +1,4 @@ +{ + "azext.isExperimental": true, + "azext.minCliCoreVersion": "2.15.0" +} \ No newline at end of file diff --git a/src/quota/azext_quota/custom.py b/src/quota/azext_quota/custom.py new file mode 100644 index 00000000000..dbe9d5f9742 --- /dev/null +++ b/src/quota/azext_quota/custom.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=wildcard-import +# pylint: disable=unused-wildcard-import + +from .generated.custom import * # noqa: F403 +try: + from .manual.custom import * # noqa: F403 +except ImportError: + pass diff --git a/src/quota/azext_quota/generated/__init__.py b/src/quota/azext_quota/generated/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/quota/azext_quota/generated/__init__.py @@ -0,0 +1,12 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/quota/azext_quota/generated/_client_factory.py b/src/quota/azext_quota/generated/_client_factory.py new file mode 100644 index 00000000000..f186a85309a --- /dev/null +++ b/src/quota/azext_quota/generated/_client_factory.py @@ -0,0 +1,33 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + + +def cf_quota_cl(cli_ctx, *_): + from azure.cli.core.commands.client_factory import get_mgmt_service_client + from azext_quota.vendored_sdks.quota import AzureQuotaExtensionAPI + return get_mgmt_service_client(cli_ctx, + AzureQuotaExtensionAPI, + subscription_bound=False) + + +def cf_quota(cli_ctx, *_): + return cf_quota_cl(cli_ctx).quota + + +def cf_quota_request_status(cli_ctx, *_): + return cf_quota_cl(cli_ctx).quota_request_status + + +def cf_quota_resource_provider(cli_ctx, *_): + return cf_quota_cl(cli_ctx).quota_resource_providers + + +def cf_operation(cli_ctx, *_): + return cf_quota_cl(cli_ctx).operation diff --git a/src/quota/azext_quota/generated/_help.py b/src/quota/azext_quota/generated/_help.py new file mode 100644 index 00000000000..10056864b75 --- /dev/null +++ b/src/quota/azext_quota/generated/_help.py @@ -0,0 +1,186 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines + +from knack.help_files import helps + + +helps['quota'] = """ + type: group + short-summary: Manage quota +""" + +helps['quota list'] = """ + type: command + short-summary: "Get a list of current quota limits and usages of all resources. The response from this GET \ +operation can be leveraged to submit requests to update a quota." + examples: + - name: Quotas_listUsagesForCompute + text: |- + az quota list --scope "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/lo\ +cations/eastus" + - name: Quotas_listUsagesForNetwork + text: |- + az quota list --scope "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/lo\ +cations/eastus" + - name: Quotas_listUsagesMachineLearningServices + text: |- + az quota list --scope "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.MachineLea\ +rningServices/locations/eastus" +""" + +helps['quota show'] = """ + type: command + short-summary: "Gets the quota limit and current quota usage of a resource. The response can be used to determine \ +the remaining quota and calculate a new quota limit that can be submitted with a PUT request." + examples: + - name: Quotas_Get_Request_ForCompute + text: |- + az quota show --resource-name "standardNDSFamily" --scope "subscriptions/00000000-0000-0000-0000-0000000\ +00000/providers/Microsoft.Compute/locations/eastus" + - name: Quotas_Request_ForNetwork + text: |- + az quota show --resource-name "MinPublicIpInterNetworkPrefixLength" --scope \ +"subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus" +""" + +helps['quota create'] = """ + type: command + short-summary: "Create the quota limit for the specified resource to the requested value. To update the quota, \ +follow these steps: 1. Use the GET operation to determine how much quota remains for the specific resource and to \ +calculate the new quota limit. These steps are detailed in [this example](https://techcommunity.microsoft.com/t5/azure-\ +governance-and-management/using-the-new-quota-rest-api/ba-p/2183670). 2. Use this PUT operation to update the quota \ +limit." + examples: + - name: Quotas_Put_Request_ForCompute + text: |- + az quota create --properties "{\\"name\\":{\\"value\\":\\"standardFSv2Family\\"},\\"limit\\":200}" \ +--resource-name "standardFSv2Family" --scope "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Co\ +mpute/locations/eastus" + - name: Quotas_Request_ForMachineLearningServices_DedicatedResource + text: |- + az quota create --properties "{\\"name\\":{\\"value\\":\\"standardFSv2Family\\"},\\"limit\\":200}" \ +--resource-name "standardFSv2Family" --scope "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Co\ +mpute/locations/eastus" + - name: Quotas_Request_ForMachineLearningServices_LowPriorityResource + text: |- + az quota create --properties "{\\"name\\":{\\"value\\":\\"TotalLowPriorityCores\\"},\\"limit\\":200,\\"r\ +esourceType\\":\\"lowPriority\\"}" --resource-name "TotalLowPriorityCores" --scope "subscriptions/D7EC67B3-7657-4966-BF\ +FC-41EFD36BAAB3/providers/Microsoft.MachineLearningServices/locations/eastus" + - name: Quotas_Request_ForNetwork + text: |- + az quota create --properties "{\\"name\\":{\\"value\\":\\"MinPublicIpInterNetworkPrefixLength\\"},\\"lim\ +it\\":200,\\"resourceType\\":\\"MinPublicIpInterNetworkPrefixLength\\"}" --resource-name \ +"MinPublicIpInterNetworkPrefixLength" --scope "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.N\ +etwork/locations/eastus" +""" + +helps['quota update'] = """ + type: command + short-summary: "Update the quota limit for a specific resource to the specified value: 1. Use the GET operation to \ +determine how much quota remains for the specific resource and to calculate the new quota limit. These steps are \ +detailed in [this example](https://techcommunity.microsoft.com/t5/azure-governance-and-management/using-the-new-quota-r\ +est-api/ba-p/2183670). 2. Use this PUT operation to update the quota limit." + examples: + - name: Quotas_Request_PatchForCompute + text: |- + az quota update --properties "{\\"name\\":{\\"value\\":\\"standardFSv2Family\\"},\\"limit\\":200}" \ +--resource-name "standardFSv2Family" --scope "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Co\ +mpute/locations/eastus" + - name: Quotas_Request_PatchForNetwork + text: |- + az quota update --properties "{\\"name\\":{\\"value\\":\\"MinPublicIpInterNetworkPrefixLength\\"},\\"lim\ +it\\":200,\\"resourceType\\":\\"MinPublicIpInterNetworkPrefixLength\\"}" --resource-name \ +"MinPublicIpInterNetworkPrefixLength" --scope "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.N\ +etwork/locations/eastus" +""" + +helps['quota wait'] = """ + type: command + short-summary: Place the CLI in a waiting state until a condition of the quota is met. + examples: + - name: Pause executing next line of CLI script until the quota is successfully created. + text: |- + az quota wait --resource-name "MinPublicIpInterNetworkPrefixLength" --scope \ +"subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus" --created + - name: Pause executing next line of CLI script until the quota is successfully updated. + text: |- + az quota wait --resource-name "MinPublicIpInterNetworkPrefixLength" --scope \ +"subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus" --updated +""" + +helps['quota quota-request-status'] = """ + type: group + short-summary: Manage quota request status with quota +""" + +helps['quota quota-request-status list'] = """ + type: command + short-summary: "For the specified location and resource provider, gets the current quota requests under the \ +subscription for a one year period ending at the time is made. Use the **oData** filter can be used to select quota \ +requests." + examples: + - name: QuotaRequestHistory + text: |- + az quota quota-request-status list --scope "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers\ +/Microsoft.Compute/locations/eastus" +""" + +helps['quota quota-request-status show'] = """ + type: command + short-summary: "Gets the quota request details and status by quota request ID for the resources of the resource \ +provider at a specific location. The quota request ID **id** is returned in the response of the PUT operation." + examples: + - name: QuotaRequestFailed + text: |- + az quota quota-request-status show --id "2B5C8515-37D8-4B6A-879B-CD641A2CF605" --scope \ +"subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus" + - name: QuotaRequestInProgress + text: |- + az quota quota-request-status show --id "2B5C8515-37D8-4B6A-879B-CD641A2CF605" --scope \ +"subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus" + - name: QuotaRequestStatus + text: |- + az quota quota-request-status show --id "2B5C8515-37D8-4B6A-879B-CD641A2CF605" --scope \ +"subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Compute/locations/eastus" +""" + +helps['quota quota-resource-provider'] = """ + type: group + short-summary: Manage quota resource provider with quota +""" + +helps['quota quota-resource-provider list'] = """ + type: command + short-summary: "Gets the list of current resource providers supported by the Microsoft.Quota resource provider. \ +For each resource provider, the resource templates the resource provider supports are be provided. For each resource \ +template, the resource dimensions are listed. The resource dimensions are the name-value pairs in the resource URI. \ +Example: Microsoft.Compute Resource Provider The URI template is '/subscriptions/{subscriptionId}/providers/Microsoft.\ +Compute/locations/{locationId}/quotaBucket'. The actual dimensions vary depending on the resource provider. The \ +resource dimensions are {subscriptions},{locations},{quotaBucket}." + examples: + - name: Quotas_listMetadataForRPs + text: |- + az quota quota-resource-provider list +""" + +helps['quota operation'] = """ + type: group + short-summary: Manage operation with quota +""" + +helps['quota operation list'] = """ + type: command + short-summary: "List all GET operations." + examples: + - name: GetOperations + text: |- + az quota operation list +""" diff --git a/src/quota/azext_quota/generated/_params.py b/src/quota/azext_quota/generated/_params.py new file mode 100644 index 00000000000..b4139c14051 --- /dev/null +++ b/src/quota/azext_quota/generated/_params.py @@ -0,0 +1,95 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + +from azure.cli.core.commands.parameters import get_enum_type +from azure.cli.core.commands.validators import validate_file_or_dict + + +def load_arguments(self, _): + + with self.argument_context('quota list') as c: + c.argument('scope', type=str, help='The target Azure resource URI. For example, `/subscriptions/9f6cce51-6baf-4' + 'de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`' + '. This is the target Azure resource URI for the List GET operation. If a `{resourceName}` is added ' + 'after `/quotaLimits`, then it\'s the target Azure resource URI in the GET operation for the ' + 'specific resource.') + + with self.argument_context('quota show') as c: + c.argument('resource_name', type=str, help='Resource name for a given resource provider. For example: - SKU ' + 'name for Microsoft.Compute - Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices') + c.argument('scope', type=str, help='The target Azure resource URI. For example, `/subscriptions/9f6cce51-6baf-4' + 'de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`' + '. This is the target Azure resource URI for the List GET operation. If a `{resourceName}` is added ' + 'after `/quotaLimits`, then it\'s the target Azure resource URI in the GET operation for the ' + 'specific resource.') + + with self.argument_context('quota create') as c: + c.argument('resource_name', type=str, help='Resource name for a given resource provider. For example: - SKU ' + 'name for Microsoft.Compute - Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices') + c.argument('scope', type=str, help='The target Azure resource URI. For example, `/subscriptions/9f6cce51-6baf-4' + 'de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`' + '. This is the target Azure resource URI for the List GET operation. If a `{resourceName}` is added ' + 'after `/quotaLimits`, then it\'s the target Azure resource URI in the GET operation for the ' + 'specific resource.') + c.argument('limit', type=int, help='Quota limit.') + c.argument('resource_type', arg_type=get_enum_type(['standard', 'dedicated', 'lowPriority', 'shared', + 'serviceSpecific']), help='Resource type name.') + c.argument('properties', type=validate_file_or_dict, help='Additional properties for the specific resource ' + 'provider. Expected value: json-string/@json-file.') + c.argument('value', type=str, help='Resource name.', arg_group='Name') + + with self.argument_context('quota update') as c: + c.argument('resource_name', type=str, help='Resource name for a given resource provider. For example: - SKU ' + 'name for Microsoft.Compute - Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices') + c.argument('scope', type=str, help='The target Azure resource URI. For example, `/subscriptions/9f6cce51-6baf-4' + 'de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`' + '. This is the target Azure resource URI for the List GET operation. If a `{resourceName}` is added ' + 'after `/quotaLimits`, then it\'s the target Azure resource URI in the GET operation for the ' + 'specific resource.') + c.argument('limit', type=int, help='Quota limit.') + c.argument('resource_type', arg_type=get_enum_type(['standard', 'dedicated', 'lowPriority', 'shared', + 'serviceSpecific']), help='Resource type name.') + c.argument('properties', type=validate_file_or_dict, help='Additional properties for the specific resource ' + 'provider. Expected value: json-string/@json-file.') + c.argument('value', type=str, help='Resource name.', arg_group='Name') + + with self.argument_context('quota wait') as c: + c.argument('resource_name', type=str, help='Resource name for a given resource provider. For example: - SKU ' + 'name for Microsoft.Compute - Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices') + c.argument('scope', type=str, help='The target Azure resource URI. For example, `/subscriptions/9f6cce51-6baf-4' + 'de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`' + '. This is the target Azure resource URI for the List GET operation. If a `{resourceName}` is added ' + 'after `/quotaLimits`, then it\'s the target Azure resource URI in the GET operation for the ' + 'specific resource.') + + with self.argument_context('quota quota-request-status list') as c: + c.argument('scope', type=str, help='The target Azure resource URI. For example, `/subscriptions/9f6cce51-6baf-4' + 'de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`' + '. This is the target Azure resource URI for the List GET operation. If a `{resourceName}` is added ' + 'after `/quotaLimits`, then it\'s the target Azure resource URI in the GET operation for the ' + 'specific resource.') + c.argument('filter_', options_list=['--filter'], type=str, help='| Field | Supported ' + 'operators |---------------------|------------------------ |requestSubmitTime | ge, le, eq, gt, ' + 'lt |provisioningState eq {QuotaRequestState} |resourceName eq {resourceName}') + c.argument('top', type=int, help='Number of records to return.') + c.argument('skiptoken', type=str, help='The **Skiptoken** parameter is used only if a previous operation ' + 'returned a partial result. If a previous response contains a **nextLink** element, the value of ' + 'the **nextLink** element includes a **skiptoken** parameter that specifies a starting point to use ' + 'for subsequent calls.') + + with self.argument_context('quota quota-request-status show') as c: + c.argument('id_', options_list=['--id'], type=str, help='Quota request ID.') + c.argument('scope', type=str, help='The target Azure resource URI. For example, `/subscriptions/9f6cce51-6baf-4' + 'de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`' + '. This is the target Azure resource URI for the List GET operation. If a `{resourceName}` is added ' + 'after `/quotaLimits`, then it\'s the target Azure resource URI in the GET operation for the ' + 'specific resource.') diff --git a/src/quota/azext_quota/generated/_validators.py b/src/quota/azext_quota/generated/_validators.py new file mode 100644 index 00000000000..b33a44c1ebf --- /dev/null +++ b/src/quota/azext_quota/generated/_validators.py @@ -0,0 +1,9 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- diff --git a/src/quota/azext_quota/generated/action.py b/src/quota/azext_quota/generated/action.py new file mode 100644 index 00000000000..b49bfaeeefe --- /dev/null +++ b/src/quota/azext_quota/generated/action.py @@ -0,0 +1,10 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access diff --git a/src/quota/azext_quota/generated/commands.py b/src/quota/azext_quota/generated/commands.py new file mode 100644 index 00000000000..282aacfdd8f --- /dev/null +++ b/src/quota/azext_quota/generated/commands.py @@ -0,0 +1,53 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-statements +# pylint: disable=too-many-locals + +from azure.cli.core.commands import CliCommandType + + +def load_command_table(self, _): + + from azext_quota.generated._client_factory import cf_quota + quota_quota = CliCommandType( + operations_tmpl='azext_quota.vendored_sdks.quota.operations._quota_operations#QuotaOperations.{}', + client_factory=cf_quota) + with self.command_group('quota', quota_quota, client_factory=cf_quota, is_experimental=True) as g: + g.custom_command('list', 'quota_list') + g.custom_show_command('show', 'quota_show') + g.custom_command('create', 'quota_create', supports_no_wait=True) + g.custom_command('update', 'quota_update', supports_no_wait=True) + g.custom_wait_command('wait', 'quota_show') + + from azext_quota.generated._client_factory import cf_quota_request_status + quota_quota_request_status = CliCommandType( + operations_tmpl='azext_quota.vendored_sdks.quota.operations._quota_request_status_operations#QuotaRequestStatus' + 'Operations.{}', + client_factory=cf_quota_request_status) + with self.command_group('quota quota-request-status', quota_quota_request_status, + client_factory=cf_quota_request_status) as g: + g.custom_command('list', 'quota_quota_request_status_list') + g.custom_show_command('show', 'quota_quota_request_status_show') + + from azext_quota.generated._client_factory import cf_quota_resource_provider + quota_quota_resource_provider = CliCommandType( + operations_tmpl='azext_quota.vendored_sdks.quota.operations._quota_resource_providers_operations#QuotaResourceP' + 'rovidersOperations.{}', + client_factory=cf_quota_resource_provider) + with self.command_group('quota quota-resource-provider', quota_quota_resource_provider, + client_factory=cf_quota_resource_provider) as g: + g.custom_command('list', 'quota_quota_resource_provider_list') + + from azext_quota.generated._client_factory import cf_operation + quota_operation = CliCommandType( + operations_tmpl='azext_quota.vendored_sdks.quota.operations._operation_operations#OperationOperations.{}', + client_factory=cf_operation) + with self.command_group('quota operation', quota_operation, client_factory=cf_operation) as g: + g.custom_command('list', 'quota_operation_list') diff --git a/src/quota/azext_quota/generated/custom.py b/src/quota/azext_quota/generated/custom.py new file mode 100644 index 00000000000..cfff9f52cc7 --- /dev/null +++ b/src/quota/azext_quota/generated/custom.py @@ -0,0 +1,94 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines + +from azure.cli.core.util import sdk_no_wait + + +def quota_list(client, + scope): + return client.list(scope=scope) + + +def quota_show(client, + resource_name, + scope): + return client.get(resource_name=resource_name, + scope=scope) + + +def quota_create(client, + resource_name, + scope, + limit=None, + resource_type=None, + properties=None, + value=None, + no_wait=False): + create_quota_request = {} + create_quota_request['properties'] = {} + create_quota_request['properties']['limit'] = limit + create_quota_request['properties']['resource_type'] = resource_type + create_quota_request['properties']['properties'] = properties + create_quota_request['properties']['name'] = {} + create_quota_request['properties']['name']['value'] = value + return sdk_no_wait(no_wait, + client.begin_create_or_update, + resource_name=resource_name, + scope=scope, + create_quota_request=create_quota_request) + + +def quota_update(client, + resource_name, + scope, + limit=None, + resource_type=None, + properties=None, + value=None, + no_wait=False): + create_quota_request = {} + create_quota_request['properties'] = {} + create_quota_request['properties']['limit'] = limit + create_quota_request['properties']['resource_type'] = resource_type + create_quota_request['properties']['properties'] = properties + create_quota_request['properties']['name'] = {} + create_quota_request['properties']['name']['value'] = value + return sdk_no_wait(no_wait, + client.begin_update, + resource_name=resource_name, + scope=scope, + create_quota_request=create_quota_request) + + +def quota_quota_request_status_list(client, + scope, + filter_=None, + top=None, + skiptoken=None): + return client.list(scope=scope, + filter=filter_, + top=top, + skiptoken=skiptoken) + + +def quota_quota_request_status_show(client, + id_, + scope): + return client.get(id=id_, + scope=scope) + + +def quota_quota_resource_provider_list(client): + return client.list() + + +def quota_operation_list(client): + return client.list() diff --git a/src/quota/azext_quota/manual/__init__.py b/src/quota/azext_quota/manual/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/quota/azext_quota/manual/__init__.py @@ -0,0 +1,12 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/quota/azext_quota/tests/__init__.py b/src/quota/azext_quota/tests/__init__.py new file mode 100644 index 00000000000..70488e93851 --- /dev/null +++ b/src/quota/azext_quota/tests/__init__.py @@ -0,0 +1,116 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +import inspect +import logging +import os +import sys +import traceback +import datetime as dt + +from azure.core.exceptions import AzureError +from azure.cli.testsdk.exceptions import CliTestError, CliExecutionError, JMESPathCheckAssertionError + + +logger = logging.getLogger('azure.cli.testsdk') +logger.addHandler(logging.StreamHandler()) +__path__ = __import__('pkgutil').extend_path(__path__, __name__) +exceptions = [] +test_map = dict() +SUCCESSED = "successed" +FAILED = "failed" + + +def try_manual(func): + def import_manual_function(origin_func): + from importlib import import_module + decorated_path = inspect.getfile(origin_func).lower() + module_path = __path__[0].lower() + if not decorated_path.startswith(module_path): + raise Exception("Decorator can only be used in submodules!") + manual_path = os.path.join( + decorated_path[module_path.rfind(os.path.sep) + 1:]) + manual_file_path, manual_file_name = os.path.split(manual_path) + module_name, _ = os.path.splitext(manual_file_name) + manual_module = "..manual." + \ + ".".join(manual_file_path.split(os.path.sep) + [module_name, ]) + return getattr(import_module(manual_module, package=__name__), origin_func.__name__) + + def get_func_to_call(): + func_to_call = func + try: + func_to_call = import_manual_function(func) + logger.info("Found manual override for %s(...)", func.__name__) + except (ImportError, AttributeError): + pass + return func_to_call + + def wrapper(*args, **kwargs): + func_to_call = get_func_to_call() + logger.info("running %s()...", func.__name__) + try: + test_map[func.__name__] = dict() + test_map[func.__name__]["result"] = SUCCESSED + test_map[func.__name__]["error_message"] = "" + test_map[func.__name__]["error_stack"] = "" + test_map[func.__name__]["error_normalized"] = "" + test_map[func.__name__]["start_dt"] = dt.datetime.utcnow() + ret = func_to_call(*args, **kwargs) + except (AssertionError, AzureError, CliTestError, CliExecutionError, SystemExit, + JMESPathCheckAssertionError) as e: + use_exception_cache = os.getenv("TEST_EXCEPTION_CACHE") + if use_exception_cache is None or use_exception_cache.lower() != "true": + raise + test_map[func.__name__]["end_dt"] = dt.datetime.utcnow() + test_map[func.__name__]["result"] = FAILED + test_map[func.__name__]["error_message"] = str(e).replace("\r\n", " ").replace("\n", " ")[:500] + test_map[func.__name__]["error_stack"] = traceback.format_exc().replace( + "\r\n", " ").replace("\n", " ")[:500] + logger.info("--------------------------------------") + logger.info("step exception: %s", e) + logger.error("--------------------------------------") + logger.error("step exception in %s: %s", func.__name__, e) + logger.info(traceback.format_exc()) + exceptions.append((func.__name__, sys.exc_info())) + else: + test_map[func.__name__]["end_dt"] = dt.datetime.utcnow() + return ret + + if inspect.isclass(func): + return get_func_to_call() + return wrapper + + +def calc_coverage(filename): + filename = filename.split(".")[0] + coverage_name = filename + "_coverage.md" + with open(coverage_name, "w") as f: + f.write("|Scenario|Result|ErrorMessage|ErrorStack|ErrorNormalized|StartDt|EndDt|\n") + total = len(test_map) + covered = 0 + for k, v in test_map.items(): + if not k.startswith("step_"): + total -= 1 + continue + if v["result"] == SUCCESSED: + covered += 1 + f.write("|{step_name}|{result}|{error_message}|{error_stack}|{error_normalized}|{start_dt}|" + "{end_dt}|\n".format(step_name=k, **v)) + f.write("Coverage: {}/{}\n".format(covered, total)) + print("Create coverage\n", file=sys.stderr) + + +def raise_if(): + if exceptions: + if len(exceptions) <= 1: + raise exceptions[0][1][1] + message = "{}\nFollowed with exceptions in other steps:\n".format(str(exceptions[0][1][1])) + message += "\n".join(["{}: {}".format(h[0], h[1][1]) for h in exceptions[1:]]) + raise exceptions[0][1][0](message).with_traceback(exceptions[0][1][2]) diff --git a/src/quota/azext_quota/tests/latest/__init__.py b/src/quota/azext_quota/tests/latest/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/quota/azext_quota/tests/latest/__init__.py @@ -0,0 +1,12 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/quota/azext_quota/tests/latest/example_steps.py b/src/quota/azext_quota/tests/latest/example_steps.py new file mode 100644 index 00000000000..064b697deef --- /dev/null +++ b/src/quota/azext_quota/tests/latest/example_steps.py @@ -0,0 +1,203 @@ +# -------------------------------------------------------------------------- +# 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 .. import try_manual + + +# EXAMPLE: /Operation/get/GetOperations +@try_manual +def step_operation_list(test, checks=None): + if checks is None: + checks = [] + test.cmd('az quota operation list', + checks=checks) + + +# EXAMPLE: /Quota/put/Quotas_Put_Request_ForCompute +@try_manual +def step_create(test, checks=None): + if checks is None: + checks = [] + test.cmd('az quota create ' + '--properties "{{\\"name\\":{{\\"value\\":\\"standardFSv2Family\\"}},\\"limit\\":200}}" ' + '--resource-name "standardFSv2Family" ' + '--scope "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Compute/locations/eastus"' + '', + checks=checks) + + +# EXAMPLE: /Quota/put/Quotas_Request_ForMachineLearningServices_DedicatedResource +@try_manual +def step_create2(test, checks=None): + return step_create(test, checks) + + +# EXAMPLE: /Quota/put/Quotas_Request_ForMachineLearningServices_LowPriorityResource +@try_manual +def step_create3(test, checks=None): + if checks is None: + checks = [] + test.cmd('az quota create ' + '--properties "{{\\"name\\":{{\\"value\\":\\"TotalLowPriorityCores\\"}},\\"limit\\":200,\\"resourceType\\"' + ':\\"lowPriority\\"}}" ' + '--resource-name "TotalLowPriorityCores" ' + '--scope "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.MachineLearningServices/l' + 'ocations/eastus"', + checks=checks) + + +# EXAMPLE: /Quota/put/Quotas_Request_ForNetwork +@try_manual +def step_create4(test, checks=None): + if checks is None: + checks = [] + test.cmd('az quota create ' + '--properties "{{\\"name\\":{{\\"value\\":\\"MinPublicIpInterNetworkPrefixLength\\"}},\\"limit\\":200,\\"r' + 'esourceType\\":\\"MinPublicIpInterNetworkPrefixLength\\"}}" ' + '--resource-name "MinPublicIpInterNetworkPrefixLength" ' + '--scope "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Network/locations/eastus"' + '', + checks=checks) + + +# EXAMPLE: /Quota/get/Quotas_Get_Request_ForCompute +@try_manual +def step_show(test, checks=None): + if checks is None: + checks = [] + test.cmd('az quota show ' + '--resource-name "standardNDSFamily" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus"' + '', + checks=checks) + + +# EXAMPLE: /Quota/get/Quotas_listUsagesForCompute +@try_manual +def step_list(test, checks=None): + if checks is None: + checks = [] + test.cmd('az quota list ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus"' + '', + checks=checks) + + +# EXAMPLE: /Quota/get/Quotas_listUsagesForNetwork +@try_manual +def step_list2(test, checks=None): + if checks is None: + checks = [] + test.cmd('az quota list ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus"' + '', + checks=checks) + + +# EXAMPLE: /Quota/get/Quotas_listUsagesMachineLearningServices +@try_manual +def step_list3(test, checks=None): + if checks is None: + checks = [] + test.cmd('az quota list ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.MachineLearningServices/l' + 'ocations/eastus"', + checks=checks) + + +# EXAMPLE: /Quota/get/Quotas_Request_ForNetwork +@try_manual +def step_show2(test, checks=None): + if checks is None: + checks = [] + test.cmd('az quota show ' + '--resource-name "MinPublicIpInterNetworkPrefixLength" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus"' + '', + checks=checks) + + +# EXAMPLE: /Quota/patch/Quotas_Request_PatchForCompute +@try_manual +def step_update(test, checks=None): + if checks is None: + checks = [] + test.cmd('az quota update ' + '--properties "{{\\"name\\":{{\\"value\\":\\"standardFSv2Family\\"}},\\"limit\\":200}}" ' + '--resource-name "standardFSv2Family" ' + '--scope "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Compute/locations/eastus"' + '', + checks=checks) + + +# EXAMPLE: /Quota/patch/Quotas_Request_PatchForNetwork +@try_manual +def step_update2(test, checks=None): + if checks is None: + checks = [] + test.cmd('az quota update ' + '--properties "{{\\"name\\":{{\\"value\\":\\"MinPublicIpInterNetworkPrefixLength\\"}},\\"limit\\":200,\\"r' + 'esourceType\\":\\"MinPublicIpInterNetworkPrefixLength\\"}}" ' + '--resource-name "MinPublicIpInterNetworkPrefixLength" ' + '--scope "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Network/locations/eastus"' + '', + checks=checks) + + +# EXAMPLE: /QuotaRequestStatus/get/QuotaRequestFailed +@try_manual +def step_quota_request_status_show(test, checks=None): + if checks is None: + checks = [] + test.cmd('az quota quota-request-status show ' + '--id "2B5C8515-37D8-4B6A-879B-CD641A2CF605" ' + '--scope "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus"' + '', + checks=checks) + + +# EXAMPLE: /QuotaRequestStatus/get/QuotaRequestHistory +@try_manual +def step_quota_request_status_list(test, checks=None): + if checks is None: + checks = [] + test.cmd('az quota quota-request-status list ' + '--scope "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Compute/locations/eastus"' + '', + checks=checks) + + +# EXAMPLE: /QuotaRequestStatus/get/QuotaRequestInProgress +@try_manual +def step_quota_request_status_show2(test, checks=None): + return step_quota_request_status_show(test, checks) + + +# EXAMPLE: /QuotaRequestStatus/get/QuotaRequestStatus +@try_manual +def step_quota_request_status_show3(test, checks=None): + if checks is None: + checks = [] + test.cmd('az quota quota-request-status show ' + '--id "2B5C8515-37D8-4B6A-879B-CD641A2CF605" ' + '--scope "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Compute/locations/eastus"' + '', + checks=checks) + + +# EXAMPLE: /QuotaResourceProviders/get/Quotas_listMetadataForRPs +@try_manual +def step_quota_resource_provider_list(test, checks=None): + if checks is None: + checks = [] + test.cmd('az quota quota-resource-provider list', + checks=checks) + diff --git a/src/quota/azext_quota/tests/latest/test_quota_scenario.py b/src/quota/azext_quota/tests/latest/test_quota_scenario.py new file mode 100644 index 00000000000..9ea4b6f162c --- /dev/null +++ b/src/quota/azext_quota/tests/latest/test_quota_scenario.py @@ -0,0 +1,88 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +import os +from azure.cli.testsdk import ScenarioTest +from .example_steps import step_operation_list +from .example_steps import step_create +from .example_steps import step_create2 +from .example_steps import step_create3 +from .example_steps import step_create4 +from .example_steps import step_show +from .example_steps import step_list +from .example_steps import step_list2 +from .example_steps import step_list3 +from .example_steps import step_show2 +from .example_steps import step_update +from .example_steps import step_update2 +from .example_steps import step_quota_request_status_show +from .example_steps import step_quota_request_status_list +from .example_steps import step_quota_request_status_show2 +from .example_steps import step_quota_request_status_show3 +from .example_steps import step_quota_resource_provider_list +from .. import ( + try_manual, + raise_if, + calc_coverage +) + + +TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) + + +# Env setup_scenario +@try_manual +def setup_scenario(test): + pass + + +# Env cleanup_scenario +@try_manual +def cleanup_scenario(test): + pass + + +# Testcase: Scenario +@try_manual +def call_scenario(test): + setup_scenario(test) + step_operation_list(test, checks=[]) + step_create(test, checks=[]) + step_create2(test, checks=[]) + step_create3(test, checks=[]) + step_create4(test, checks=[]) + step_show(test, checks=[]) + step_list(test, checks=[]) + step_list2(test, checks=[]) + step_list3(test, checks=[]) + step_show2(test, checks=[]) + step_update(test, checks=[]) + step_update2(test, checks=[]) + step_quota_request_status_show(test, checks=[]) + step_quota_request_status_list(test, checks=[]) + step_quota_request_status_show2(test, checks=[]) + step_quota_request_status_show3(test, checks=[]) + step_quota_resource_provider_list(test, checks=[]) + cleanup_scenario(test) + + +# Test class for Scenario +@try_manual +class QuotaScenarioTest(ScenarioTest): + + def __init__(self, *args, **kwargs): + super(QuotaScenarioTest, self).__init__(*args, **kwargs) + + + def test_quota_Scenario(self): + call_scenario(self) + calc_coverage(__file__) + raise_if() + diff --git a/src/quota/azext_quota/vendored_sdks/__init__.py b/src/quota/azext_quota/vendored_sdks/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/quota/azext_quota/vendored_sdks/__init__.py @@ -0,0 +1,12 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/quota/azext_quota/vendored_sdks/quota/__init__.py b/src/quota/azext_quota/vendored_sdks/quota/__init__.py new file mode 100644 index 00000000000..a78eeca53ba --- /dev/null +++ b/src/quota/azext_quota/vendored_sdks/quota/__init__.py @@ -0,0 +1,16 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 ._azure_quota_extension_api import AzureQuotaExtensionAPI +__all__ = ['AzureQuotaExtensionAPI'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/src/quota/azext_quota/vendored_sdks/quota/_azure_quota_extension_api.py b/src/quota/azext_quota/vendored_sdks/quota/_azure_quota_extension_api.py new file mode 100644 index 00000000000..fe18875327e --- /dev/null +++ b/src/quota/azext_quota/vendored_sdks/quota/_azure_quota_extension_api.py @@ -0,0 +1,81 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + +from ._configuration import AzureQuotaExtensionAPIConfiguration +from .operations import QuotaOperations +from .operations import QuotaRequestStatusOperations +from .operations import QuotaResourceProvidersOperations +from .operations import OperationOperations +from . import models + + +class AzureQuotaExtensionAPI(object): + """Microsoft Azure Quota Resource Provider. + + :ivar quota: QuotaOperations operations + :vartype quota: azure_quota_extension_api.operations.QuotaOperations + :ivar quota_request_status: QuotaRequestStatusOperations operations + :vartype quota_request_status: azure_quota_extension_api.operations.QuotaRequestStatusOperations + :ivar quota_resource_providers: QuotaResourceProvidersOperations operations + :vartype quota_resource_providers: azure_quota_extension_api.operations.QuotaResourceProvidersOperations + :ivar operation: OperationOperations operations + :vartype operation: azure_quota_extension_api.operations.OperationOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = AzureQuotaExtensionAPIConfiguration(credential, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.quota = QuotaOperations( + self._client, self._config, self._serialize, self._deserialize) + self.quota_request_status = QuotaRequestStatusOperations( + self._client, self._config, self._serialize, self._deserialize) + self.quota_resource_providers = QuotaResourceProvidersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operation = OperationOperations( + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> AzureQuotaExtensionAPI + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/src/quota/azext_quota/vendored_sdks/quota/_configuration.py b/src/quota/azext_quota/vendored_sdks/quota/_configuration.py new file mode 100644 index 00000000000..c6345830dd3 --- /dev/null +++ b/src/quota/azext_quota/vendored_sdks/quota/_configuration.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + +VERSION = "unknown" + +class AzureQuotaExtensionAPIConfiguration(Configuration): + """Configuration for AzureQuotaExtensionAPI. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + """ + + def __init__( + self, + credential, # type: "TokenCredential" + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + super(AzureQuotaExtensionAPIConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.api_version = "2021-03-15-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'azurequotaextensionapi/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/quota/azext_quota/vendored_sdks/quota/aio/__init__.py b/src/quota/azext_quota/vendored_sdks/quota/aio/__init__.py new file mode 100644 index 00000000000..ab00c327b95 --- /dev/null +++ b/src/quota/azext_quota/vendored_sdks/quota/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 ._azure_quota_extension_api import AzureQuotaExtensionAPI +__all__ = ['AzureQuotaExtensionAPI'] diff --git a/src/quota/azext_quota/vendored_sdks/quota/aio/_azure_quota_extension_api.py b/src/quota/azext_quota/vendored_sdks/quota/aio/_azure_quota_extension_api.py new file mode 100644 index 00000000000..45c61245860 --- /dev/null +++ b/src/quota/azext_quota/vendored_sdks/quota/aio/_azure_quota_extension_api.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 typing import Any, Optional, TYPE_CHECKING + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import AzureQuotaExtensionAPIConfiguration +from .operations import QuotaOperations +from .operations import QuotaRequestStatusOperations +from .operations import QuotaResourceProvidersOperations +from .operations import OperationOperations +from .. import models + + +class AzureQuotaExtensionAPI(object): + """Microsoft Azure Quota Resource Provider. + + :ivar quota: QuotaOperations operations + :vartype quota: azure_quota_extension_api.aio.operations.QuotaOperations + :ivar quota_request_status: QuotaRequestStatusOperations operations + :vartype quota_request_status: azure_quota_extension_api.aio.operations.QuotaRequestStatusOperations + :ivar quota_resource_providers: QuotaResourceProvidersOperations operations + :vartype quota_resource_providers: azure_quota_extension_api.aio.operations.QuotaResourceProvidersOperations + :ivar operation: OperationOperations operations + :vartype operation: azure_quota_extension_api.aio.operations.OperationOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = AzureQuotaExtensionAPIConfiguration(credential, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.quota = QuotaOperations( + self._client, self._config, self._serialize, self._deserialize) + self.quota_request_status = QuotaRequestStatusOperations( + self._client, self._config, self._serialize, self._deserialize) + self.quota_resource_providers = QuotaResourceProvidersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operation = OperationOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "AzureQuotaExtensionAPI": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/src/quota/azext_quota/vendored_sdks/quota/aio/_configuration.py b/src/quota/azext_quota/vendored_sdks/quota/aio/_configuration.py new file mode 100644 index 00000000000..2eb4364f74d --- /dev/null +++ b/src/quota/azext_quota/vendored_sdks/quota/aio/_configuration.py @@ -0,0 +1,60 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +VERSION = "unknown" + +class AzureQuotaExtensionAPIConfiguration(Configuration): + """Configuration for AzureQuotaExtensionAPI. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + super(AzureQuotaExtensionAPIConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.api_version = "2021-03-15-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'azurequotaextensionapi/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/quota/azext_quota/vendored_sdks/quota/aio/operations/__init__.py b/src/quota/azext_quota/vendored_sdks/quota/aio/operations/__init__.py new file mode 100644 index 00000000000..f398425a8eb --- /dev/null +++ b/src/quota/azext_quota/vendored_sdks/quota/aio/operations/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 ._quota_operations import QuotaOperations +from ._quota_request_status_operations import QuotaRequestStatusOperations +from ._quota_resource_providers_operations import QuotaResourceProvidersOperations +from ._operation_operations import OperationOperations + +__all__ = [ + 'QuotaOperations', + 'QuotaRequestStatusOperations', + 'QuotaResourceProvidersOperations', + 'OperationOperations', +] diff --git a/src/quota/azext_quota/vendored_sdks/quota/aio/operations/_operation_operations.py b/src/quota/azext_quota/vendored_sdks/quota/aio/operations/_operation_operations.py new file mode 100644 index 00000000000..28a0d81383f --- /dev/null +++ b/src/quota/azext_quota/vendored_sdks/quota/aio/operations/_operation_operations.py @@ -0,0 +1,107 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class OperationOperations: + """OperationOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure_quota_extension_api.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs + ) -> AsyncIterable["models.OperationList"]: + """GET operations. + + List all GET operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_quota_extension_api.models.OperationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-15-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ExceptionResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Quota/operations'} # type: ignore diff --git a/src/quota/azext_quota/vendored_sdks/quota/aio/operations/_quota_operations.py b/src/quota/azext_quota/vendored_sdks/quota/aio/operations/_quota_operations.py new file mode 100644 index 00000000000..8af307969d3 --- /dev/null +++ b/src/quota/azext_quota/vendored_sdks/quota/aio/operations/_quota_operations.py @@ -0,0 +1,474 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class QuotaOperations: + """QuotaOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure_quota_extension_api.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_name: str, + scope: str, + **kwargs + ) -> "models.CurrentQuotaLimitBase": + """Gets the quota limit and current quota usage of a resource. The response can be used to + determine the remaining quota and calculate a new quota limit that can be submitted with a PUT + request. + + :param resource_name: Resource name for a given resource provider. For example: + + + * SKU name for Microsoft.Compute + * Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices. + :type resource_name: str + :param scope: The target Azure resource URI. For example, + ``/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms- + test/providers/Microsoft.Batch/batchAccounts/testAccount/``. This is the target Azure resource + URI for the List GET operation. If a ``{resourceName}`` is added after ``/quotaLimits``\ , then + it's the target Azure resource URI in the GET operation for the specific resource. + :type scope: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CurrentQuotaLimitBase, or the result of cls(response) + :rtype: ~azure_quota_extension_api.models.CurrentQuotaLimitBase + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CurrentQuotaLimitBase"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-15-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ExceptionResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('CurrentQuotaLimitBase', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.Quota/quotaLimits/{resourceName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_name: str, + scope: str, + create_quota_request: "models.CurrentQuotaLimitBase", + **kwargs + ) -> "models.CurrentQuotaLimitBase": + cls = kwargs.pop('cls', None) # type: ClsType["models.CurrentQuotaLimitBase"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-15-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(create_quota_request, 'CurrentQuotaLimitBase') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ExceptionResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CurrentQuotaLimitBase', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('CurrentQuotaLimitBase', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/{scope}/providers/Microsoft.Quota/quotaLimits/{resourceName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_name: str, + scope: str, + create_quota_request: "models.CurrentQuotaLimitBase", + **kwargs + ) -> AsyncLROPoller["models.CurrentQuotaLimitBase"]: + """Create or update the quota limit for the specified resource to the requested value. To update + the quota, follow these steps: + + + #. Use the GET operation to determine how much quota remains for the specific resource and to + calculate the new quota limit. These steps are detailed in `this example + `_. + #. Use this PUT operation to update the quota limit. + + :param resource_name: Resource name for a given resource provider. For example: + + + * SKU name for Microsoft.Compute + * Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices. + :type resource_name: str + :param scope: The target Azure resource URI. For example, + ``/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms- + test/providers/Microsoft.Batch/batchAccounts/testAccount/``. This is the target Azure resource + URI for the List GET operation. If a ``{resourceName}`` is added after ``/quotaLimits``\ , then + it's the target Azure resource URI in the GET operation for the specific resource. + :type scope: str + :param create_quota_request: Quota requests payload. + :type create_quota_request: ~azure_quota_extension_api.models.CurrentQuotaLimitBase + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CurrentQuotaLimitBase or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure_quota_extension_api.models.CurrentQuotaLimitBase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.CurrentQuotaLimitBase"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_name=resource_name, + scope=scope, + create_quota_request=create_quota_request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('CurrentQuotaLimitBase', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/{scope}/providers/Microsoft.Quota/quotaLimits/{resourceName}'} # type: ignore + + async def _update_initial( + self, + resource_name: str, + scope: str, + create_quota_request: "models.CurrentQuotaLimitBase", + **kwargs + ) -> "models.CurrentQuotaLimitBase": + cls = kwargs.pop('cls', None) # type: ClsType["models.CurrentQuotaLimitBase"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-15-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(create_quota_request, 'CurrentQuotaLimitBase') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ExceptionResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CurrentQuotaLimitBase', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('CurrentQuotaLimitBase', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/{scope}/providers/Microsoft.Quota/quotaLimits/{resourceName}'} # type: ignore + + async def begin_update( + self, + resource_name: str, + scope: str, + create_quota_request: "models.CurrentQuotaLimitBase", + **kwargs + ) -> AsyncLROPoller["models.CurrentQuotaLimitBase"]: + """Update the quota limit for a specific resource to the specified value: + + + #. Use the GET operation to determine how much quota remains for the specific resource and to + calculate the new quota limit. These steps are detailed in `this example + `_. + #. Use this PUT operation to update the quota limit. + + :param resource_name: Resource name for a given resource provider. For example: + + + * SKU name for Microsoft.Compute + * Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices. + :type resource_name: str + :param scope: The target Azure resource URI. For example, + ``/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms- + test/providers/Microsoft.Batch/batchAccounts/testAccount/``. This is the target Azure resource + URI for the List GET operation. If a ``{resourceName}`` is added after ``/quotaLimits``\ , then + it's the target Azure resource URI in the GET operation for the specific resource. + :type scope: str + :param create_quota_request: Quota requests payload. + :type create_quota_request: ~azure_quota_extension_api.models.CurrentQuotaLimitBase + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CurrentQuotaLimitBase or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure_quota_extension_api.models.CurrentQuotaLimitBase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.CurrentQuotaLimitBase"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_name=resource_name, + scope=scope, + create_quota_request=create_quota_request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('CurrentQuotaLimitBase', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/{scope}/providers/Microsoft.Quota/quotaLimits/{resourceName}'} # type: ignore + + def list( + self, + scope: str, + **kwargs + ) -> AsyncIterable["models.QuotaLimits"]: + """Get a list of current quota limits and usages of all resources. The response from this GET + operation can be leveraged to submit requests to update a quota. + + :param scope: The target Azure resource URI. For example, + ``/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms- + test/providers/Microsoft.Batch/batchAccounts/testAccount/``. This is the target Azure resource + URI for the List GET operation. If a ``{resourceName}`` is added after ``/quotaLimits``\ , then + it's the target Azure resource URI in the GET operation for the specific resource. + :type scope: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either QuotaLimits or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_quota_extension_api.models.QuotaLimits] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.QuotaLimits"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-15-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('QuotaLimits', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ExceptionResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/{scope}/providers/Microsoft.Quota/quotaLimits'} # type: ignore diff --git a/src/quota/azext_quota/vendored_sdks/quota/aio/operations/_quota_request_status_operations.py b/src/quota/azext_quota/vendored_sdks/quota/aio/operations/_quota_request_status_operations.py new file mode 100644 index 00000000000..ec09c82f2b1 --- /dev/null +++ b/src/quota/azext_quota/vendored_sdks/quota/aio/operations/_quota_request_status_operations.py @@ -0,0 +1,210 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class QuotaRequestStatusOperations: + """QuotaRequestStatusOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure_quota_extension_api.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + id: str, + scope: str, + **kwargs + ) -> "models.QuotaRequestDetails": + """Gets the quota request details and status by quota request ID for the resources of the resource + provider at a specific location. The quota request ID **id** is returned in the response of the + PUT operation. + + :param id: Quota request ID. + :type id: str + :param scope: The target Azure resource URI. For example, + ``/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms- + test/providers/Microsoft.Batch/batchAccounts/testAccount/``. This is the target Azure resource + URI for the List GET operation. If a ``{resourceName}`` is added after ``/quotaLimits``\ , then + it's the target Azure resource URI in the GET operation for the specific resource. + :type scope: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: QuotaRequestDetails, or the result of cls(response) + :rtype: ~azure_quota_extension_api.models.QuotaRequestDetails + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.QuotaRequestDetails"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-15-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'id': self._serialize.url("id", id, 'str'), + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ExceptionResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('QuotaRequestDetails', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.Quota/quotaLimitsRequests/{id}'} # type: ignore + + def list( + self, + scope: str, + filter: Optional[str] = None, + top: Optional[int] = None, + skiptoken: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.QuotaRequestDetailsList"]: + """For the specified location and resource provider, gets the current quota requests under the + subscription for a one year period ending at the time is made. Use the **oData** filter can be + used to select quota requests. + + :param scope: The target Azure resource URI. For example, + ``/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms- + test/providers/Microsoft.Batch/batchAccounts/testAccount/``. This is the target Azure resource + URI for the List GET operation. If a ``{resourceName}`` is added after ``/quotaLimits``\ , then + it's the target Azure resource URI in the GET operation for the specific resource. + :type scope: str + :param filter: .. list-table:: + :header-rows: 1 + + * - Field + - Supported operators + * - + + + |requestSubmitTime | ge, le, eq, gt, lt + |provisioningState eq {QuotaRequestState} + |resourceName eq {resourceName}. + :type filter: str + :param top: Number of records to return. + :type top: int + :param skiptoken: The **Skiptoken** parameter is used only if a previous operation returned a + partial result. If a previous response contains a **nextLink** element, the value of the + **nextLink** element includes a **skiptoken** parameter that specifies a starting point to use + for subsequent calls. + :type skiptoken: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either QuotaRequestDetailsList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_quota_extension_api.models.QuotaRequestDetailsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.QuotaRequestDetailsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-15-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) + if skiptoken is not None: + query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('QuotaRequestDetailsList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ExceptionResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/{scope}/providers/Microsoft.Quota/quotaLimitsRequests'} # type: ignore diff --git a/src/quota/azext_quota/vendored_sdks/quota/aio/operations/_quota_resource_providers_operations.py b/src/quota/azext_quota/vendored_sdks/quota/aio/operations/_quota_resource_providers_operations.py new file mode 100644 index 00000000000..108bfd94b59 --- /dev/null +++ b/src/quota/azext_quota/vendored_sdks/quota/aio/operations/_quota_resource_providers_operations.py @@ -0,0 +1,97 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class QuotaResourceProvidersOperations: + """QuotaResourceProvidersOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure_quota_extension_api.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def list( + self, + **kwargs + ) -> "models.ResourceProvidersList": + """Gets the list of current resource providers supported by the Microsoft.Quota resource provider. + For each resource provider, the resource templates the resource provider supports are be + provided. + For each resource template, the resource dimensions are listed. The resource dimensions are the + name-value pairs in the resource URI. + Example: Microsoft.Compute Resource Provider + The URI template is + '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{locationId}/quotaBucket'. + The actual dimensions vary depending on the resource provider. + The resource dimensions are {subscriptions},{locations},{quotaBucket}. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceProvidersList, or the result of cls(response) + :rtype: ~azure_quota_extension_api.models.ResourceProvidersList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceProvidersList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-15-preview" + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ExceptionResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceProvidersList', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Quota/quotaLimitProviders'} # type: ignore diff --git a/src/quota/azext_quota/vendored_sdks/quota/models/__init__.py b/src/quota/azext_quota/vendored_sdks/quota/models/__init__.py new file mode 100644 index 00000000000..150046dee38 --- /dev/null +++ b/src/quota/azext_quota/vendored_sdks/quota/models/__init__.py @@ -0,0 +1,111 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import CommonResourceProperties + from ._models_py3 import CreateGenericQuotaRequestParameters + from ._models_py3 import CurrentQuotaLimitBase + from ._models_py3 import ExceptionResponse + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationList + from ._models_py3 import OperationResponse + from ._models_py3 import QuotaBucketProperties + from ._models_py3 import QuotaLimits + from ._models_py3 import QuotaLimitsResponse + from ._models_py3 import QuotaProperties + from ._models_py3 import QuotaRequestDetails + from ._models_py3 import QuotaRequestDetailsList + from ._models_py3 import QuotaRequestOneResourceSubmitResponse + from ._models_py3 import QuotaRequestProperties + from ._models_py3 import QuotaRequestSubmitResponse + from ._models_py3 import QuotaRequestSubmitResponse202 + from ._models_py3 import QuotaTemplateDetails + from ._models_py3 import QuotaTemplatesDetails + from ._models_py3 import QuotaTypeDimensionInformation + from ._models_py3 import ResourceName + from ._models_py3 import ResourceProviderDimension + from ._models_py3 import ResourceProviderInformation + from ._models_py3 import ResourceProviderTemplate + from ._models_py3 import ResourceProvidersList + from ._models_py3 import ResourceQueryDetails + from ._models_py3 import ServiceError + from ._models_py3 import ServiceErrorDetail + from ._models_py3 import SubRequest +except (SyntaxError, ImportError): + from ._models import CommonResourceProperties # type: ignore + from ._models import CreateGenericQuotaRequestParameters # type: ignore + from ._models import CurrentQuotaLimitBase # type: ignore + from ._models import ExceptionResponse # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationList # type: ignore + from ._models import OperationResponse # type: ignore + from ._models import QuotaBucketProperties # type: ignore + from ._models import QuotaLimits # type: ignore + from ._models import QuotaLimitsResponse # type: ignore + from ._models import QuotaProperties # type: ignore + from ._models import QuotaRequestDetails # type: ignore + from ._models import QuotaRequestDetailsList # type: ignore + from ._models import QuotaRequestOneResourceSubmitResponse # type: ignore + from ._models import QuotaRequestProperties # type: ignore + from ._models import QuotaRequestSubmitResponse # type: ignore + from ._models import QuotaRequestSubmitResponse202 # type: ignore + from ._models import QuotaTemplateDetails # type: ignore + from ._models import QuotaTemplatesDetails # type: ignore + from ._models import QuotaTypeDimensionInformation # type: ignore + from ._models import ResourceName # type: ignore + from ._models import ResourceProviderDimension # type: ignore + from ._models import ResourceProviderInformation # type: ignore + from ._models import ResourceProviderTemplate # type: ignore + from ._models import ResourceProvidersList # type: ignore + from ._models import ResourceQueryDetails # type: ignore + from ._models import ServiceError # type: ignore + from ._models import ServiceErrorDetail # type: ignore + from ._models import SubRequest # type: ignore + +from ._azure_quota_extension_api_enums import ( + QuotaRequestState, + ResourceQueryMethod, + ResourceQueryType, + ResourceType, +) + +__all__ = [ + 'CommonResourceProperties', + 'CreateGenericQuotaRequestParameters', + 'CurrentQuotaLimitBase', + 'ExceptionResponse', + 'OperationDisplay', + 'OperationList', + 'OperationResponse', + 'QuotaBucketProperties', + 'QuotaLimits', + 'QuotaLimitsResponse', + 'QuotaProperties', + 'QuotaRequestDetails', + 'QuotaRequestDetailsList', + 'QuotaRequestOneResourceSubmitResponse', + 'QuotaRequestProperties', + 'QuotaRequestSubmitResponse', + 'QuotaRequestSubmitResponse202', + 'QuotaTemplateDetails', + 'QuotaTemplatesDetails', + 'QuotaTypeDimensionInformation', + 'ResourceName', + 'ResourceProviderDimension', + 'ResourceProviderInformation', + 'ResourceProviderTemplate', + 'ResourceProvidersList', + 'ResourceQueryDetails', + 'ServiceError', + 'ServiceErrorDetail', + 'SubRequest', + 'QuotaRequestState', + 'ResourceQueryMethod', + 'ResourceQueryType', + 'ResourceType', +] diff --git a/src/quota/azext_quota/vendored_sdks/quota/models/_azure_quota_extension_api_enums.py b/src/quota/azext_quota/vendored_sdks/quota/models/_azure_quota_extension_api_enums.py new file mode 100644 index 00000000000..06b11f680dd --- /dev/null +++ b/src/quota/azext_quota/vendored_sdks/quota/models/_azure_quota_extension_api_enums.py @@ -0,0 +1,61 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class QuotaRequestState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Quota request status. + """ + + ACCEPTED = "Accepted" + INVALID = "Invalid" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + IN_PROGRESS = "InProgress" + +class ResourceQueryMethod(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The resource query method. + """ + + GET = "GET" + POST = "POST" + +class ResourceQueryType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Resource query types. For extensibility, it is a string. + """ + + ARG = "ARG" + REST_API = "RestAPI" + +class ResourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Resource types. For extensibility, it is a string. + """ + + STANDARD = "standard" + DEDICATED = "dedicated" + LOW_PRIORITY = "lowPriority" + SHARED = "shared" + SERVICE_SPECIFIC = "serviceSpecific" diff --git a/src/quota/azext_quota/vendored_sdks/quota/models/_models.py b/src/quota/azext_quota/vendored_sdks/quota/models/_models.py new file mode 100644 index 00000000000..bbca33d09ed --- /dev/null +++ b/src/quota/azext_quota/vendored_sdks/quota/models/_models.py @@ -0,0 +1,1023 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class CommonResourceProperties(msrest.serialization.Model): + """Resource properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. "Microsoft.Quota/quotaLimits". + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CommonResourceProperties, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class CreateGenericQuotaRequestParameters(msrest.serialization.Model): + """Quota change requests information. + + :param value: Quota change requests. + :type value: list[~azure_quota_extension_api.models.CurrentQuotaLimitBase] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CurrentQuotaLimitBase]'}, + } + + def __init__( + self, + **kwargs + ): + super(CreateGenericQuotaRequestParameters, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class CurrentQuotaLimitBase(msrest.serialization.Model): + """Quota limit. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource Id. + :vartype id: str + :ivar type: The resource type. + :vartype type: str + :ivar name: The resource name. + :vartype name: str + :param properties: Quota properties for the specified resource. + :type properties: ~azure_quota_extension_api.models.QuotaProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'QuotaProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(CurrentQuotaLimitBase, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.properties = kwargs.get('properties', None) + + +class ExceptionResponse(msrest.serialization.Model): + """Error. + + :param error: API error details. + :type error: ~azure_quota_extension_api.models.ServiceError + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ServiceError'}, + } + + def __init__( + self, + **kwargs + ): + super(ExceptionResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class OperationDisplay(msrest.serialization.Model): + """OperationDisplay. + + :param provider: Provider name. + :type provider: str + :param resource: Resource name. + :type resource: str + :param operation: Operation name. + :type operation: str + :param description: Operation description. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) + + +class OperationList(msrest.serialization.Model): + """OperationList. + + :param value: + :type value: list[~azure_quota_extension_api.models.OperationResponse] + :param next_link: URL to get the next page of items. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OperationResponse]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class OperationResponse(msrest.serialization.Model): + """OperationResponse. + + :param name: + :type name: str + :param display: + :type display: ~azure_quota_extension_api.models.OperationDisplay + :param origin: + :type origin: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationResponse, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) + self.origin = kwargs.get('origin', None) + + +class QuotaBucketProperties(msrest.serialization.Model): + """quotaBucket provider properties. + + :param name: Property name. + :type name: str + :param display_name: Display name. + :type display_name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(QuotaBucketProperties, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + + +class QuotaLimits(msrest.serialization.Model): + """Quota limits. + + :param value: List of quota limits. + :type value: list[~azure_quota_extension_api.models.CurrentQuotaLimitBase] + :param next_link: The URI used to fetch the next page of quota limits. When there are no more + pages, this is null. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CurrentQuotaLimitBase]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(QuotaLimits, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class QuotaLimitsResponse(msrest.serialization.Model): + """Quota limits request response. + + :param value: List of quota limits with the quota request status. + :type value: list[~azure_quota_extension_api.models.CurrentQuotaLimitBase] + :param next_link: The URI used to fetch the next page of quota limits. When there are no more + pages, this is null. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CurrentQuotaLimitBase]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(QuotaLimitsResponse, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class QuotaProperties(msrest.serialization.Model): + """Quota properties for the specified resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param limit: Quota limit. + :type limit: int + :ivar current_value: Usage information for the current resource. + :vartype current_value: int + :ivar unit: The quota limit units, such as Count and Bytes. When requesting quota, use the + **unit** value returned in the GET response in the request body of your PUT operation. + :vartype unit: str + :param name: Resource name provided by the resource provider. Use this property name when + requesting quota. + :type name: ~azure_quota_extension_api.models.ResourceName + :param resource_type: Resource type name. Possible values include: "standard", "dedicated", + "lowPriority", "shared", "serviceSpecific". + :type resource_type: str or ~azure_quota_extension_api.models.ResourceType + :ivar quota_period: The time period over which the quota usage values are summarized. For + example: + *P1D (per one day)*\ PT1M (per one minute) + *PT1S (per one second). + This parameter is optional because, for some resources like compute, the period is irrelevant. + :vartype quota_period: str + :ivar is_quota_applicable: States if quota can be requested for this resource. + :vartype is_quota_applicable: bool + :param properties: Additional properties for the specific resource provider. + :type properties: object + """ + + _validation = { + 'current_value': {'readonly': True}, + 'unit': {'readonly': True}, + 'quota_period': {'readonly': True}, + 'is_quota_applicable': {'readonly': True}, + } + + _attribute_map = { + 'limit': {'key': 'limit', 'type': 'int'}, + 'current_value': {'key': 'currentValue', 'type': 'int'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'ResourceName'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'quota_period': {'key': 'quotaPeriod', 'type': 'str'}, + 'is_quota_applicable': {'key': 'isQuotaApplicable', 'type': 'bool'}, + 'properties': {'key': 'properties', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(QuotaProperties, self).__init__(**kwargs) + self.limit = kwargs.get('limit', None) + self.current_value = None + self.unit = None + self.name = kwargs.get('name', None) + self.resource_type = kwargs.get('resource_type', None) + self.quota_period = None + self.is_quota_applicable = None + self.properties = kwargs.get('properties', None) + + +class QuotaRequestDetails(msrest.serialization.Model): + """List of quota requests with details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Quota request ID. + :vartype id: str + :ivar name: Quota request name. + :vartype name: str + :ivar type: Resource type. "Microsoft.Quota/quotaLimits". + :vartype type: str + :ivar provisioning_state: The quota request status. Possible values include: "Accepted", + "Invalid", "Succeeded", "Failed", "InProgress". + :vartype provisioning_state: str or ~azure_quota_extension_api.models.QuotaRequestState + :ivar message: User-friendly status message. + :vartype message: str + :ivar request_submit_time: The quota request submission time. The date conforms to the + following format specified by the ISO 8601 standard: yyyy-MM-ddTHH:mm:ssZ. + :vartype request_submit_time: ~datetime.datetime + :param value: Quota request details. + :type value: list[~azure_quota_extension_api.models.SubRequest] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'message': {'readonly': True}, + 'request_submit_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'message': {'key': 'properties.message', 'type': 'str'}, + 'request_submit_time': {'key': 'properties.requestSubmitTime', 'type': 'iso-8601'}, + 'value': {'key': 'properties.value', 'type': '[SubRequest]'}, + } + + def __init__( + self, + **kwargs + ): + super(QuotaRequestDetails, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.provisioning_state = None + self.message = None + self.request_submit_time = None + self.value = kwargs.get('value', None) + + +class QuotaRequestDetailsList(msrest.serialization.Model): + """Quota request information. + + :param value: Quota request details. + :type value: list[~azure_quota_extension_api.models.QuotaRequestDetails] + :param next_link: The URI for fetching the next page of quota limits. When there are no more + pages, this is null. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[QuotaRequestDetails]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(QuotaRequestDetailsList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class QuotaRequestOneResourceSubmitResponse(msrest.serialization.Model): + """Quota request response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Quota request ID. + :vartype id: str + :ivar name: The name of the quota request. + :vartype name: str + :ivar type: Resource type. "Microsoft.Quota/ServiceLimitRequests". + :vartype type: str + :ivar provisioning_state: Quota request status. Possible values include: "Accepted", "Invalid", + "Succeeded", "Failed", "InProgress". + :vartype provisioning_state: str or ~azure_quota_extension_api.models.QuotaRequestState + :ivar message: User-friendly status message. + :vartype message: str + :ivar request_submit_time: Quota request submission time. The date conforms to the following + ISO 8601 standard format: yyyy-MM-ddTHH:mm:ssZ. + :vartype request_submit_time: ~datetime.datetime + :param limit: Quota limit. + :type limit: int + :ivar current_value: Usage information for the current resource. + :vartype current_value: int + :param unit: The quota limit units, such as Count and Bytes. When requesting quota, use the + **unit** value returned in the GET response in the request body of your PUT operation. + :type unit: str + :param name_properties_name: Resource name provided by the resource provider. Use this property + name when requesting quota. + :type name_properties_name: ~azure_quota_extension_api.models.ResourceName + :param resource_type: Resource type name. Possible values include: "standard", "dedicated", + "lowPriority", "shared", "serviceSpecific". + :type resource_type: str or ~azure_quota_extension_api.models.ResourceType + :ivar quota_period: The time period over which the quota usage values are summarized. For + example: + *P1D (per one day)*\ PT1M (per one minute) + *PT1S (per one second). + This parameter is optional because, for some resources like compute, the period is irrelevant. + :vartype quota_period: str + :ivar is_quota_applicable: States if quota can be requested for this resource. + :vartype is_quota_applicable: bool + :param properties: Additional properties for the specific resource provider. + :type properties: object + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'message': {'readonly': True}, + 'request_submit_time': {'readonly': True}, + 'current_value': {'readonly': True}, + 'quota_period': {'readonly': True}, + 'is_quota_applicable': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'message': {'key': 'properties.message', 'type': 'str'}, + 'request_submit_time': {'key': 'properties.requestSubmitTime', 'type': 'iso-8601'}, + 'limit': {'key': 'properties.limit', 'type': 'int'}, + 'current_value': {'key': 'properties.currentValue', 'type': 'int'}, + 'unit': {'key': 'properties.unit', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'ResourceName'}, + 'resource_type': {'key': 'properties.resourceType', 'type': 'str'}, + 'quota_period': {'key': 'properties.quotaPeriod', 'type': 'str'}, + 'is_quota_applicable': {'key': 'properties.isQuotaApplicable', 'type': 'bool'}, + 'properties': {'key': 'properties.properties', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(QuotaRequestOneResourceSubmitResponse, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.provisioning_state = None + self.message = None + self.request_submit_time = None + self.limit = kwargs.get('limit', None) + self.current_value = None + self.unit = kwargs.get('unit', None) + self.name_properties_name = kwargs.get('name_properties_name', None) + self.resource_type = kwargs.get('resource_type', None) + self.quota_period = None + self.is_quota_applicable = None + self.properties = kwargs.get('properties', None) + + +class QuotaRequestProperties(msrest.serialization.Model): + """Quota request properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The quota request status. Possible values include: "Accepted", + "Invalid", "Succeeded", "Failed", "InProgress". + :vartype provisioning_state: str or ~azure_quota_extension_api.models.QuotaRequestState + :ivar message: User-friendly status message. + :vartype message: str + :ivar request_submit_time: The quota request submission time. The date conforms to the + following format specified by the ISO 8601 standard: yyyy-MM-ddTHH:mm:ssZ. + :vartype request_submit_time: ~datetime.datetime + :param value: Quota request details. + :type value: list[~azure_quota_extension_api.models.SubRequest] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'message': {'readonly': True}, + 'request_submit_time': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'request_submit_time': {'key': 'requestSubmitTime', 'type': 'iso-8601'}, + 'value': {'key': 'value', 'type': '[SubRequest]'}, + } + + def __init__( + self, + **kwargs + ): + super(QuotaRequestProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.message = None + self.request_submit_time = None + self.value = kwargs.get('value', None) + + +class QuotaRequestSubmitResponse(msrest.serialization.Model): + """Quota request response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Quota request ID. + :vartype id: str + :ivar name: Quota request name. + :vartype name: str + :param properties: The quota request details. + :type properties: ~azure_quota_extension_api.models.QuotaRequestProperties + :ivar type: Resource type. "Microsoft.Quota/quotaLimits". + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'QuotaRequestProperties'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(QuotaRequestSubmitResponse, self).__init__(**kwargs) + self.id = None + self.name = None + self.properties = kwargs.get('properties', None) + self.type = None + + +class QuotaRequestSubmitResponse202(msrest.serialization.Model): + """The quota request response with the quota request ID. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The quota request ID. To check the request status, use the **id** value in a `Quota + Request Status `_ GET operation. + :vartype id: str + :ivar name: Operation ID. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar provisioning_state: Quota request status. Possible values include: "Accepted", "Invalid", + "Succeeded", "Failed", "InProgress". + :vartype provisioning_state: str or ~azure_quota_extension_api.models.QuotaRequestState + :ivar message: User-friendly message. + :vartype message: str + :param limit: Quota limit. + :type limit: int + :ivar current_value: Usage information for the current resource. + :vartype current_value: int + :param unit: The quota limit units, such as Count and Bytes. When requesting quota, use the + **unit** value returned in the GET response in the request body of your PUT operation. + :type unit: str + :param name_properties_name: Resource name provided by the resource provider. Use this property + name when requesting quota. + :type name_properties_name: ~azure_quota_extension_api.models.ResourceName + :param resource_type: Resource type name. Possible values include: "standard", "dedicated", + "lowPriority", "shared", "serviceSpecific". + :type resource_type: str or ~azure_quota_extension_api.models.ResourceType + :ivar quota_period: The time period over which the quota usage values are summarized. For + example: + *P1D (per one day)*\ PT1M (per one minute) + *PT1S (per one second). + This parameter is optional because, for some resources like compute, the period is irrelevant. + :vartype quota_period: str + :param properties: Additional properties for the specific resource provider. + :type properties: object + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'message': {'readonly': True}, + 'current_value': {'readonly': True}, + 'quota_period': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'message': {'key': 'properties.message', 'type': 'str'}, + 'limit': {'key': 'properties.limit', 'type': 'int'}, + 'current_value': {'key': 'properties.currentValue', 'type': 'int'}, + 'unit': {'key': 'properties.unit', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'ResourceName'}, + 'resource_type': {'key': 'properties.resourceType', 'type': 'str'}, + 'quota_period': {'key': 'properties.quotaPeriod', 'type': 'str'}, + 'properties': {'key': 'properties.properties', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(QuotaRequestSubmitResponse202, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.provisioning_state = None + self.message = None + self.limit = kwargs.get('limit', None) + self.current_value = None + self.unit = kwargs.get('unit', None) + self.name_properties_name = kwargs.get('name_properties_name', None) + self.resource_type = kwargs.get('resource_type', None) + self.quota_period = None + self.properties = kwargs.get('properties', None) + + +class QuotaTemplateDetails(msrest.serialization.Model): + """Quota template details. + + :param resource_type: Resource type. + :type resource_type: str + :param resource_type_properties_resource_type: Resource type. + :type resource_type_properties_resource_type: str + :param value: Quota type information. + :type value: list[~azure_quota_extension_api.models.QuotaTypeDimensionInformation] + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'resource_type_properties_resource_type': {'key': 'properties.resourceType', 'type': 'str'}, + 'value': {'key': 'properties.value', 'type': '[QuotaTypeDimensionInformation]'}, + } + + def __init__( + self, + **kwargs + ): + super(QuotaTemplateDetails, self).__init__(**kwargs) + self.resource_type = kwargs.get('resource_type', None) + self.resource_type_properties_resource_type = kwargs.get('resource_type_properties_resource_type', None) + self.value = kwargs.get('value', None) + + +class QuotaTemplatesDetails(msrest.serialization.Model): + """Quota templates details. + + :param value: Quota templates information. + :type value: list[~azure_quota_extension_api.models.QuotaTemplateDetails] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[QuotaTemplateDetails]'}, + } + + def __init__( + self, + **kwargs + ): + super(QuotaTemplatesDetails, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class QuotaTypeDimensionInformation(msrest.serialization.Model): + """Quota type information. + + :param name: Property name. + :type name: str + :param display_name: Display name. + :type display_name: str + :param id: Dimension ID. + :type id: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(QuotaTypeDimensionInformation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.id = kwargs.get('id', None) + + +class ResourceName(msrest.serialization.Model): + """Name of the resource provided by the resource Provider. When requesting quota, use this property name. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: Resource name. + :type value: str + :ivar localized_value: Resource display name. + :vartype localized_value: str + """ + + _validation = { + 'localized_value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceName, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.localized_value = None + + +class ResourceProviderDimension(msrest.serialization.Model): + """Resource provider resource dimension. + + :param name: Resource dimension name. + :type name: str + :param display_name: Display name. + :type display_name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceProviderDimension, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + + +class ResourceProviderInformation(msrest.serialization.Model): + """Resource provider information. + + :param resource_provider_name: Resource provider name. + :type resource_provider_name: str + :param value: The resource provider templates. + :type value: list[~azure_quota_extension_api.models.ResourceProviderTemplate] + """ + + _attribute_map = { + 'resource_provider_name': {'key': 'resourceProviderName', 'type': 'str'}, + 'value': {'key': 'properties.value', 'type': '[ResourceProviderTemplate]'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceProviderInformation, self).__init__(**kwargs) + self.resource_provider_name = kwargs.get('resource_provider_name', None) + self.value = kwargs.get('value', None) + + +class ResourceProvidersList(msrest.serialization.Model): + """Resource providers list. + + :param value: Resource provider information. + :type value: list[~azure_quota_extension_api.models.ResourceProviderInformation] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceProviderInformation]'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceProvidersList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class ResourceProviderTemplate(msrest.serialization.Model): + """Resource template details for the resource provider. + + :param resource_type: Resource type. + :type resource_type: str + :param resource_query: Resource query for dimension values. + :type resource_query: ~azure_quota_extension_api.models.ResourceQueryDetails + :param resource_usages_query: Resource usages query. + :type resource_usages_query: ~azure_quota_extension_api.models.ResourceQueryDetails + :param dimensions: Resource provider dimensions. + :type dimensions: list[~azure_quota_extension_api.models.ResourceProviderDimension] + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'resource_query': {'key': 'resourceQuery', 'type': 'ResourceQueryDetails'}, + 'resource_usages_query': {'key': 'resourceUsagesQuery', 'type': 'ResourceQueryDetails'}, + 'dimensions': {'key': 'dimensions', 'type': '[ResourceProviderDimension]'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceProviderTemplate, self).__init__(**kwargs) + self.resource_type = kwargs.get('resource_type', None) + self.resource_query = kwargs.get('resource_query', None) + self.resource_usages_query = kwargs.get('resource_usages_query', None) + self.dimensions = kwargs.get('dimensions', None) + + +class ResourceQueryDetails(msrest.serialization.Model): + """Resource query details. + + :param resource_query_type: Resource query type. Possible values include: "ARG", "RestAPI". + :type resource_query_type: str or ~azure_quota_extension_api.models.ResourceQueryType + :param resource_query_method: Resource query method. Possible values include: "GET", "POST". + :type resource_query_method: str or ~azure_quota_extension_api.models.ResourceQueryMethod + :param resource_query_uri: Base URI for for resource query. + :type resource_query_uri: str + :param resource_query_post_template: Template to create the resource query. + :type resource_query_post_template: str + """ + + _attribute_map = { + 'resource_query_type': {'key': 'resourceQueryType', 'type': 'str'}, + 'resource_query_method': {'key': 'resourceQueryMethod', 'type': 'str'}, + 'resource_query_uri': {'key': 'resourceQueryUri', 'type': 'str'}, + 'resource_query_post_template': {'key': 'resourceQueryPostTemplate', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceQueryDetails, self).__init__(**kwargs) + self.resource_query_type = kwargs.get('resource_query_type', None) + self.resource_query_method = kwargs.get('resource_query_method', None) + self.resource_query_uri = kwargs.get('resource_query_uri', None) + self.resource_query_post_template = kwargs.get('resource_query_post_template', None) + + +class ServiceError(msrest.serialization.Model): + """API error details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param code: Error code. + :type code: str + :param message: Error message. + :type message: str + :ivar details: List of error details. + :vartype details: list[~azure_quota_extension_api.models.ServiceErrorDetail] + """ + + _validation = { + 'details': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ServiceErrorDetail]'}, + } + + def __init__( + self, + **kwargs + ): + super(ServiceError, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.details = None + + +class ServiceErrorDetail(msrest.serialization.Model): + """Error details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Error code. + :vartype code: str + :ivar message: Error message. + :vartype message: str + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ServiceErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + + +class SubRequest(msrest.serialization.Model): + """Request property. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar limit: Resource quota limit. + :vartype limit: int + :param name: Resource name. + :type name: ~azure_quota_extension_api.models.ResourceName + :ivar resource_type: Resource type for which the quota check was made. + :vartype resource_type: str + :param unit: Quota limit units, such as Count and Bytes. When requesting quota, use the + **unit** value returned in the GET response in the request body of your PUT operation. + :type unit: str + :ivar provisioning_state: The quota request status. Possible values include: "Accepted", + "Invalid", "Succeeded", "Failed", "InProgress". + :vartype provisioning_state: str or ~azure_quota_extension_api.models.QuotaRequestState + :ivar message: User-friendly status message. + :vartype message: str + :ivar sub_request_id: Quota request ID. + :vartype sub_request_id: str + """ + + _validation = { + 'limit': {'readonly': True}, + 'resource_type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'message': {'readonly': True}, + 'sub_request_id': {'readonly': True}, + } + + _attribute_map = { + 'limit': {'key': 'limit', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'ResourceName'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'sub_request_id': {'key': 'subRequestId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SubRequest, self).__init__(**kwargs) + self.limit = None + self.name = kwargs.get('name', None) + self.resource_type = None + self.unit = kwargs.get('unit', None) + self.provisioning_state = None + self.message = None + self.sub_request_id = None diff --git a/src/quota/azext_quota/vendored_sdks/quota/models/_models_py3.py b/src/quota/azext_quota/vendored_sdks/quota/models/_models_py3.py new file mode 100644 index 00000000000..c7b16114e06 --- /dev/null +++ b/src/quota/azext_quota/vendored_sdks/quota/models/_models_py3.py @@ -0,0 +1,1116 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 typing import List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._azure_quota_extension_api_enums import * + + +class CommonResourceProperties(msrest.serialization.Model): + """Resource properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. "Microsoft.Quota/quotaLimits". + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CommonResourceProperties, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class CreateGenericQuotaRequestParameters(msrest.serialization.Model): + """Quota change requests information. + + :param value: Quota change requests. + :type value: list[~azure_quota_extension_api.models.CurrentQuotaLimitBase] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CurrentQuotaLimitBase]'}, + } + + def __init__( + self, + *, + value: Optional[List["CurrentQuotaLimitBase"]] = None, + **kwargs + ): + super(CreateGenericQuotaRequestParameters, self).__init__(**kwargs) + self.value = value + + +class CurrentQuotaLimitBase(msrest.serialization.Model): + """Quota limit. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource Id. + :vartype id: str + :ivar type: The resource type. + :vartype type: str + :ivar name: The resource name. + :vartype name: str + :param properties: Quota properties for the specified resource. + :type properties: ~azure_quota_extension_api.models.QuotaProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'QuotaProperties'}, + } + + def __init__( + self, + *, + properties: Optional["QuotaProperties"] = None, + **kwargs + ): + super(CurrentQuotaLimitBase, self).__init__(**kwargs) + self.id = None + self.type = None + self.name = None + self.properties = properties + + +class ExceptionResponse(msrest.serialization.Model): + """Error. + + :param error: API error details. + :type error: ~azure_quota_extension_api.models.ServiceError + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ServiceError'}, + } + + def __init__( + self, + *, + error: Optional["ServiceError"] = None, + **kwargs + ): + super(ExceptionResponse, self).__init__(**kwargs) + self.error = error + + +class OperationDisplay(msrest.serialization.Model): + """OperationDisplay. + + :param provider: Provider name. + :type provider: str + :param resource: Resource name. + :type resource: str + :param operation: Operation name. + :type operation: str + :param description: Operation description. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationList(msrest.serialization.Model): + """OperationList. + + :param value: + :type value: list[~azure_quota_extension_api.models.OperationResponse] + :param next_link: URL to get the next page of items. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OperationResponse]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["OperationResponse"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(OperationList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class OperationResponse(msrest.serialization.Model): + """OperationResponse. + + :param name: + :type name: str + :param display: + :type display: ~azure_quota_extension_api.models.OperationDisplay + :param origin: + :type origin: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["OperationDisplay"] = None, + origin: Optional[str] = None, + **kwargs + ): + super(OperationResponse, self).__init__(**kwargs) + self.name = name + self.display = display + self.origin = origin + + +class QuotaBucketProperties(msrest.serialization.Model): + """quotaBucket provider properties. + + :param name: Property name. + :type name: str + :param display_name: Display name. + :type display_name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + **kwargs + ): + super(QuotaBucketProperties, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + + +class QuotaLimits(msrest.serialization.Model): + """Quota limits. + + :param value: List of quota limits. + :type value: list[~azure_quota_extension_api.models.CurrentQuotaLimitBase] + :param next_link: The URI used to fetch the next page of quota limits. When there are no more + pages, this is null. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CurrentQuotaLimitBase]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["CurrentQuotaLimitBase"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(QuotaLimits, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class QuotaLimitsResponse(msrest.serialization.Model): + """Quota limits request response. + + :param value: List of quota limits with the quota request status. + :type value: list[~azure_quota_extension_api.models.CurrentQuotaLimitBase] + :param next_link: The URI used to fetch the next page of quota limits. When there are no more + pages, this is null. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CurrentQuotaLimitBase]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["CurrentQuotaLimitBase"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(QuotaLimitsResponse, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class QuotaProperties(msrest.serialization.Model): + """Quota properties for the specified resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param limit: Quota limit. + :type limit: int + :ivar current_value: Usage information for the current resource. + :vartype current_value: int + :ivar unit: The quota limit units, such as Count and Bytes. When requesting quota, use the + **unit** value returned in the GET response in the request body of your PUT operation. + :vartype unit: str + :param name: Resource name provided by the resource provider. Use this property name when + requesting quota. + :type name: ~azure_quota_extension_api.models.ResourceName + :param resource_type: Resource type name. Possible values include: "standard", "dedicated", + "lowPriority", "shared", "serviceSpecific". + :type resource_type: str or ~azure_quota_extension_api.models.ResourceType + :ivar quota_period: The time period over which the quota usage values are summarized. For + example: + *P1D (per one day)*\ PT1M (per one minute) + *PT1S (per one second). + This parameter is optional because, for some resources like compute, the period is irrelevant. + :vartype quota_period: str + :ivar is_quota_applicable: States if quota can be requested for this resource. + :vartype is_quota_applicable: bool + :param properties: Additional properties for the specific resource provider. + :type properties: object + """ + + _validation = { + 'current_value': {'readonly': True}, + 'unit': {'readonly': True}, + 'quota_period': {'readonly': True}, + 'is_quota_applicable': {'readonly': True}, + } + + _attribute_map = { + 'limit': {'key': 'limit', 'type': 'int'}, + 'current_value': {'key': 'currentValue', 'type': 'int'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'ResourceName'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'quota_period': {'key': 'quotaPeriod', 'type': 'str'}, + 'is_quota_applicable': {'key': 'isQuotaApplicable', 'type': 'bool'}, + 'properties': {'key': 'properties', 'type': 'object'}, + } + + def __init__( + self, + *, + limit: Optional[int] = None, + name: Optional["ResourceName"] = None, + resource_type: Optional[Union[str, "ResourceType"]] = None, + properties: Optional[object] = None, + **kwargs + ): + super(QuotaProperties, self).__init__(**kwargs) + self.limit = limit + self.current_value = None + self.unit = None + self.name = name + self.resource_type = resource_type + self.quota_period = None + self.is_quota_applicable = None + self.properties = properties + + +class QuotaRequestDetails(msrest.serialization.Model): + """List of quota requests with details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Quota request ID. + :vartype id: str + :ivar name: Quota request name. + :vartype name: str + :ivar type: Resource type. "Microsoft.Quota/quotaLimits". + :vartype type: str + :ivar provisioning_state: The quota request status. Possible values include: "Accepted", + "Invalid", "Succeeded", "Failed", "InProgress". + :vartype provisioning_state: str or ~azure_quota_extension_api.models.QuotaRequestState + :ivar message: User-friendly status message. + :vartype message: str + :ivar request_submit_time: The quota request submission time. The date conforms to the + following format specified by the ISO 8601 standard: yyyy-MM-ddTHH:mm:ssZ. + :vartype request_submit_time: ~datetime.datetime + :param value: Quota request details. + :type value: list[~azure_quota_extension_api.models.SubRequest] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'message': {'readonly': True}, + 'request_submit_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'message': {'key': 'properties.message', 'type': 'str'}, + 'request_submit_time': {'key': 'properties.requestSubmitTime', 'type': 'iso-8601'}, + 'value': {'key': 'properties.value', 'type': '[SubRequest]'}, + } + + def __init__( + self, + *, + value: Optional[List["SubRequest"]] = None, + **kwargs + ): + super(QuotaRequestDetails, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.provisioning_state = None + self.message = None + self.request_submit_time = None + self.value = value + + +class QuotaRequestDetailsList(msrest.serialization.Model): + """Quota request information. + + :param value: Quota request details. + :type value: list[~azure_quota_extension_api.models.QuotaRequestDetails] + :param next_link: The URI for fetching the next page of quota limits. When there are no more + pages, this is null. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[QuotaRequestDetails]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["QuotaRequestDetails"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(QuotaRequestDetailsList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class QuotaRequestOneResourceSubmitResponse(msrest.serialization.Model): + """Quota request response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Quota request ID. + :vartype id: str + :ivar name: The name of the quota request. + :vartype name: str + :ivar type: Resource type. "Microsoft.Quota/ServiceLimitRequests". + :vartype type: str + :ivar provisioning_state: Quota request status. Possible values include: "Accepted", "Invalid", + "Succeeded", "Failed", "InProgress". + :vartype provisioning_state: str or ~azure_quota_extension_api.models.QuotaRequestState + :ivar message: User-friendly status message. + :vartype message: str + :ivar request_submit_time: Quota request submission time. The date conforms to the following + ISO 8601 standard format: yyyy-MM-ddTHH:mm:ssZ. + :vartype request_submit_time: ~datetime.datetime + :param limit: Quota limit. + :type limit: int + :ivar current_value: Usage information for the current resource. + :vartype current_value: int + :param unit: The quota limit units, such as Count and Bytes. When requesting quota, use the + **unit** value returned in the GET response in the request body of your PUT operation. + :type unit: str + :param name_properties_name: Resource name provided by the resource provider. Use this property + name when requesting quota. + :type name_properties_name: ~azure_quota_extension_api.models.ResourceName + :param resource_type: Resource type name. Possible values include: "standard", "dedicated", + "lowPriority", "shared", "serviceSpecific". + :type resource_type: str or ~azure_quota_extension_api.models.ResourceType + :ivar quota_period: The time period over which the quota usage values are summarized. For + example: + *P1D (per one day)*\ PT1M (per one minute) + *PT1S (per one second). + This parameter is optional because, for some resources like compute, the period is irrelevant. + :vartype quota_period: str + :ivar is_quota_applicable: States if quota can be requested for this resource. + :vartype is_quota_applicable: bool + :param properties: Additional properties for the specific resource provider. + :type properties: object + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'message': {'readonly': True}, + 'request_submit_time': {'readonly': True}, + 'current_value': {'readonly': True}, + 'quota_period': {'readonly': True}, + 'is_quota_applicable': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'message': {'key': 'properties.message', 'type': 'str'}, + 'request_submit_time': {'key': 'properties.requestSubmitTime', 'type': 'iso-8601'}, + 'limit': {'key': 'properties.limit', 'type': 'int'}, + 'current_value': {'key': 'properties.currentValue', 'type': 'int'}, + 'unit': {'key': 'properties.unit', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'ResourceName'}, + 'resource_type': {'key': 'properties.resourceType', 'type': 'str'}, + 'quota_period': {'key': 'properties.quotaPeriod', 'type': 'str'}, + 'is_quota_applicable': {'key': 'properties.isQuotaApplicable', 'type': 'bool'}, + 'properties': {'key': 'properties.properties', 'type': 'object'}, + } + + def __init__( + self, + *, + limit: Optional[int] = None, + unit: Optional[str] = None, + name_properties_name: Optional["ResourceName"] = None, + resource_type: Optional[Union[str, "ResourceType"]] = None, + properties: Optional[object] = None, + **kwargs + ): + super(QuotaRequestOneResourceSubmitResponse, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.provisioning_state = None + self.message = None + self.request_submit_time = None + self.limit = limit + self.current_value = None + self.unit = unit + self.name_properties_name = name_properties_name + self.resource_type = resource_type + self.quota_period = None + self.is_quota_applicable = None + self.properties = properties + + +class QuotaRequestProperties(msrest.serialization.Model): + """Quota request properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The quota request status. Possible values include: "Accepted", + "Invalid", "Succeeded", "Failed", "InProgress". + :vartype provisioning_state: str or ~azure_quota_extension_api.models.QuotaRequestState + :ivar message: User-friendly status message. + :vartype message: str + :ivar request_submit_time: The quota request submission time. The date conforms to the + following format specified by the ISO 8601 standard: yyyy-MM-ddTHH:mm:ssZ. + :vartype request_submit_time: ~datetime.datetime + :param value: Quota request details. + :type value: list[~azure_quota_extension_api.models.SubRequest] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'message': {'readonly': True}, + 'request_submit_time': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'request_submit_time': {'key': 'requestSubmitTime', 'type': 'iso-8601'}, + 'value': {'key': 'value', 'type': '[SubRequest]'}, + } + + def __init__( + self, + *, + value: Optional[List["SubRequest"]] = None, + **kwargs + ): + super(QuotaRequestProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.message = None + self.request_submit_time = None + self.value = value + + +class QuotaRequestSubmitResponse(msrest.serialization.Model): + """Quota request response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Quota request ID. + :vartype id: str + :ivar name: Quota request name. + :vartype name: str + :param properties: The quota request details. + :type properties: ~azure_quota_extension_api.models.QuotaRequestProperties + :ivar type: Resource type. "Microsoft.Quota/quotaLimits". + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'QuotaRequestProperties'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + properties: Optional["QuotaRequestProperties"] = None, + **kwargs + ): + super(QuotaRequestSubmitResponse, self).__init__(**kwargs) + self.id = None + self.name = None + self.properties = properties + self.type = None + + +class QuotaRequestSubmitResponse202(msrest.serialization.Model): + """The quota request response with the quota request ID. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The quota request ID. To check the request status, use the **id** value in a `Quota + Request Status `_ GET operation. + :vartype id: str + :ivar name: Operation ID. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar provisioning_state: Quota request status. Possible values include: "Accepted", "Invalid", + "Succeeded", "Failed", "InProgress". + :vartype provisioning_state: str or ~azure_quota_extension_api.models.QuotaRequestState + :ivar message: User-friendly message. + :vartype message: str + :param limit: Quota limit. + :type limit: int + :ivar current_value: Usage information for the current resource. + :vartype current_value: int + :param unit: The quota limit units, such as Count and Bytes. When requesting quota, use the + **unit** value returned in the GET response in the request body of your PUT operation. + :type unit: str + :param name_properties_name: Resource name provided by the resource provider. Use this property + name when requesting quota. + :type name_properties_name: ~azure_quota_extension_api.models.ResourceName + :param resource_type: Resource type name. Possible values include: "standard", "dedicated", + "lowPriority", "shared", "serviceSpecific". + :type resource_type: str or ~azure_quota_extension_api.models.ResourceType + :ivar quota_period: The time period over which the quota usage values are summarized. For + example: + *P1D (per one day)*\ PT1M (per one minute) + *PT1S (per one second). + This parameter is optional because, for some resources like compute, the period is irrelevant. + :vartype quota_period: str + :param properties: Additional properties for the specific resource provider. + :type properties: object + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'message': {'readonly': True}, + 'current_value': {'readonly': True}, + 'quota_period': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'message': {'key': 'properties.message', 'type': 'str'}, + 'limit': {'key': 'properties.limit', 'type': 'int'}, + 'current_value': {'key': 'properties.currentValue', 'type': 'int'}, + 'unit': {'key': 'properties.unit', 'type': 'str'}, + 'name_properties_name': {'key': 'properties.name', 'type': 'ResourceName'}, + 'resource_type': {'key': 'properties.resourceType', 'type': 'str'}, + 'quota_period': {'key': 'properties.quotaPeriod', 'type': 'str'}, + 'properties': {'key': 'properties.properties', 'type': 'object'}, + } + + def __init__( + self, + *, + limit: Optional[int] = None, + unit: Optional[str] = None, + name_properties_name: Optional["ResourceName"] = None, + resource_type: Optional[Union[str, "ResourceType"]] = None, + properties: Optional[object] = None, + **kwargs + ): + super(QuotaRequestSubmitResponse202, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.provisioning_state = None + self.message = None + self.limit = limit + self.current_value = None + self.unit = unit + self.name_properties_name = name_properties_name + self.resource_type = resource_type + self.quota_period = None + self.properties = properties + + +class QuotaTemplateDetails(msrest.serialization.Model): + """Quota template details. + + :param resource_type: Resource type. + :type resource_type: str + :param resource_type_properties_resource_type: Resource type. + :type resource_type_properties_resource_type: str + :param value: Quota type information. + :type value: list[~azure_quota_extension_api.models.QuotaTypeDimensionInformation] + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'resource_type_properties_resource_type': {'key': 'properties.resourceType', 'type': 'str'}, + 'value': {'key': 'properties.value', 'type': '[QuotaTypeDimensionInformation]'}, + } + + def __init__( + self, + *, + resource_type: Optional[str] = None, + resource_type_properties_resource_type: Optional[str] = None, + value: Optional[List["QuotaTypeDimensionInformation"]] = None, + **kwargs + ): + super(QuotaTemplateDetails, self).__init__(**kwargs) + self.resource_type = resource_type + self.resource_type_properties_resource_type = resource_type_properties_resource_type + self.value = value + + +class QuotaTemplatesDetails(msrest.serialization.Model): + """Quota templates details. + + :param value: Quota templates information. + :type value: list[~azure_quota_extension_api.models.QuotaTemplateDetails] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[QuotaTemplateDetails]'}, + } + + def __init__( + self, + *, + value: Optional[List["QuotaTemplateDetails"]] = None, + **kwargs + ): + super(QuotaTemplatesDetails, self).__init__(**kwargs) + self.value = value + + +class QuotaTypeDimensionInformation(msrest.serialization.Model): + """Quota type information. + + :param name: Property name. + :type name: str + :param display_name: Display name. + :type display_name: str + :param id: Dimension ID. + :type id: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + id: Optional[str] = None, + **kwargs + ): + super(QuotaTypeDimensionInformation, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.id = id + + +class ResourceName(msrest.serialization.Model): + """Name of the resource provided by the resource Provider. When requesting quota, use this property name. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: Resource name. + :type value: str + :ivar localized_value: Resource display name. + :vartype localized_value: str + """ + + _validation = { + 'localized_value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[str] = None, + **kwargs + ): + super(ResourceName, self).__init__(**kwargs) + self.value = value + self.localized_value = None + + +class ResourceProviderDimension(msrest.serialization.Model): + """Resource provider resource dimension. + + :param name: Resource dimension name. + :type name: str + :param display_name: Display name. + :type display_name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + **kwargs + ): + super(ResourceProviderDimension, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + + +class ResourceProviderInformation(msrest.serialization.Model): + """Resource provider information. + + :param resource_provider_name: Resource provider name. + :type resource_provider_name: str + :param value: The resource provider templates. + :type value: list[~azure_quota_extension_api.models.ResourceProviderTemplate] + """ + + _attribute_map = { + 'resource_provider_name': {'key': 'resourceProviderName', 'type': 'str'}, + 'value': {'key': 'properties.value', 'type': '[ResourceProviderTemplate]'}, + } + + def __init__( + self, + *, + resource_provider_name: Optional[str] = None, + value: Optional[List["ResourceProviderTemplate"]] = None, + **kwargs + ): + super(ResourceProviderInformation, self).__init__(**kwargs) + self.resource_provider_name = resource_provider_name + self.value = value + + +class ResourceProvidersList(msrest.serialization.Model): + """Resource providers list. + + :param value: Resource provider information. + :type value: list[~azure_quota_extension_api.models.ResourceProviderInformation] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceProviderInformation]'}, + } + + def __init__( + self, + *, + value: Optional[List["ResourceProviderInformation"]] = None, + **kwargs + ): + super(ResourceProvidersList, self).__init__(**kwargs) + self.value = value + + +class ResourceProviderTemplate(msrest.serialization.Model): + """Resource template details for the resource provider. + + :param resource_type: Resource type. + :type resource_type: str + :param resource_query: Resource query for dimension values. + :type resource_query: ~azure_quota_extension_api.models.ResourceQueryDetails + :param resource_usages_query: Resource usages query. + :type resource_usages_query: ~azure_quota_extension_api.models.ResourceQueryDetails + :param dimensions: Resource provider dimensions. + :type dimensions: list[~azure_quota_extension_api.models.ResourceProviderDimension] + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'resource_query': {'key': 'resourceQuery', 'type': 'ResourceQueryDetails'}, + 'resource_usages_query': {'key': 'resourceUsagesQuery', 'type': 'ResourceQueryDetails'}, + 'dimensions': {'key': 'dimensions', 'type': '[ResourceProviderDimension]'}, + } + + def __init__( + self, + *, + resource_type: Optional[str] = None, + resource_query: Optional["ResourceQueryDetails"] = None, + resource_usages_query: Optional["ResourceQueryDetails"] = None, + dimensions: Optional[List["ResourceProviderDimension"]] = None, + **kwargs + ): + super(ResourceProviderTemplate, self).__init__(**kwargs) + self.resource_type = resource_type + self.resource_query = resource_query + self.resource_usages_query = resource_usages_query + self.dimensions = dimensions + + +class ResourceQueryDetails(msrest.serialization.Model): + """Resource query details. + + :param resource_query_type: Resource query type. Possible values include: "ARG", "RestAPI". + :type resource_query_type: str or ~azure_quota_extension_api.models.ResourceQueryType + :param resource_query_method: Resource query method. Possible values include: "GET", "POST". + :type resource_query_method: str or ~azure_quota_extension_api.models.ResourceQueryMethod + :param resource_query_uri: Base URI for for resource query. + :type resource_query_uri: str + :param resource_query_post_template: Template to create the resource query. + :type resource_query_post_template: str + """ + + _attribute_map = { + 'resource_query_type': {'key': 'resourceQueryType', 'type': 'str'}, + 'resource_query_method': {'key': 'resourceQueryMethod', 'type': 'str'}, + 'resource_query_uri': {'key': 'resourceQueryUri', 'type': 'str'}, + 'resource_query_post_template': {'key': 'resourceQueryPostTemplate', 'type': 'str'}, + } + + def __init__( + self, + *, + resource_query_type: Optional[Union[str, "ResourceQueryType"]] = None, + resource_query_method: Optional[Union[str, "ResourceQueryMethod"]] = None, + resource_query_uri: Optional[str] = None, + resource_query_post_template: Optional[str] = None, + **kwargs + ): + super(ResourceQueryDetails, self).__init__(**kwargs) + self.resource_query_type = resource_query_type + self.resource_query_method = resource_query_method + self.resource_query_uri = resource_query_uri + self.resource_query_post_template = resource_query_post_template + + +class ServiceError(msrest.serialization.Model): + """API error details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param code: Error code. + :type code: str + :param message: Error message. + :type message: str + :ivar details: List of error details. + :vartype details: list[~azure_quota_extension_api.models.ServiceErrorDetail] + """ + + _validation = { + 'details': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ServiceErrorDetail]'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + super(ServiceError, self).__init__(**kwargs) + self.code = code + self.message = message + self.details = None + + +class ServiceErrorDetail(msrest.serialization.Model): + """Error details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Error code. + :vartype code: str + :ivar message: Error message. + :vartype message: str + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ServiceErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + + +class SubRequest(msrest.serialization.Model): + """Request property. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar limit: Resource quota limit. + :vartype limit: int + :param name: Resource name. + :type name: ~azure_quota_extension_api.models.ResourceName + :ivar resource_type: Resource type for which the quota check was made. + :vartype resource_type: str + :param unit: Quota limit units, such as Count and Bytes. When requesting quota, use the + **unit** value returned in the GET response in the request body of your PUT operation. + :type unit: str + :ivar provisioning_state: The quota request status. Possible values include: "Accepted", + "Invalid", "Succeeded", "Failed", "InProgress". + :vartype provisioning_state: str or ~azure_quota_extension_api.models.QuotaRequestState + :ivar message: User-friendly status message. + :vartype message: str + :ivar sub_request_id: Quota request ID. + :vartype sub_request_id: str + """ + + _validation = { + 'limit': {'readonly': True}, + 'resource_type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'message': {'readonly': True}, + 'sub_request_id': {'readonly': True}, + } + + _attribute_map = { + 'limit': {'key': 'limit', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'ResourceName'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'sub_request_id': {'key': 'subRequestId', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional["ResourceName"] = None, + unit: Optional[str] = None, + **kwargs + ): + super(SubRequest, self).__init__(**kwargs) + self.limit = None + self.name = name + self.resource_type = None + self.unit = unit + self.provisioning_state = None + self.message = None + self.sub_request_id = None diff --git a/src/quota/azext_quota/vendored_sdks/quota/operations/__init__.py b/src/quota/azext_quota/vendored_sdks/quota/operations/__init__.py new file mode 100644 index 00000000000..f398425a8eb --- /dev/null +++ b/src/quota/azext_quota/vendored_sdks/quota/operations/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 ._quota_operations import QuotaOperations +from ._quota_request_status_operations import QuotaRequestStatusOperations +from ._quota_resource_providers_operations import QuotaResourceProvidersOperations +from ._operation_operations import OperationOperations + +__all__ = [ + 'QuotaOperations', + 'QuotaRequestStatusOperations', + 'QuotaResourceProvidersOperations', + 'OperationOperations', +] diff --git a/src/quota/azext_quota/vendored_sdks/quota/operations/_operation_operations.py b/src/quota/azext_quota/vendored_sdks/quota/operations/_operation_operations.py new file mode 100644 index 00000000000..cdd833d24f1 --- /dev/null +++ b/src/quota/azext_quota/vendored_sdks/quota/operations/_operation_operations.py @@ -0,0 +1,112 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class OperationOperations(object): + """OperationOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure_quota_extension_api.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.OperationList"] + """GET operations. + + List all GET operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure_quota_extension_api.models.OperationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-15-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ExceptionResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Quota/operations'} # type: ignore diff --git a/src/quota/azext_quota/vendored_sdks/quota/operations/_quota_operations.py b/src/quota/azext_quota/vendored_sdks/quota/operations/_quota_operations.py new file mode 100644 index 00000000000..07b116024fe --- /dev/null +++ b/src/quota/azext_quota/vendored_sdks/quota/operations/_quota_operations.py @@ -0,0 +1,484 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class QuotaOperations(object): + """QuotaOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure_quota_extension_api.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_name, # type: str + scope, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CurrentQuotaLimitBase" + """Gets the quota limit and current quota usage of a resource. The response can be used to + determine the remaining quota and calculate a new quota limit that can be submitted with a PUT + request. + + :param resource_name: Resource name for a given resource provider. For example: + + + * SKU name for Microsoft.Compute + * Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices. + :type resource_name: str + :param scope: The target Azure resource URI. For example, + ``/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms- + test/providers/Microsoft.Batch/batchAccounts/testAccount/``. This is the target Azure resource + URI for the List GET operation. If a ``{resourceName}`` is added after ``/quotaLimits``\ , then + it's the target Azure resource URI in the GET operation for the specific resource. + :type scope: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CurrentQuotaLimitBase, or the result of cls(response) + :rtype: ~azure_quota_extension_api.models.CurrentQuotaLimitBase + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CurrentQuotaLimitBase"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-15-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ExceptionResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) + deserialized = self._deserialize('CurrentQuotaLimitBase', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.Quota/quotaLimits/{resourceName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_name, # type: str + scope, # type: str + create_quota_request, # type: "models.CurrentQuotaLimitBase" + **kwargs # type: Any + ): + # type: (...) -> "models.CurrentQuotaLimitBase" + cls = kwargs.pop('cls', None) # type: ClsType["models.CurrentQuotaLimitBase"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-15-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(create_quota_request, 'CurrentQuotaLimitBase') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ExceptionResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CurrentQuotaLimitBase', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('CurrentQuotaLimitBase', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/{scope}/providers/Microsoft.Quota/quotaLimits/{resourceName}'} # type: ignore + + def begin_create_or_update( + self, + resource_name, # type: str + scope, # type: str + create_quota_request, # type: "models.CurrentQuotaLimitBase" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.CurrentQuotaLimitBase"] + """Create or update the quota limit for the specified resource to the requested value. To update + the quota, follow these steps: + + + #. Use the GET operation to determine how much quota remains for the specific resource and to + calculate the new quota limit. These steps are detailed in `this example + `_. + #. Use this PUT operation to update the quota limit. + + :param resource_name: Resource name for a given resource provider. For example: + + + * SKU name for Microsoft.Compute + * Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices. + :type resource_name: str + :param scope: The target Azure resource URI. For example, + ``/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms- + test/providers/Microsoft.Batch/batchAccounts/testAccount/``. This is the target Azure resource + URI for the List GET operation. If a ``{resourceName}`` is added after ``/quotaLimits``\ , then + it's the target Azure resource URI in the GET operation for the specific resource. + :type scope: str + :param create_quota_request: Quota requests payload. + :type create_quota_request: ~azure_quota_extension_api.models.CurrentQuotaLimitBase + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either CurrentQuotaLimitBase or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure_quota_extension_api.models.CurrentQuotaLimitBase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.CurrentQuotaLimitBase"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_name=resource_name, + scope=scope, + create_quota_request=create_quota_request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('CurrentQuotaLimitBase', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/{scope}/providers/Microsoft.Quota/quotaLimits/{resourceName}'} # type: ignore + + def _update_initial( + self, + resource_name, # type: str + scope, # type: str + create_quota_request, # type: "models.CurrentQuotaLimitBase" + **kwargs # type: Any + ): + # type: (...) -> "models.CurrentQuotaLimitBase" + cls = kwargs.pop('cls', None) # type: ClsType["models.CurrentQuotaLimitBase"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-15-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(create_quota_request, 'CurrentQuotaLimitBase') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ExceptionResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CurrentQuotaLimitBase', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('CurrentQuotaLimitBase', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/{scope}/providers/Microsoft.Quota/quotaLimits/{resourceName}'} # type: ignore + + def begin_update( + self, + resource_name, # type: str + scope, # type: str + create_quota_request, # type: "models.CurrentQuotaLimitBase" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.CurrentQuotaLimitBase"] + """Update the quota limit for a specific resource to the specified value: + + + #. Use the GET operation to determine how much quota remains for the specific resource and to + calculate the new quota limit. These steps are detailed in `this example + `_. + #. Use this PUT operation to update the quota limit. + + :param resource_name: Resource name for a given resource provider. For example: + + + * SKU name for Microsoft.Compute + * Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices. + :type resource_name: str + :param scope: The target Azure resource URI. For example, + ``/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms- + test/providers/Microsoft.Batch/batchAccounts/testAccount/``. This is the target Azure resource + URI for the List GET operation. If a ``{resourceName}`` is added after ``/quotaLimits``\ , then + it's the target Azure resource URI in the GET operation for the specific resource. + :type scope: str + :param create_quota_request: Quota requests payload. + :type create_quota_request: ~azure_quota_extension_api.models.CurrentQuotaLimitBase + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either CurrentQuotaLimitBase or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure_quota_extension_api.models.CurrentQuotaLimitBase] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.CurrentQuotaLimitBase"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_name=resource_name, + scope=scope, + create_quota_request=create_quota_request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('CurrentQuotaLimitBase', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/{scope}/providers/Microsoft.Quota/quotaLimits/{resourceName}'} # type: ignore + + def list( + self, + scope, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.QuotaLimits"] + """Get a list of current quota limits and usages of all resources. The response from this GET + operation can be leveraged to submit requests to update a quota. + + :param scope: The target Azure resource URI. For example, + ``/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms- + test/providers/Microsoft.Batch/batchAccounts/testAccount/``. This is the target Azure resource + URI for the List GET operation. If a ``{resourceName}`` is added after ``/quotaLimits``\ , then + it's the target Azure resource URI in the GET operation for the specific resource. + :type scope: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either QuotaLimits or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure_quota_extension_api.models.QuotaLimits] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.QuotaLimits"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-15-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('QuotaLimits', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ExceptionResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/{scope}/providers/Microsoft.Quota/quotaLimits'} # type: ignore diff --git a/src/quota/azext_quota/vendored_sdks/quota/operations/_quota_request_status_operations.py b/src/quota/azext_quota/vendored_sdks/quota/operations/_quota_request_status_operations.py new file mode 100644 index 00000000000..84edc2eff4b --- /dev/null +++ b/src/quota/azext_quota/vendored_sdks/quota/operations/_quota_request_status_operations.py @@ -0,0 +1,216 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class QuotaRequestStatusOperations(object): + """QuotaRequestStatusOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure_quota_extension_api.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + id, # type: str + scope, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.QuotaRequestDetails" + """Gets the quota request details and status by quota request ID for the resources of the resource + provider at a specific location. The quota request ID **id** is returned in the response of the + PUT operation. + + :param id: Quota request ID. + :type id: str + :param scope: The target Azure resource URI. For example, + ``/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms- + test/providers/Microsoft.Batch/batchAccounts/testAccount/``. This is the target Azure resource + URI for the List GET operation. If a ``{resourceName}`` is added after ``/quotaLimits``\ , then + it's the target Azure resource URI in the GET operation for the specific resource. + :type scope: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: QuotaRequestDetails, or the result of cls(response) + :rtype: ~azure_quota_extension_api.models.QuotaRequestDetails + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.QuotaRequestDetails"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-15-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'id': self._serialize.url("id", id, 'str'), + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ExceptionResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('QuotaRequestDetails', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.Quota/quotaLimitsRequests/{id}'} # type: ignore + + def list( + self, + scope, # type: str + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + skiptoken=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.QuotaRequestDetailsList"] + """For the specified location and resource provider, gets the current quota requests under the + subscription for a one year period ending at the time is made. Use the **oData** filter can be + used to select quota requests. + + :param scope: The target Azure resource URI. For example, + ``/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms- + test/providers/Microsoft.Batch/batchAccounts/testAccount/``. This is the target Azure resource + URI for the List GET operation. If a ``{resourceName}`` is added after ``/quotaLimits``\ , then + it's the target Azure resource URI in the GET operation for the specific resource. + :type scope: str + :param filter: .. list-table:: + :header-rows: 1 + + * - Field + - Supported operators + * - + + + |requestSubmitTime | ge, le, eq, gt, lt + |provisioningState eq {QuotaRequestState} + |resourceName eq {resourceName}. + :type filter: str + :param top: Number of records to return. + :type top: int + :param skiptoken: The **Skiptoken** parameter is used only if a previous operation returned a + partial result. If a previous response contains a **nextLink** element, the value of the + **nextLink** element includes a **skiptoken** parameter that specifies a starting point to use + for subsequent calls. + :type skiptoken: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either QuotaRequestDetailsList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure_quota_extension_api.models.QuotaRequestDetailsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.QuotaRequestDetailsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-15-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int', minimum=1) + if skiptoken is not None: + query_parameters['$skiptoken'] = self._serialize.query("skiptoken", skiptoken, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('QuotaRequestDetailsList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ExceptionResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/{scope}/providers/Microsoft.Quota/quotaLimitsRequests'} # type: ignore diff --git a/src/quota/azext_quota/vendored_sdks/quota/operations/_quota_resource_providers_operations.py b/src/quota/azext_quota/vendored_sdks/quota/operations/_quota_resource_providers_operations.py new file mode 100644 index 00000000000..2ecea0ad0d1 --- /dev/null +++ b/src/quota/azext_quota/vendored_sdks/quota/operations/_quota_resource_providers_operations.py @@ -0,0 +1,102 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class QuotaResourceProvidersOperations(object): + """QuotaResourceProvidersOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure_quota_extension_api.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> "models.ResourceProvidersList" + """Gets the list of current resource providers supported by the Microsoft.Quota resource provider. + For each resource provider, the resource templates the resource provider supports are be + provided. + For each resource template, the resource dimensions are listed. The resource dimensions are the + name-value pairs in the resource URI. + Example: Microsoft.Compute Resource Provider + The URI template is + '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{locationId}/quotaBucket'. + The actual dimensions vary depending on the resource provider. + The resource dimensions are {subscriptions},{locations},{quotaBucket}. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceProvidersList, or the result of cls(response) + :rtype: ~azure_quota_extension_api.models.ResourceProvidersList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceProvidersList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-15-preview" + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ExceptionResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceProvidersList', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Quota/quotaLimitProviders'} # type: ignore diff --git a/src/quota/azext_quota/vendored_sdks/quota/py.typed b/src/quota/azext_quota/vendored_sdks/quota/py.typed new file mode 100644 index 00000000000..e5aff4f83af --- /dev/null +++ b/src/quota/azext_quota/vendored_sdks/quota/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/src/quota/report.md b/src/quota/report.md new file mode 100644 index 00000000000..affd4ce3e38 --- /dev/null +++ b/src/quota/report.md @@ -0,0 +1,202 @@ +# Azure CLI Module Creation Report + +## EXTENSION +|CLI Extension|Command Groups| +|---------|------------| +|az quota|[groups](#CommandGroups) + +## GROUPS +### Command groups in `az quota` extension +|CLI Command Group|Group Swagger name|Commands| +|---------|------------|--------| +|az quota|Quota|[commands](#CommandsInQuota)| +|az quota quota-request-status|QuotaRequestStatus|[commands](#CommandsInQuotaRequestStatus)| +|az quota quota-resource-provider|QuotaResourceProviders|[commands](#CommandsInQuotaResourceProviders)| +|az quota operation|Operation|[commands](#CommandsInOperation)| + +## COMMANDS +### Commands in `az quota` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az quota list](#QuotaList)|List|[Parameters](#ParametersQuotaList)|[Example](#ExamplesQuotaList)| +|[az quota show](#QuotaGet)|Get|[Parameters](#ParametersQuotaGet)|[Example](#ExamplesQuotaGet)| +|[az quota create](#QuotaCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersQuotaCreateOrUpdate#Create)|[Example](#ExamplesQuotaCreateOrUpdate#Create)| +|[az quota update](#QuotaUpdate)|Update|[Parameters](#ParametersQuotaUpdate)|[Example](#ExamplesQuotaUpdate)| + +### Commands in `az quota operation` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az quota operation list](#OperationList)|List|[Parameters](#ParametersOperationList)|[Example](#ExamplesOperationList)| + +### Commands in `az quota quota-request-status` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az quota quota-request-status list](#QuotaRequestStatusList)|List|[Parameters](#ParametersQuotaRequestStatusList)|[Example](#ExamplesQuotaRequestStatusList)| +|[az quota quota-request-status show](#QuotaRequestStatusGet)|Get|[Parameters](#ParametersQuotaRequestStatusGet)|[Example](#ExamplesQuotaRequestStatusGet)| + +### Commands in `az quota quota-resource-provider` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az quota quota-resource-provider list](#QuotaResourceProvidersList)|List|[Parameters](#ParametersQuotaResourceProvidersList)|[Example](#ExamplesQuotaResourceProvidersList)| + + +## COMMAND DETAILS + +### group `az quota` +#### Command `az quota list` + +##### Example +``` +az quota list --scope "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/eastus" +``` +##### Example +``` +az quota list --scope "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/eastus" +``` +##### Example +``` +az quota list --scope "subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.MachineLearningServices/l\ +ocations/eastus" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--scope**|string|The target Azure resource URI. For example, `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. This is the target Azure resource URI for the List GET operation. If a `{resourceName}` is added after `/quotaLimits`, then it's the target Azure resource URI in the GET operation for the specific resource.|scope|scope| + +#### Command `az quota show` + +##### Example +``` +az quota show --resource-name "standardNDSFamily" --scope "subscriptions/00000000-0000-0000-0000-000000000000/providers\ +/Microsoft.Compute/locations/eastus" +``` +##### Example +``` +az quota show --resource-name "MinPublicIpInterNetworkPrefixLength" --scope "subscriptions/00000000-0000-0000-0000-0000\ +00000000/providers/Microsoft.Network/locations/eastus" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-name**|string|Resource name for a given resource provider. For example: - SKU name for Microsoft.Compute - Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices|resource_name|resourceName| +|**--scope**|string|The target Azure resource URI. For example, `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. This is the target Azure resource URI for the List GET operation. If a `{resourceName}` is added after `/quotaLimits`, then it's the target Azure resource URI in the GET operation for the specific resource.|scope|scope| + +#### Command `az quota create` + +##### Example +``` +az quota create --properties "{\\"name\\":{\\"value\\":\\"standardFSv2Family\\"},\\"limit\\":200}" --resource-name \ +"standardFSv2Family" --scope "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Compute/locations/\ +eastus" +``` +##### Example +``` +az quota create --properties "{\\"name\\":{\\"value\\":\\"standardFSv2Family\\"},\\"limit\\":200}" --resource-name \ +"standardFSv2Family" --scope "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Compute/locations/\ +eastus" +``` +##### Example +``` +az quota create --properties "{\\"name\\":{\\"value\\":\\"TotalLowPriorityCores\\"},\\"limit\\":200,\\"resourceType\\":\ +\\"lowPriority\\"}" --resource-name "TotalLowPriorityCores" --scope "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3\ +/providers/Microsoft.MachineLearningServices/locations/eastus" +``` +##### Example +``` +az quota create --properties "{\\"name\\":{\\"value\\":\\"MinPublicIpInterNetworkPrefixLength\\"},\\"limit\\":200,\\"re\ +sourceType\\":\\"MinPublicIpInterNetworkPrefixLength\\"}" --resource-name "MinPublicIpInterNetworkPrefixLength" \ +--scope "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Network/locations/eastus" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-name**|string|Resource name for a given resource provider. For example: - SKU name for Microsoft.Compute - Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices|resource_name|resourceName| +|**--scope**|string|The target Azure resource URI. For example, `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. This is the target Azure resource URI for the List GET operation. If a `{resourceName}` is added after `/quotaLimits`, then it's the target Azure resource URI in the GET operation for the specific resource.|scope|scope| +|**--limit**|integer|Quota limit.|limit|limit| +|**--resource-type**|choice|Resource type name.|resource_type|resourceType| +|**--properties**|any|Additional properties for the specific resource provider.|properties|properties| +|**--value**|string|Resource name.|value|value| + +#### Command `az quota update` + +##### Example +``` +az quota update --properties "{\\"name\\":{\\"value\\":\\"standardFSv2Family\\"},\\"limit\\":200}" --resource-name \ +"standardFSv2Family" --scope "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Compute/locations/\ +eastus" +``` +##### Example +``` +az quota update --properties "{\\"name\\":{\\"value\\":\\"MinPublicIpInterNetworkPrefixLength\\"},\\"limit\\":200,\\"re\ +sourceType\\":\\"MinPublicIpInterNetworkPrefixLength\\"}" --resource-name "MinPublicIpInterNetworkPrefixLength" \ +--scope "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Network/locations/eastus" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-name**|string|Resource name for a given resource provider. For example: - SKU name for Microsoft.Compute - Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices|resource_name|resourceName| +|**--scope**|string|The target Azure resource URI. For example, `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. This is the target Azure resource URI for the List GET operation. If a `{resourceName}` is added after `/quotaLimits`, then it's the target Azure resource URI in the GET operation for the specific resource.|scope|scope| +|**--limit**|integer|Quota limit.|limit|limit| +|**--resource-type**|choice|Resource type name.|resource_type|resourceType| +|**--properties**|any|Additional properties for the specific resource provider.|properties|properties| +|**--value**|string|Resource name.|value|value| + +### group `az quota operation` +#### Command `az quota operation list` + +##### Example +``` +az quota operation list +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +### group `az quota quota-request-status` +#### Command `az quota quota-request-status list` + +##### Example +``` +az quota quota-request-status list --scope "subscriptions/D7EC67B3-7657-4966-BFFC-41EFD36BAAB3/providers/Microsoft.Comp\ +ute/locations/eastus" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--scope**|string|The target Azure resource URI. For example, `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. This is the target Azure resource URI for the List GET operation. If a `{resourceName}` is added after `/quotaLimits`, then it's the target Azure resource URI in the GET operation for the specific resource.|scope|scope| +|**--filter**|string|| Field | Supported operators |---------------------|------------------------ |requestSubmitTime | ge, le, eq, gt, lt |provisioningState eq {QuotaRequestState} |resourceName eq {resourceName} |filter|$filter| +|**--top**|integer|Number of records to return.|top|$top| +|**--skiptoken**|string|The **Skiptoken** parameter is used only if a previous operation returned a partial result. If a previous response contains a **nextLink** element, the value of the **nextLink** element includes a **skiptoken** parameter that specifies a starting point to use for subsequent calls.|skiptoken|$skiptoken| + +#### Command `az quota quota-request-status show` + +##### Example +``` +az quota quota-request-status show --id "2B5C8515-37D8-4B6A-879B-CD641A2CF605" --scope "subscriptions/00000000-0000-000\ +0-0000-000000000000/providers/Microsoft.Compute/locations/eastus" +``` +##### Example +``` +az quota quota-request-status show --id "2B5C8515-37D8-4B6A-879B-CD641A2CF605" --scope "subscriptions/00000000-0000-000\ +0-0000-000000000000/providers/Microsoft.Compute/locations/eastus" +``` +##### Example +``` +az quota quota-request-status show --id "2B5C8515-37D8-4B6A-879B-CD641A2CF605" --scope "subscriptions/D7EC67B3-7657-496\ +6-BFFC-41EFD36BAAB3/providers/Microsoft.Compute/locations/eastus" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--id**|string|Quota request ID.|id|id| +|**--scope**|string|The target Azure resource URI. For example, `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. This is the target Azure resource URI for the List GET operation. If a `{resourceName}` is added after `/quotaLimits`, then it's the target Azure resource URI in the GET operation for the specific resource.|scope|scope| + +### group `az quota quota-resource-provider` +#### Command `az quota quota-resource-provider list` + +##### Example +``` +az quota quota-resource-provider list +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| \ No newline at end of file diff --git a/src/quota/setup.cfg b/src/quota/setup.cfg new file mode 100644 index 00000000000..2fdd96e5d39 --- /dev/null +++ b/src/quota/setup.cfg @@ -0,0 +1 @@ +#setup.cfg \ No newline at end of file diff --git a/src/quota/setup.py b/src/quota/setup.py new file mode 100644 index 00000000000..7d12501c58b --- /dev/null +++ b/src/quota/setup.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python + +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +from codecs import open +from setuptools import setup, find_packages + +# HISTORY.rst entry. +VERSION = '0.1.0' +try: + from azext_quota.manual.version import VERSION +except ImportError: + pass + +# The full list of classifiers is available at +# https://pypi.python.org/pypi?%3Aaction=list_classifiers +CLASSIFIERS = [ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Intended Audience :: System Administrators', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'License :: OSI Approved :: MIT License', +] + +DEPENDENCIES = [] + +try: + from azext_quota.manual.dependency import DEPENDENCIES +except ImportError: + pass + +with open('README.md', 'r', encoding='utf-8') as f: + README = f.read() +with open('HISTORY.rst', 'r', encoding='utf-8') as f: + HISTORY = f.read() + +setup( + name='quota', + version=VERSION, + description='Microsoft Azure Command-Line Tools AzureQuotaExtensionAPI Extension', + author='Microsoft Corporation', + author_email='azpycli@microsoft.com', + url='https://github.com/Azure/azure-cli-extensions/tree/master/src/quota', + long_description=README + '\n\n' + HISTORY, + license='MIT', + classifiers=CLASSIFIERS, + packages=find_packages(), + install_requires=DEPENDENCIES, + package_data={'azext_quota': ['azext_metadata.json']}, +)